aboutsummaryrefslogtreecommitdiff
path: root/src/common/dwarf_cu_to_module.cc
Commit message (Collapse)AuthorAgeFilesLines
* Skip empty DWARF code range when mapping linesLudovic Guegan2018-11-211-3/+6
| | | | | | | | BUG=777 Change-Id: Ic6d05eee3ff4660b6d087999a8cea04a1ee3e92b Reviewed-on: https://chromium-review.googlesource.com/c/1333507 Reviewed-by: Ted Mielczarek <ted.mielczarek@gmail.com>
* Make a parameter a const referenceJoshua Peraza2018-08-171-1/+1
| | | | | | Change-Id: I7d232dd9be3a03b5bd9f1d46c307d080fadf9116 Reviewed-on: https://chromium-review.googlesource.com/1179978 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Treat high_pc as an address for DW_FORM_GNU_addr_indexJoshua Peraza2018-08-171-1/+2
| | | | | | | | | | The high_pc is an address and has already been read from .debug_addr before being passed into FuncHandler::ProcessAttributeUnsigned. Bug:870908 Change-Id: I950098e360b5193f26bf767b8fa0a5f9d59e66ce Reviewed-on: https://chromium-review.googlesource.com/1178760 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Add support for parsing the DW_AT_ranges attributesGabriele Svelto2018-08-131-61/+179
| | | | | | | | | | | | | | | | This enables the DWARF reader to properly parse DW_AT_ranges attributes in compilation units and functions. Code covered by a function is now represented by a vector of ranges instead of a single contiguous range and DW_AT_ranges entries are used to populate it. All the code and tests that assumed functions to be contiguous entities has been updated to reflect the change. DW_AT_ranges attributes found in compilation units are parsed but no data is generated for them as it is not currently needed. BUG=754 Change-Id: I310391b525aaba0dd329f1e3187486f2e0c6d442 Reviewed-on: https://chromium-review.googlesource.com/1124721 Reviewed-by: Ted Mielczarek <ted.mielczarek@gmail.com>
* Fall back to the raw symbol name from DW_AT_MIPS_linkage_name when there is ↵Mike Hommey2018-06-191-0/+7
| | | | | | | | | | | | | | | | nothing else When DW_AT_MIPS_linkage_name doesn't demangle, breakpad currently throws the symbol completely, but in some cases, there is no DW_AT_name or DW_AT_abstract_origin to figure out a name, and the raw value from DW_AT_MIPS_linkage_name is still better than nothing. Fall back to that in when there is nothing else. R=ted@mielczarek.org Change-Id: I5cc7580244f2b99f5f1f279d09b904031cae1a37 Reviewed-on: https://chromium-review.googlesource.com/1082176 Reviewed-by: Ted Mielczarek <ted.mielczarek@gmail.com>
* Allow compiling the google-breakpad code using a global ::string class ↵Ivan Penkov2016-11-081-1/+1
| | | | | | | | | | | | instead of std::string. For more details take a look at common/using_std_string.h BUG= Change-Id: Ifebfc57f691ef3a3bef8cfed7106c567985edffc Reviewed-on: https://chromium-review.googlesource.com/399738 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Don't demangle Rust symbols by default, but allow linking to rust-demangle.Ted Mielczarek2016-10-251-0/+4
| | | | | | | | | | | | | | | | | The Rust compiler uses GCC C++ name mangling, but it has another layer of encoding so abi::cxa_demangle doesn't produce great results. This patch changes dump_syms to dump unmangled names by default so that consumers can demangle them after-the-fact. It also adds a tiny bit of support for linking against a Rust library I wrote that can demangle Rust symbols nicely: https://github.com/luser/rust-demangle-capi BUG= Change-Id: I63a425035ebb7ac516f067fed2aa782849ea9604 Reviewed-on: https://chromium-review.googlesource.com/402308 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Initial support for dumping DWARF corresponding to Swift codeMark Mentovai2016-09-231-21/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | The DWARF data for Swift code has a top-level DW_TAG_module DIE as the child of the DW_TAG_compile_unit DIE and the parent of the DW_TAG_subprogram DIEs that dump_syms uses to locate functions. dump_syms needs to process DW_TAG_module DIEs as introducing nested scopes to make it work with Swift. This also reworks demangling to be language-specific, so that the C++ demangler isn't invoked when processing Swift code. The DWARF data for Swift code presents its mangled names in the same form as used for C++ (DW_AT_MIPS_linkage_name or DW_AT_linkage_name) but the mangling is Swift-specific (beginning with _T instead of _Z). There is no programmatic interface to a Swift name demangler as an analogue to C++'s __cxa_demangle(), so mangled Swift names are exposed as-is. Xcode's "xcrun swift-demangle" can be used to post-process these mangled Swift names on macOS. Support for mangled names presented in a DW_AT_linkage_name attribute, as used by DWARF 4, is added. This supersedes the earlier use of DW_AT_MIPS_linkage_name. BUG=google-breakpad:702,google-breakpad:715 R=ted.mielczarek@gmail.com Review URL: https://codereview.chromium.org/2147523005 .
* Add parentheses to silence clang warningPrimiano Tucci2016-05-031-1/+2
| | | | | | | | | | | | | | | | | | | | | crrev.com/1887033002 introuced a clang warning (see below). This fixes it, so that breakpad can be rolled in chrome, where warnings are always fatal. From: https://build.chromium.org/p/tryserver.chromium.android/builders/android_chromium_gn_compile_dbg/builds/59031/steps/compile%20%28with%20patch%29/logs/stdio FAILED: clang_x64/obj/breakpad/dump_syms/dwarf_cu_to_module.o ../../breakpad/src/common/dwarf_cu_to_module.cc:420:20: error: '&&' within '||' [-Werror,-Wlogical-op-parentheses] if (declaration_ && qualified_name || (unqualified_name && enclosing_name)) { ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ ~~ ../../breakpad/src/common/dwarf_cu_to_module.cc:420:20: note: place parentheses around the '&&' expression to silence this warning if (declaration_ && qualified_name || (unqualified_name && enclosing_name)) { ^ ( ) R=mark@chromium.org, petrcermak@chromium.org Review URL: https://codereview.chromium.org/1928363002 .
* Fix DWARF handling of inlined functions in namespacesTed Mielczarek2016-04-141-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently an inlined function in a namespace in DWARF will be given a name comprised of just `namespace::`. This is due to a logic error in ComputeQualifiedName, where it doesn't handle an empty `unqualified_name` properly. We apparently have a fair number of these in our Mac builds, an example of the DWARF that's being mishandled looks like: 0x117eda40: TAG_namespace [5] * AT_name( "js" ) AT_decl_file( "../../dist/include/js/Utility.h" ) AT_decl_line( 35 ) 0x11808500: TAG_subprogram [251] * AT_low_pc( 0x0000000002f12110 ) AT_high_pc( 0x0000000002f1216b ) AT_APPLE_omit_frame_ptr( 0x01 ) AT_frame_base( rsp ) AT_abstract_origin( {0x0000000011800a4f}"_ZN2js40TraceManuallyBarrieredGenericPointerEdgeEP8JSTracerPPNS_2gc4CellEPKc" ) AT_MIPS_linkage_name( "_ZN2js40TraceManuallyBarrieredGenericPointerEdgeEP8JSTracerPPNS_2gc4CellEPKc" ) AT_name( "TraceManuallyBarrieredGenericPointerEdge" ) AT_decl_file( "/builds/slave/rel-m-rel-m64_bld-000000000000/build/js/src/gc/Marking.cpp" ) AT_decl_line( 547 ) AT_external( 0x01 ) AT_APPLE_optimized( 0x01 ) AT_inline( DW_INL_inlined ) This turned a few instances of this in the file I was testing on into `<name omitted>`, which seems to just be a symptom of the "DW_AT_abstract_origin comes later in the file" issue. (Which is probably also worth fixing given that it occurs some 29k times when dumping symbols from Firefox's XUL binary, but it's a separate issue.) R=mark@chromium.org BUG= Review URL: https://codereview.chromium.org/1887033002 .
* convert to uint8_t* for binary data to fix -Wnarrowing build errorsMike Frysinger2016-01-261-2/+3
| | | | | | | | | | | | | | | Newer gcc versions default to -Werror=narrowing when using newer C++ standards (which we do). This causes issues when we try to stuff a value like 0xea into a char -- the value is out of range for signed char bytes. That's when gcc throws an error: .../bytereader_unittest.cc: In member function 'virtual void Reader_DW_EH_PE_absptr4_Test::TestBody()': .../bytereader_unittest.cc:400:55: error: narrowing conversion of '234' from 'int' to 'char' inside { } [-Wnarrowing] BUG=chromium:579384 TEST=`make check` passes R=mark@chromium.org Review URL: https://codereview.chromium.org/1605153004 .
* Demangle symbol namehashimoto@chromium.org2015-02-031-1/+1
| | | | | | | | | | | | The spec says it should be demangled. https://code.google.com/p/google-breakpad/wiki/SymbolFiles BUG=chromium:453498 R=mark@chromium.org Review URL: https://breakpad.appspot.com/2854002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1421 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Fix some fragile code that is likely to cause future memory corruptionerikchen@chromium.org2015-01-271-7/+21
| | | | | | | | | | | | | | | | | | problems. - The ordering of keys in stl containers cannot change. Make the relevant members const to guarantee this assumption. - Add handling and logging for demangle errors. - Fix a potential double-delete bug if a function passed to AddFunction() is already present. BUG=chromium:449214 R=mark@chromium.org Review URL: https://breakpad.appspot.com/10704002/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1415 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Fix a source of memory corruption.erikchen@chromium.org2015-01-261-7/+13
| | | | | | | | | | | This error was causing crashes in official Chrome Mac builds on 10.8.5 machines. BUG=chromium:449214 R=mark@chromium.org git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1414 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Both std::tr1::unordered_set and std::unordered_set are not allowed inivanpe@chromium.org2014-07-211-10/+1
| | | | | | | | | | | Google at this moment. This change is implementing a workaround that allows switching to hash_set and hash_map. R=mark@chromium.org Review URL: https://breakpad.appspot.com/6694002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1354 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Fix compilation error in Linux libc++ builds due to use of tr1/.mark@chromium.org2014-07-071-0/+8
| | | | | | | | | | | Patch by Sergey Matveev <earthdok@chromium.org> BUG=chromium:391792 Review URL: https://breakpad.appspot.com/7674002/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1345 4c0a9323-5329-0410-9bdc-e9ce6186880e
* dump_syms: use unordered_set<> instead of set<> for speed.mark@chromium.org2014-06-261-4/+4
| | | | | | | | | | | | | dump_syms spends a lot of time trying to compare strings. This change speeds up processing of libwebviewchromium.so by 30% on my linux machine. Patch by Junichi Uekawa <uekawa@chromium.org> Review URL: https://breakpad.appspot.com/2714002/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1341 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Fix a memory leak in DwarfCUToModule::FuncHandler::Finish().thestig@chromium.org2014-05-281-2/+2
| | | | | | | | | BUG=591 R=mark@chromium.org Review URL: https://breakpad.appspot.com/2704002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1333 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Cleanup: Use scoped_ptr where appropriate in DwarfCUToModule.thestig@chromium.org2013-04-241-10/+9
| | | | | | Review URL: https://breakpad.appspot.com/572002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1164 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Add an option to not handle DWARF inter-compilation unit references in Linux ↵thestig@chromium.org2013-04-241-26/+72
| | | | | | | | | | dump_syms. This saves a lot of memory for dump_syms. Review URL: https://breakpad.appspot.com/565002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1163 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Minor Android fixup for symbol dumping codeted.mielczarek@gmail.com2013-03-061-4/+9
| | | | | | | Patch by Julian Seward <jseward@acm.org> R=digit at https://breakpad.appspot.com/521002/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1123 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Add missing "using std::sort" to dwarf_cu_to_module.cc.ted.mielczarek@gmail.com2013-02-281-0/+1
| | | | | | Patch by Julian Seward <jseward@acm.org>, R=ted git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1117 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Include the compilation directory for FILE entries, making them absolute ↵ted.mielczarek@gmail.com2013-01-231-5/+13
| | | | | | | | instead of relative A=Ryan Sleevi <rsleevi@chromium.org> R=mark,ted at https://breakpad.appspot.com/385001/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1106 4c0a9323-5329-0410-9bdc-e9ce6186880e
* DWARF can store DW_AT_high_pc as either an address or a constant. In the latterjimblandy2013-01-081-2/+13
| | | | | | | | | case it's the length of the function. breakpad always treats it as an address. a=mattdr, r=jimb git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1094 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Remove dead code.mark@chromium.org2012-12-121-8/+4
| | | | | | | | | Patch by Rafael Espindola <rafael.espindola@gmail.com> Review URL: http://breakpad.appspot.com/502003/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1091 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Comment out unused arguments in definitions, as required by the Google C++ ↵jimblandy2012-10-051-3/+3
| | | | | | | | | | Style Guide. A=Rafael Ávila de Espíndola <respindola@mozilla.com> R=jimb at https://breakpad.appspot. com/479003 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1064 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Fix out-of-date comment for DwarfCUToModule::FilePrivate::common_strings.jimblandy2012-10-051-6/+14
| | | | | | | No review. git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1063 4c0a9323-5329-0410-9bdc-e9ce6186880e
* If a specification DIE has a DW_AT_MIPS_linkage_name attribute, don't failjimblandy2012-10-051-20/+39
| | | | | | | | | | | to add it to the specifications table. Record the fully-qualified name provided by the demangler in the table. A=Rafael Ávila de Espíndola <respindola@mozilla.com> R=jimb at https://breakpad.appspot. com/478004/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1062 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Use DW_AT_MIPS_linkage_name if it is available to get names of functions ↵ted.mielczarek@gmail.com2012-10-041-10/+35
| | | | | | | | with arguments during symbol dumping. A=Rafael Ávila de Espíndola <respindola@mozilla.com> R=ted at https://breakpad.appspot.com/457002/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1059 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Fix compiler warning from format stringted.mielczarek2012-04-251-1/+1
| | | | | | | Patch by Chris Dearman <chris@mips.com> R=ted at http://breakpad.appspot.com/369002/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@958 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Changes to get the breakpad client compiling and running on Android usingmark@chromium.org2012-04-031-1/+5
| | | | | | | | | | | ndk-7b. Patch by Carlos Valdivia <carlosvaldivia@google.com> Review URL: https://breakpad.appspot.com/363001/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@945 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Add some unit tests for Linux WriteSymbolFileted.mielczarek2011-07-061-0/+1
| | | | | | | | | | | This patch adds synth_elf::{StringTable,SymbolTable,ELF} classes to produce in-memory ELF files to properly test the Linux symbol dumping code. It also uses those classes to add some basic tests for the WriteSymbolFile function. R=jimb at http://breakpad.appspot.com/277001/show git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@794 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Google Breakpad Issue 417: Handle DWARF that omits function names.jimblandy2011-03-111-1/+14
| | | | | | | | | | | | | | | This patch makes sure dump_syms behaves properly when presented with malformed DWARF data that provides no name for a function. We print a warning message to stderr, and subsitute "<name omitted>" for the empty string, so that the "FUNC" record written to the symbol file for the function is still well-formed. (We may have line number data covering the function, so it would be a shame to omit the function altogether.) Unit tests included. a=jimblandy, r=ted.mielczarek git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@779 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Fix assert failure in dump_syms caused by binary linked with gold.thestig@chromium.org2010-11-081-2/+2
| | | | | | | | | Original review: http://breakpad.appspot.com/224001 A=raymes R=ccoutant Review URL: http://breakpad.appspot.com/227001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@729 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Use <inttypes.h> macros for formatting fixed-width types.mark@chromium.org2010-08-271-1/+7
| | | | | | Review URL: http://breakpad.appspot.com/162002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@676 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Breakpad Linux/Mac symbol dumper: Share duplicate strings that arise in ↵jimblandy2010-07-171-1/+26
| | | | | | | | | | | | | | DWARF data. This patch avoids allocating many copies of identical strings appearing in debugging information. Without this patch, running dump_syms on Mozilla's libxul.so (with 173MiB of debugging information) has a peak resident set of around 450MiB. With this patch, the peak is around 365MiB. a=jimblandy, r=mark git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@626 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Fix a couple of tiny things for GCC pedantryted.mielczarek@gmail.com2010-07-081-1/+1
| | | | git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@622 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Breakpad: Avoid using the C++ <cfoo> headers.ted.mielczarek2010-06-251-2/+4
| | | | | | | | | | | | This patch avoids unnecessary use of the <cfoo> headers in files that don't actually use the identifiers they declare in the std:: namespace. It also changes some files to better conform with the "Names and Order of Includes" rules in the Google C++ Style Guide. A=jimb R=mark git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@619 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Breakpad DWARF support: Check for DWARF line info under Mac OS X section names.ted.mielczarek2010-06-251-0/+4
| | | | | | | | | | For some reason, Mac OS X places DWARF debugging information in sections whose names begin with "__", rather than the names beginning with "." given in the DWARF spec. This patch changes google_breakpad::DwarfCUToModule to look for line number information under both names. A=jimb R=mark git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@612 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Breakpad symbol dumper: Move Linux dumping classes into src/common.jimblandy2010-04-051-0/+881
The Linux symbol dumper's classes are reasonably portable, and should be usable for the Mac dumper as well. Move them to src/common, along with their unit tests. Update #include directives and Makefile. a=jimblandy, r=nealsid git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@567 4c0a9323-5329-0410-9bdc-e9ce6186880e