aboutsummaryrefslogtreecommitdiff
path: root/src/common/module.cc
Commit message (Collapse)AuthorAgeFilesLines
* linux, dump_syms: Filter module entries outside specified rangesChristopher Grant2019-10-291-0/+29
| | | | | | | | | | | | | | | | | | | | Partitioned libraries generated with lld and llvm-objcopy currently contain a superset of debug information, beyond what applies to the library itself. This is because objcopy cannot split up debug information by partition - instead, it places a copy of all debug information into each partition. In lieu of potential future support for lld or objcopy becoming able to split up debug information, let dump_syms do the next best thing: - Find the address ranges of all PT_LOAD segments in the lib. - Supply these to the Module being generated. - Filter additions to the Module based on these ranges. Bug: 990190 Change-Id: Ib5f279f42e3f6ea79eed9665efbcc23c3c5d25dc Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1884699 Reviewed-by: Joshua Peraza <jperaza@chromium.org>
* Fix debug build after 16e0852Joshua Peraza2018-08-181-4/+6
| | | | | | | | Also remove ranges_handler_ which is unused. Change-Id: I771bf4b5fc4410f0406bf26e1e405905b55389ab Reviewed-on: https://chromium-review.googlesource.com/1180587 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Add support for parsing the DW_AT_ranges attributesGabriele Svelto2018-08-131-15/+24
| | | | | | | | | | | | | | | | 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>
* Avoid endl when writing symbol filesAaron Dierking2018-05-301-9/+8
| | | | | | | | | | endl flushes output after each line. Using "\n" instead significantly improves I/O efficiency. Change-Id: If6a5549fc3613ca3a7c9a71838ec36c5b7a20580 Reviewed-on: https://chromium-review.googlesource.com/1077626 Reviewed-by: Ivan Penkov <ivanpe@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
* Dump INFO CODE_ID containing Build ID in Linux dump_symsTed Mielczarek2016-06-101-1/+7
| | | | | | | | | | | | | I'd like to have the Build ID available for our symbol server uploading, and this will make it easy. Most of this change is me rewriting dump_symbols_unittest to be typed tests so I could add a new test there. R=mark@chromium.org BUG= Review URL: https://codereview.chromium.org/2052263002 .
* Handle ARM THUMB functions when removing duplicate PUBLIC entries.thestig@chromium.org2015-02-031-3/+18
| | | | | | | | | | | In ELF symtab/dynsym sections, THUMB function addresses have bit 0 set, whereas the DWARF function entries are not. R=mark@chromium.org Review URL: https://breakpad.appspot.com/7774002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1423 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Follow debug link correctlyhashimoto@chromium.org2015-02-031-13/+15
| | | | | | | | | | | | As thestig@chromium.org pointed out in https://breakpad.appspot.com/9684002, LoadSymbols() should return false if |read_gnu_debug_link| is false. BUG=chromium:453498 R=thestig@chromium.org Review URL: https://breakpad.appspot.com/2844002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1422 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Fix some fragile code that is likely to cause future memory corruptionerikchen@chromium.org2015-01-271-6/+3
| | | | | | | | | | | | | | | | | | 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
* Read dynamic symbols table even if binary contains debug infoted.mielczarek@gmail.com2014-11-031-4/+15
| | | | | | A=Wander Lairson Costa <wcosta@mozilla.com>. R=ted at https://breakpad.appspot.com/9684002/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1400 4c0a9323-5329-0410-9bdc-e9ce6186880e
* In Mac dump_syms, allow reading debug data out of both the Mach-O file and ↵rsesek@chromium.org2014-07-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | the dSYM. This adds a new |-g <dSYM path>| flag to dump_syms, to specify the dSYM path for the target Mach-O argument. The UUIDs and architectures of the two paths must match in order to dump symbols for this "split module." This reason for this is that for x86_64 binaries on OS X, the CFI data is stored in the __TEXT,__eh_frame segment of the Mach-O file, and the data is not copied into the dSYM by dsymutil. Therefore, just dumping the dSYM doesn't yield CFI data for x86_64 files, and both the dSYM and the Mach-O file must be dumped in order to produce a complete Breakpad symbol file. For i386 binaries, the CFI data is stored in the __DWARF,__debug_frame segment, which is part of the dSYM, so this isn't necessary. BUG=https://code.google.com/p/chromium/issues/detail?id=393594 R=mark@chromium.org Review URL: https://breakpad.appspot.com/6704002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1359 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Allow reading just CFI data when reading symbolsted.mielczarek@gmail.com2013-03-061-42/+42
| | | | | | R=thestig at https://breakpad.appspot.com/517002/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1124 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Linux/Mac: Add option to omit the CFI section in dump_syms.thestig@chromium.org2011-09-141-40/+46
| | | | | | Review URL: http://breakpad.appspot.com/304001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@835 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Add some unit tests for Linux WriteSymbolFileted.mielczarek2011-07-061-36/+52
| | | | | | | | | | | 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-0/+4
| | | | | | | | | | | | | | | 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
* Put PUBLIC lines in Mac symbol files.ted.mielczarek2011-03-041-1/+29
| | | | | | | | Exported symbols on Mach-O binaries are defined in a STABS section. This patch makes stabs_reader handle them, adds support for Extern symbols in the Module class (which are output as PUBLIC lines in symbol files), and the proper processing in stabs_to_module to hook it all up. A=mark R=jimb at http://breakpad.appspot.com/163001 and http://breakpad.appspot.com/267001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@778 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Clean up build for 64 bit.dmaclach2010-07-191-4/+4
| | | | | | | | | | | Fix up some broken mac projects. Consolidate project settings in xcconfig files. http://breakpad.appspot.com/130001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@627 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Remove duplicate FUNC entries from dump_syms output.thestig@chromium.org2010-07-131-8/+13
| | | | | | Review URL: http://breakpad.appspot.com/128001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@623 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Breakpad: Avoid using the C++ <cfoo> headers.ted.mielczarek2010-06-251-3/+3
| | | | | | | | | | | | 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 symbol dumper: Move Linux dumping classes into src/common.jimblandy2010-04-051-0/+235
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