aboutsummaryrefslogtreecommitdiff
path: root/src/common/dwarf/dwarf2reader.h
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Refactor rangelist handling to prepare for dwarf5 .debug_rngslist"HEADmasterSterling Augustine2020-10-021-2/+4
| | | | | | | | | | | | This reverts commit 2b936b06c12657b684f6c7276d6ae5a24cb48ab5. After getting deep into the dwarf5 range reader, I realized that this should be done a somewhat different way. So reverting in favor or a better design, coming in a few minutes. Change-Id: Ie0b2846e70b3df1e637831e96ea69fe093f4e712 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2446011 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Refactor rangelist handling to prepare for dwarf5 .debug_rngslistSterling Augustine2020-09-281-4/+2
| | | | | | | | | | | | | | | | | | | | | | Dwarf5 introduces a new .debug_rngslist section, to take the place of the Dwarf4 .debug_ranges. However, the dwarf version is CU-based, and not file-based, so there can be both sections, and which section the CU needs isn't known until the dwarf parser encounters either DW_AT_ranges (dwarf 4 and lower) or DW_AT_rnglists_base (dwarf 5). This change refactors the code around range lists and range list readers to defer the decision of what section to parse until the relevant attribute is found. It moves the range list section reader from the range-list handler itself (which doesn't know which section it will use) to the CU context, and then lets the handler know when it encounters DW_AT_ranges. I will add a reader for the new dwarf5 section, along with the code to interpret the new section, and its forms and such in a subsequent patch. Change-Id: Ie92e4c9daa3f0acb98d7ef74f6b9c2065db849b1 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2433684 Reviewed-by: Mark Mentovai <mark@chromium.org>
* fix NDEBUG breakage with new dwarf5 codeMike Frysinger2020-07-161-0/+4
| | | | | | | | | | | These fields are only used when NDEBUG is not defined. We get build failures with the current code like: src/common/dwarf/dwarf2reader.h:181:12: error: private field 'string_buffer_length_' is not used [-Werror,-Wunused-private-field] uint64_t string_buffer_length_; Change-Id: I01d6e29d31d50e29ed3736e7197e70455724ae48 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2299022 Reviewed-by: Sterling Augustine <saugustine@google.com>
* fix pointer style to match the style guideMike Frysinger2020-07-151-44/+44
| | | | | | | | | | We do this in a lot of places, but we're inconsistent. Normalize the code to the Google C++ style guide. Change-Id: Ic2aceab661ce8f6b993dda21b1cdf5d2198dcbbf Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2262932 Reviewed-by: Sterling Augustine <saugustine@google.com> Reviewed-by: Mark Mentovai <mark@chromium.org>
* Add support for dwarf5 line tables.Sterling Augustine2020-07-141-5/+31
| | | | | | Change-Id: I2c0cd0e7163502e52fbf0745b611befb2e219071 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2276193 Reviewed-by: Sterling Augustine <saugustine@google.com>
* Move GetSectionByName out of CompilationUnit.Sterling Augustine2020-06-261-14/+7
| | | | | | | | | | For the upcoming Dwarf5 LineInfo changes, we will need to get several additional sections by name, but without a the Compilation Unit. This change prepares for that. Change-Id: I566855abb339a856110a2f7d243d3848fe2b3c18 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2268861 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Read dwarf5 compilation unit headers.Sterling Augustine2020-06-251-0/+21
| | | | | | | Change-Id: Ia85b2fb7b3cb821ad353a0003223d8b8465e792d Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2265259 Reviewed-by: Mike Frysinger <vapier@chromium.org> Reviewed-by: Mark Mentovai <mark@chromium.org>
* Add and handle various dwarf5 addrx forms.Sterling Augustine2020-06-241-0/+12
| | | | | | | | | | | | | Given the almost nonexistent direct dwarfreader tests, I think the best way to test these dwarf5 additions will be to add a full dwarf5 compilation unit similar to the ones used incidentally in the other tests. But I can't do that until enough dwarf5 is correctly implemented. Change-Id: I3418bda7212ae85c4b67232a2ab8fea9b9ca5d42 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2258838 Reviewed-by: Mark Mentovai <mark@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
* Add and handle new dwarf5 string-related forms.Sterling Augustine2020-06-221-0/+27
| | | | | | | | | | | | | | | | Adding the new forms by type and processing should avoid the problems with 0c0e24f709288a129d665ec27d6f089189318385, where new forms weren't handled in switch statements, breaking the build. Testing this should follow the testing for DW_FORM_GNU_str_index, very closely, but there doesn't appear to be any tests for that, or even DW_FORM_strp. Change-Id: I609d56b1dc879971bfef1070f063f8457fec6017 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2233839 Reviewed-by: Mike Frysinger <vapier@chromium.org> Reviewed-by: Mark Mentovai <mark@chromium.org>
* Use stdint.h numeric typesJoshua Peraza2020-04-091-110/+110
| | | | | | Change-Id: Ib815b0757539145c005d828080b92cbfa971a21b Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2141226 Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
* Revert "Add dwarf5 compilation-unit header handling."Mike Frysinger2020-03-101-21/+0
| | | | | | | | | | | | This reverts commit dbd454dbe47e584571388fc3533193416bdce67f. Reason for revert: The parent CL is causing breakage on CrOS due to unhandled enums. Before we can revert that, we need to revert this. Bug: google-breakpad:812 Change-Id: I7c2446f3cd8ed9f6411e90dbdd2434bc463b2f6c Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2095798 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Add dwarf5 compilation-unit header handling.Sterling Augustine2019-12-191-0/+21
| | | | | | | | Fix a small typo in DW_LANG__Python. Change-Id: I1fe54e501a5e8da5057ecc9ac00c7e7259a9bb3f Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1967975 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Enable reading DWARF4 CIEs with 32 bit addresses.Nelson Billing2019-12-051-0/+5
| | | | | | | | | | | | | - Reading DWARF4 CIEs was added in https://chromium-review.googlesource.com/c/breakpad/breakpad/+/406012 but it was only enabled for 64bit builds, since it would error out if the CIE address size was not 8 bytes. - Added a unit test to ensure that 32bit continues to work. Change-Id: I824bb40cdf12056d39da335adb55ed315970fb88 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1941034 Reviewed-by: Ivan Penkov <ivanpe@chromium.org> Reviewed-by: Mark Mentovai <mark@chromium.org>
* Add support for parsing the DW_AT_ranges attributesGabriele Svelto2018-08-131-0/+30
| | | | | | | | | | | | | | | | 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>
* Basic handling of CIE version 4 in dwarf readingScott Graham2016-11-021-0/+8
| | | | | | | | | | | | | | | | | CIE looks like it's been emitted by clang since ~May 2015 [1]. This means that we didn't have any CFI because this parse aborted, which meant that all stack walks reverted to stack scanning. Allow expected values for address size and segment descriptor size through so that dump_syms can generate at least somewhat reasonable data. [1]: http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20150518/277292.html R=mark@chromium.org BUG=chromium:627529 Change-Id: I6dc92f51c4afd25c2adff92c09ccb8bb03bf9112 Reviewed-on: https://chromium-review.googlesource.com/406012 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Add debug fission support.Yunlian Jiang2016-05-041-75/+311
| | | | | | | | | | | | | | | | | | | | | This added debug fission support. It tries to find the dwp file from the debug dir /usr/lib/debug/*/debug and read symbols from them. Most of this patch comes from https://critique.corp.google.com/#review/52048295 and some fixes after that. The elf_reader.cc comes from TOT google code. I just removed some google dependency. Current problems from this patch 1: Some type mismatch: from uint8_t * to char *. 2: Some hack to find the .dwp file. (replace .debug with .dwp) BUG=chromium:604440 R=dehao@google.com, ivanpe@chromium.org Review URL: https://codereview.chromium.org/1884283002 .
* convert to uint8_t* for binary data to fix -Wnarrowing build errorsMike Frysinger2016-01-261-27/+27
| | | | | | | | | | | | | | | 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 .
* Let breakpad build with -Wall on OS X and Linux.Lei Zhang2015-12-291-0/+2
| | | | | | | | | A=thakis@chromium.org Original Review: https://codereview.chromium.org/1550933002/ R=thakis@chromium.org Review URL: https://codereview.chromium.org/1554613002 .
* Remove dead code.mark@chromium.org2012-12-121-2/+1
| | | | | | | | | 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
* This change allows compiling the google-breakpad code using a global ↵ivan.penkov@gmail.com2012-06-281-13/+14
| | | | | | ::string class instead of std::string. For more details take a look at common/using_std_string.h git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@974 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Breakpad DWARF: Add support for DWARF 4 attribute forms.jimblandy2012-02-011-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch allows Breakpad's DWARF reader to at least read or skip attributes using the new forms defined in version 4 of the DWARF specification, instead of crashing. Attributes encoded using DW_FORM_flag_present, DW_FORM_sec_offset, and DW_FORM_exprloc should work fine now. However, compilation units using DW_FORM_ref_sig8 to refer to types in .debug_types will need further work to support. (GCC 4.6.2 does not emit .debug_types sections.) Specifically: - dwarf2reader::DwarfForm gets new values. - dwarf2reader::Dwarf2Handler and dwarf2reader::DIEHandler get new handler methods, named ProcessAttributeSignature, for DW_FORM_ref_sig8 attributes. - dwarf2reader::CompilationUnit reads DW_FORM_ref_sig8 attributes, and passes them to ProcessAttributeSignature. It also gets support for DW_FORM_sec_offset, DW_FORM_exprloc, and DW_FORM_flag_present, using the existing appropriate ProcessAttribute* methods. - dwarf2reader::DIEDispatcher passes through ProcessAttributeSignature attributes to its DIEHandler. - Unit tests are updated. a=jimb, r=ted.mielczarek Review URL: http://breakpad.appspot.com/343003/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@912 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Remove "using namespace std" from dwarf2reader.h. Using-directives aremark@chromium.org2011-10-111-18/+17
| | | | | | | | | | | | | forbidden by the style guide, and are bad practice in headers even under style rules that tolerate this construct. This fixes warnings such as: In file included from dwarf2reader.cc:34: dwarf2reader.h:53:17: warning: using namespace directive in global context in header [-Wheader-hygiene] Review URL: http://breakpad.appspot.com/312002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@862 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Clean up build for 64 bit.dmaclach2010-07-191-1/+1
| | | | | | | | | | | 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
* Breakpad Linux dumper: Parse the .eh_frame section.jimblandy2010-03-161-36/+206
| | | | | | | | | | | | | | | | | | | | | | | | Extend google_breakpad::CFISection with the ability to produce .eh_frame data. Entry headers have a different format, and pointers can be encoded in new and fascinating ways. Extend dwarf2reader::CallFrameInfo to be able to parse either DWARF CFI or .eh_frame data, as determined by an argument to the constructor. Cope with variations in header formats, encoded pointers, and additional data in 'z' augmentation data blocks. Extend the unit tests appropriately. Extend dump_syms to look for a .eh_frame section, and if it is present, find the necessary base addresess and parse its contents. There's no need for DwarfCFIToModule to check the version numbers; if CallFrameInfo can parse it, DwarfCFIToModule should be able to handle it. Adjust tests accordingly. a=jimblandy, r=nealsid git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@552 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Breakpad Linux dumper: Add support for dumping DWARF CFI as STACK CFI records.jimblandy2010-03-161-0/+468
| | | | | | | | | | | | | | | | | | | | | | | Define a new DWARF parser class, dwarf2reader::CallFrameInfo. Extend google_breakpad::Module to store and write out 'STACK CFI' records. Define a new google_breakpad::DwarfCFIToModule class, to accept DWARF CFI data from the parser and populate a Module with the equivalent STACK CFI records. Extend the Linux symbol dumping tool, dump_syms, to use dwarf2reader::CallFrameInfo, google_breakpad::DwarfCFIToModule, and google_breakpad::Module to extract DWARF CFI from the executable or shared library files and write it to the Breakpad symbol file. Define CFISection, a new class derived from TestAssembler::Section, for use in creating DWARF CFI data for test cases. a=jimblandy, r=nealsid git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@550 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Breakpad: Update copyright notice years on all files changed in 2010.jimblandy2010-02-091-1/+1
| | | | | | | | | | We've gotten mixed advice from the lawyery types about whether this matters. But it's easy enough to do. a=jimblandy, r=nealsid git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@517 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Breakpad DWARF Reader: Change LineInfoHandler::AddLine to provide the line's ↵jimblandy2010-01-221-7/+8
| | | | | | | | | | | | | | | | | | | | length. Breakpad's DWARF line number info parser provides a code address, file, and line number for each code/source pairing, but doesn't provide the length of the machine code. This makes that change, as discussed in the following thread: http://groups.google.com/group/google-breakpad-dev/browse_thread/thread/ed8d2fde79319368p This patch also makes the corresponding changes to the functioninfo.cc module, used by the Mac dumper. This patch has no effect on the Mac dumper's output. a=jimblandy, r=ccoutant git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@494 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Google Breakpad DWARF reader: Add a handler function for DIE references.jimblandy2010-01-121-0/+10
| | | | | | | | | | | | | | | Add a new member function to dwarf2reader::Dwarf2Handler, ProcessAttributeReference, for reporting attribute values that are references to other DIEs. This handler member function always receives an absolute offset (that is, relative to the start of the .debug_info section, not to the start of the compilation unit), regardless of the form the attribute uses. (Some forms are CU-relative, some are absolute.) a=jimblandy, r=nealsid git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@482 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Breakpad DWARF parser: Fix up documentation for DWARF reader classes.jimblandy@gmail.com2009-12-181-29/+30
| | | | | | | | | | | | | | | | | | | | | | | Fix typos. For CompilationUnit::Start, I was confused by the '-' in the original comment, taking it for a parenthetic clause marker, assuming an implicit "of the next compilation unit" at the end of the sentence. The comments should refer to the ".debug_info" section, not the "debug_info" section. The latter is not the section name actually used on any system (ELF or Mach-O), and the former is the name prescribed by the DWARF spec. Some of the comments for ProcessAttribute* member functions claim that OFFSET is from the start of the compilation unit, but that's not so: the code has always passed an offset relative to the start of the .debug_info section. a=jimblandy, r=nealsid git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@453 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Issue 42002: Breakpad DWARF parser: avoid using <stdint.h> typejimblandy@gmail.com2009-12-151-1/+1
| | | | | | | | | | | | | | | | | | | | | It seems that a use of the <stdint.h> type uintptr_t has crept into the DWARF parser. This defines a workaround for the GNU compilers (tested on both Mac and Linux) which will raise an error if it doesn't work. My personal preference would be just to assume that the <stdint.h> header is available and use the standard types everywhere, but 1) that would be a large change, likely to make merges with the other branches of the DWARF parser more difficult, and 2) it would make it quite difficult to build under Microsoft Visual Studio, which doesn't have the <stdint.h> header; Microsoft has said they have no plans to provide it, as they would rather "focus their efforts" on C++ and .NET. a=jimblandy, r=nealsid git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@448 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Issue 39002: Breakpad DWARF parser: Move DWARF parser to ↵jimblandy@gmail.com2009-12-151-0/+392
platform-independent directory. Move the DWARF parser, and the functioninfo.cc DWARF consumer, from src/common/mac/dwarf to src/commmon/dwarf, so that it can be shared between the Mac and Linux dumpers. Fix up #include directives, multiple inclusion protection macros, and Xcode build files. a=jimblandy, r=nealsid git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@446 4c0a9323-5329-0410-9bdc-e9ce6186880e