From cdbfdfc351a51f4fe0c264110cf68a59f0859f04 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 11 Oct 2012 17:02:45 -0500 Subject: MAINT-1709 Factor out realloc Reviewed by VoidPointer --- indra/newview/llspatialpartition.cpp | 98 +++++++++++++++++++----------------- indra/newview/llspatialpartition.h | 10 ++-- 2 files changed, 58 insertions(+), 50 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 7264ba3cab..3bb8e60787 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -4713,55 +4713,63 @@ LLCullResult::LLCullResult() mVisibleListAllocated = 0; mVisibleBridgeAllocated = 0; - mVisibleGroups = NULL; - mVisibleGroupsEnd = NULL; - mAlphaGroups = NULL; - mAlphaGroupsEnd = NULL; - mOcclusionGroups = NULL; - mOcclusionGroupsEnd = NULL; - mDrawableGroups = NULL; - mDrawableGroupsEnd = NULL; - mVisibleList = NULL; - mVisibleListEnd = NULL; - mVisibleBridge = NULL; - mVisibleBridgeEnd = NULL; + mVisibleGroups.clear(); + mVisibleGroups.push_back(NULL); + mVisibleGroupsEnd = &mVisibleGroups[0]; + mAlphaGroups.clear(); + mAlphaGroups.push_back(NULL); + mAlphaGroupsEnd = &mAlphaGroups[0]; + mOcclusionGroups.clear(); + mOcclusionGroups.push_back(NULL); + mOcclusionGroupsEnd = &mOcclusionGroups[0]; + mDrawableGroups.clear(); + mDrawableGroups.push_back(NULL); + mDrawableGroupsEnd = &mDrawableGroups[0]; + mVisibleList.clear(); + mVisibleList.push_back(NULL); + mVisibleListEnd = &mVisibleList[0]; + mVisibleBridge.clear(); + mVisibleBridge.push_back(NULL); + mVisibleBridgeEnd = &mVisibleBridge[0]; for (U32 i = 0; i < LLRenderPass::NUM_RENDER_TYPES; i++) { - mRenderMap[i] = NULL; - mRenderMapEnd[i] = NULL; + mRenderMap[i].clear(); + mRenderMap[i].push_back(NULL); + mRenderMapEnd[i] = &mRenderMap[i][0]; mRenderMapAllocated[i] = 0; } clear(); } -void LLCullResult::pushBack(void**& head, U32& count, void* val) +template +void LLCullResult::pushBack(T& head, U32& count, V* val) { + head[count] = val; + head.push_back(NULL); count++; - head = (void**) realloc((void*) head, sizeof(void*) * count); - head[count-1] = val; } void LLCullResult::clear() { mVisibleGroupsSize = 0; - mVisibleGroupsEnd = mVisibleGroups; + mVisibleGroupsEnd = &mVisibleGroups[0]; mAlphaGroupsSize = 0; - mAlphaGroupsEnd = mAlphaGroups; + mAlphaGroupsEnd = &mAlphaGroups[0]; mOcclusionGroupsSize = 0; - mOcclusionGroupsEnd = mOcclusionGroups; + mOcclusionGroupsEnd = &mOcclusionGroups[0]; mDrawableGroupsSize = 0; - mDrawableGroupsEnd = mDrawableGroups; + mDrawableGroupsEnd = &mDrawableGroups[0]; mVisibleListSize = 0; - mVisibleListEnd = mVisibleList; + mVisibleListEnd = &mVisibleList[0]; mVisibleBridgeSize = 0; - mVisibleBridgeEnd = mVisibleBridge; + mVisibleBridgeEnd = &mVisibleBridge[0]; for (U32 i = 0; i < LLRenderPass::NUM_RENDER_TYPES; i++) @@ -4771,13 +4779,13 @@ void LLCullResult::clear() mRenderMap[i][j] = 0; } mRenderMapSize[i] = 0; - mRenderMapEnd[i] = mRenderMap[i]; + mRenderMapEnd[i] = &(mRenderMap[i][0]); } } LLCullResult::sg_iterator LLCullResult::beginVisibleGroups() { - return mVisibleGroups; + return &mVisibleGroups[0]; } LLCullResult::sg_iterator LLCullResult::endVisibleGroups() @@ -4787,7 +4795,7 @@ LLCullResult::sg_iterator LLCullResult::endVisibleGroups() LLCullResult::sg_iterator LLCullResult::beginAlphaGroups() { - return mAlphaGroups; + return &mAlphaGroups[0]; } LLCullResult::sg_iterator LLCullResult::endAlphaGroups() @@ -4797,7 +4805,7 @@ LLCullResult::sg_iterator LLCullResult::endAlphaGroups() LLCullResult::sg_iterator LLCullResult::beginOcclusionGroups() { - return mOcclusionGroups; + return &mOcclusionGroups[0]; } LLCullResult::sg_iterator LLCullResult::endOcclusionGroups() @@ -4807,7 +4815,7 @@ LLCullResult::sg_iterator LLCullResult::endOcclusionGroups() LLCullResult::sg_iterator LLCullResult::beginDrawableGroups() { - return mDrawableGroups; + return &mDrawableGroups[0]; } LLCullResult::sg_iterator LLCullResult::endDrawableGroups() @@ -4817,7 +4825,7 @@ LLCullResult::sg_iterator LLCullResult::endDrawableGroups() LLCullResult::drawable_iterator LLCullResult::beginVisibleList() { - return mVisibleList; + return &mVisibleList[0]; } LLCullResult::drawable_iterator LLCullResult::endVisibleList() @@ -4827,7 +4835,7 @@ LLCullResult::drawable_iterator LLCullResult::endVisibleList() LLCullResult::bridge_iterator LLCullResult::beginVisibleBridge() { - return mVisibleBridge; + return &mVisibleBridge[0]; } LLCullResult::bridge_iterator LLCullResult::endVisibleBridge() @@ -4837,7 +4845,7 @@ LLCullResult::bridge_iterator LLCullResult::endVisibleBridge() LLCullResult::drawinfo_iterator LLCullResult::beginRenderMap(U32 type) { - return mRenderMap[type]; + return &mRenderMap[type][0]; } LLCullResult::drawinfo_iterator LLCullResult::endRenderMap(U32 type) @@ -4853,10 +4861,10 @@ void LLCullResult::pushVisibleGroup(LLSpatialGroup* group) } else { - pushBack((void**&) mVisibleGroups, mVisibleGroupsAllocated, (void*) group); + pushBack(mVisibleGroups, mVisibleGroupsAllocated, group); } ++mVisibleGroupsSize; - mVisibleGroupsEnd = mVisibleGroups+mVisibleGroupsSize; + mVisibleGroupsEnd = &mVisibleGroups[mVisibleGroupsSize]; } void LLCullResult::pushAlphaGroup(LLSpatialGroup* group) @@ -4867,10 +4875,10 @@ void LLCullResult::pushAlphaGroup(LLSpatialGroup* group) } else { - pushBack((void**&) mAlphaGroups, mAlphaGroupsAllocated, (void*) group); + pushBack(mAlphaGroups, mAlphaGroupsAllocated, group); } ++mAlphaGroupsSize; - mAlphaGroupsEnd = mAlphaGroups+mAlphaGroupsSize; + mAlphaGroupsEnd = &mAlphaGroups[mAlphaGroupsSize]; } void LLCullResult::pushOcclusionGroup(LLSpatialGroup* group) @@ -4881,10 +4889,10 @@ void LLCullResult::pushOcclusionGroup(LLSpatialGroup* group) } else { - pushBack((void**&) mOcclusionGroups, mOcclusionGroupsAllocated, (void*) group); + pushBack(mOcclusionGroups, mOcclusionGroupsAllocated, group); } ++mOcclusionGroupsSize; - mOcclusionGroupsEnd = mOcclusionGroups+mOcclusionGroupsSize; + mOcclusionGroupsEnd = &mOcclusionGroups[mOcclusionGroupsSize]; } void LLCullResult::pushDrawableGroup(LLSpatialGroup* group) @@ -4895,10 +4903,10 @@ void LLCullResult::pushDrawableGroup(LLSpatialGroup* group) } else { - pushBack((void**&) mDrawableGroups, mDrawableGroupsAllocated, (void*) group); + pushBack(mDrawableGroups, mDrawableGroupsAllocated, group); } ++mDrawableGroupsSize; - mDrawableGroupsEnd = mDrawableGroups+mDrawableGroupsSize; + mDrawableGroupsEnd = &mDrawableGroups[mDrawableGroupsSize]; } void LLCullResult::pushDrawable(LLDrawable* drawable) @@ -4909,10 +4917,10 @@ void LLCullResult::pushDrawable(LLDrawable* drawable) } else { - pushBack((void**&) mVisibleList, mVisibleListAllocated, (void*) drawable); + pushBack(mVisibleList, mVisibleListAllocated, drawable); } ++mVisibleListSize; - mVisibleListEnd = mVisibleList+mVisibleListSize; + mVisibleListEnd = &mVisibleList[mVisibleListSize]; } void LLCullResult::pushBridge(LLSpatialBridge* bridge) @@ -4923,10 +4931,10 @@ void LLCullResult::pushBridge(LLSpatialBridge* bridge) } else { - pushBack((void**&) mVisibleBridge, mVisibleBridgeAllocated, (void*) bridge); + pushBack(mVisibleBridge, mVisibleBridgeAllocated, bridge); } ++mVisibleBridgeSize; - mVisibleBridgeEnd = mVisibleBridge+mVisibleBridgeSize; + mVisibleBridgeEnd = &mVisibleBridge[mVisibleBridgeSize]; } void LLCullResult::pushDrawInfo(U32 type, LLDrawInfo* draw_info) @@ -4937,10 +4945,10 @@ void LLCullResult::pushDrawInfo(U32 type, LLDrawInfo* draw_info) } else { - pushBack((void**&) mRenderMap[type], mRenderMapAllocated[type], (void*) draw_info); + pushBack(mRenderMap[type], mRenderMapAllocated[type], draw_info); } ++mRenderMapSize[type]; - mRenderMapEnd[type] = mRenderMap[type] + mRenderMapSize[type]; + mRenderMapEnd[type] = &(mRenderMap[type][mRenderMapSize[type]]); } diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h index e63037b4a8..b1706d9d35 100644 --- a/indra/newview/llspatialpartition.h +++ b/indra/newview/llspatialpartition.h @@ -569,10 +569,10 @@ class LLCullResult public: LLCullResult(); - typedef LLSpatialGroup** sg_list_t; - typedef LLDrawable** drawable_list_t; - typedef LLSpatialBridge** bridge_list_t; - typedef LLDrawInfo** drawinfo_list_t; + typedef std::vector sg_list_t; + typedef std::vector drawable_list_t; + typedef std::vector bridge_list_t; + typedef std::vector drawinfo_list_t; typedef LLSpatialGroup** sg_iterator; typedef LLSpatialBridge** bridge_iterator; @@ -622,7 +622,7 @@ public: private: - void pushBack(void** &head, U32& count, void* val); + template void pushBack(T &head, U32& count, V* val); U32 mVisibleGroupsSize; U32 mAlphaGroupsSize; -- cgit v1.2.3 From c8d58f8db33360a0610a6dabd29916b4081a73db Mon Sep 17 00:00:00 2001 From: callum_linden Date: Wed, 17 Oct 2012 13:51:53 -0700 Subject: Update script that generates Google Breakpad symbols to look in tghe right place first and default to the original location if not found. --- indra/newview/generate_breakpad_symbols.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/generate_breakpad_symbols.py b/indra/newview/generate_breakpad_symbols.py index 5ebec1563e..ddc8a41136 100644 --- a/indra/newview/generate_breakpad_symbols.py +++ b/indra/newview/generate_breakpad_symbols.py @@ -75,7 +75,14 @@ def main(configuration, viewer_dir, viewer_exes, libs_suffix, dump_syms_tool, vi def dump_module(m): print "dumping module '%s' with '%s'..." % (m, dump_syms_tool) - child = subprocess.Popen([dump_syms_tool, m] , stdout=subprocess.PIPE) + dsym_full_path = m + if sys.platform in ['darwin']: + dsym_dir=os.path.join(m+".dSYM", 'Contents', 'Resources', 'DWARF') + if os.path.isdir(dsym_dir): + dsym_full_path=os.path.join(dsym_dir, os.path.basename(m)) + else: + dsym_full_path = m + child = subprocess.Popen([dump_syms_tool, dsym_full_path] , stdout=subprocess.PIPE) out, err = child.communicate() return (m,child.returncode, out, err) -- cgit v1.2.3 From 73cc2c6a7ab853b79e12d215060936fec7bf036d Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Sat, 20 Oct 2012 09:46:59 +0000 Subject: Adding expanded searching for symbols during google breakpad symbol scan --- indra/newview/CMakeLists.txt | 18 +++++++--- indra/newview/generate_breakpad_symbols.py | 54 +++++++++++++++++++++--------- 2 files changed, 52 insertions(+), 20 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index c0a252637f..6bdcf2df25 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1987,8 +1987,9 @@ if (INSTALL) endif (INSTALL) if (PACKAGE) + set(SYMBOL_SEARCH_DIRS "") if (WINDOWS) - set(VIEWER_DIST_DIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}") + list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}") set(VIEWER_SYMBOL_FILE "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/secondlife-symbols-windows.tar.bz2") # slplugin.exe failing symbols dump - need to debug, might have to do with updated version of google breakpad # set(VIEWER_EXE_GLOBS "${VIEWER_BINARY_NAME}${CMAKE_EXECUTABLE_SUFFIX} slplugin.exe") @@ -1997,13 +1998,20 @@ if (PACKAGE) set(VIEWER_COPY_MANIFEST copy_w_viewer_manifest) endif (WINDOWS) if (DARWIN) - set(VIEWER_DIST_DIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${product}.app") + list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}") + # *TODO: Generate these search dirs in the cmake files related to each binary. + list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_BINARY_DIR}/llplugin/slplugin/${CMAKE_CFG_INTDIR}") + list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_BINARY_DIR}/mac_crash_logger/${CMAKE_CFG_INTDIR}") + list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_BINARY_DIR}/mac_updater/${CMAKE_CFG_INTDIR}") + list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_BINARY_DIR}/media_plugins/gstreamer010/${CMAKE_CFG_INTDIR}") + list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_BINARY_DIR}/media_plugins/quicktime/${CMAKE_CFG_INTDIR}") + list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_BINARY_DIR}/media_plugins/webkit/${CMAKE_CFG_INTDIR}") set(VIEWER_SYMBOL_FILE "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/secondlife-symbols-darwin.tar.bz2") - set(VIEWER_EXE_GLOBS "'Second Life' SLPlugin") + set(VIEWER_EXE_GLOBS "'Second Life' SLPlugin mac-updater mac-crash-logger") set(VIEWER_LIB_GLOB "*.dylib") endif (DARWIN) if (LINUX) - set(VIEWER_DIST_DIR "${CMAKE_CURRENT_BINARY_DIR}/packaged") + list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_CURRENT_BINARY_DIR}/packaged") set(VIEWER_SYMBOL_FILE "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/secondlife-symbols-linux.tar.bz2") set(VIEWER_EXE_GLOBS "do-not-directly-run-secondlife-bin SLPlugin") set(VIEWER_LIB_GLOB "*${CMAKE_SHARED_MODULE_SUFFIX}*") @@ -2023,7 +2031,7 @@ if (PACKAGE) ARGS "${CMAKE_CURRENT_SOURCE_DIR}/generate_breakpad_symbols.py" "${LLBUILD_CONFIG}" - "${VIEWER_DIST_DIR}" + "${SYMBOL_SEARCH_DIRS}" "${VIEWER_EXE_GLOBS}" "${VIEWER_LIB_GLOB}" "${AUTOBUILD_INSTALL_DIR}/bin/dump_syms" diff --git a/indra/newview/generate_breakpad_symbols.py b/indra/newview/generate_breakpad_symbols.py index ddc8a41136..4181e4ebb3 100644 --- a/indra/newview/generate_breakpad_symbols.py +++ b/indra/newview/generate_breakpad_symbols.py @@ -39,17 +39,20 @@ import shlex import subprocess import tarfile import StringIO +import pprint + +DEBUG=False def usage(): - print >>sys.stderr, "usage: %s viewer_dir viewer_exes libs_suffix dump_syms_tool viewer_symbol_file" % sys.argv[0] + print >>sys.stderr, "usage: %s search_dirs viewer_exes libs_suffix dump_syms_tool viewer_symbol_file" % sys.argv[0] class MissingModuleError(Exception): def __init__(self, modules): Exception.__init__(self, "Failed to find required modules: %r" % modules) self.modules = modules -def main(configuration, viewer_dir, viewer_exes, libs_suffix, dump_syms_tool, viewer_symbol_file): - print "generate_breakpad_symbols run with args: %s" % str((configuration, viewer_dir, viewer_exes, libs_suffix, dump_syms_tool, viewer_symbol_file)) +def main(configuration, search_dirs, viewer_exes, libs_suffix, dump_syms_tool, viewer_symbol_file): + print "generate_breakpad_symbols run with args: %s" % str((configuration, search_dirs, viewer_exes, libs_suffix, dump_syms_tool, viewer_symbol_file)) if not re.match("release", configuration, re.IGNORECASE): print "skipping breakpad symbol generation for non-release build." @@ -67,28 +70,49 @@ def main(configuration, viewer_dir, viewer_exes, libs_suffix, dump_syms_tool, vi return True return fnmatch.fnmatch(f, libs_suffix) + search_dirs = search_dirs.split(";") + def list_files(): - for (dirname, subdirs, filenames) in os.walk(viewer_dir): - #print "scanning '%s' for modules..." % dirname - for f in itertools.ifilter(matches, filenames): - yield os.path.join(dirname, f) + for search_dir in search_dirs: + for (dirname, subdirs, filenames) in os.walk(search_dir): + if DEBUG: + print "scanning '%s' for modules..." % dirname + for f in itertools.ifilter(matches, filenames): + yield os.path.join(dirname, f) def dump_module(m): print "dumping module '%s' with '%s'..." % (m, dump_syms_tool) dsym_full_path = m - if sys.platform in ['darwin']: - dsym_dir=os.path.join(m+".dSYM", 'Contents', 'Resources', 'DWARF') - if os.path.isdir(dsym_dir): - dsym_full_path=os.path.join(dsym_dir, os.path.basename(m)) - else: - dsym_full_path = m child = subprocess.Popen([dump_syms_tool, dsym_full_path] , stdout=subprocess.PIPE) out, err = child.communicate() return (m,child.returncode, out, err) - out = tarfile.open(viewer_symbol_file, 'w:bz2') + + modules = {} + + for m in list_files(): + if DEBUG: + print "examining module '%s' ... " % m, + filename=os.path.basename(m) + if -1 != m.find("DWARF"): + # Just use this module; it has the symbols we want. + modules[filename] = m + if DEBUG: + print "found dSYM entry" + elif filename not in modules: + # Only use this if we don't already have a (possibly better) entry. + modules[filename] = m + if DEBUG: + print "found new entry" + elif DEBUG: + print "ignoring entry" + + + print "Found these following modules:" + pprint.pprint( modules ) - for (filename,status,symbols,err) in itertools.imap(dump_module, list_files()): + out = tarfile.open(viewer_symbol_file, 'w:bz2') + for (filename,status,symbols,err) in itertools.imap(dump_module, modules.values()): if status == 0: module_line = symbols[:symbols.index('\n')] module_line = module_line.split() -- cgit v1.2.3