aboutsummaryrefslogtreecommitdiff
path: root/src/common/windows/pdb_source_line_writer.cc
Commit message (Collapse)AuthorAgeFilesLines
* fix pointer style to match the style guideMike Frysinger2020-07-151-24/+24
| | | | | | | | | | 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>
* Enable PE-only metadata dumping for 64bit (aka. PE32+ format) PEs files.Nelson Billing2019-06-121-261/+12
| | | | | | | | | | | | | | | | | - Implement in common_windows_lib-- added class "PESourceLineWriter". - Add command-line switch to tell dump_syms to use PESourceLineWriter. Symbol data created this way will contain information to correlate the module with ones found in minidumps, along with frame info that allows much higher quality stack-walking in those minidumps. - Significant refactor of PDBSourceLineWriter-- all code concerned with extracting metadata from PE files has been moved into utility functions. This is to allow sharing of this functionality with newly- added PESourceLineWriter. - Added a unit test to dump_syms for the PE-only scenario. Change-Id: If0855f05d424d32d23f484995be5f34232179a37 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1525325 Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
* Write field indicating multiple symbols at an address in dump_symsMike Wittman2017-12-111-6/+3
| | | | | | | | | | | Updates dump_syms to write the optional 'm' first field in FUNCTION and PUBLIC records to indicate that the address corresponds to more than one symbol. Bug: google-breakpad:751 Change-Id: I850b0122324ed5f9ec747aa92ba354a3126a7ef9 Reviewed-on: https://chromium-review.googlesource.com/820711 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Add optional field indicating multiple symbols at an addressMike Wittman2017-11-291-51/+76
| | | | | | | | | | | | | | | | | | Adds an optional 'm' as the first field in FUNCTION and PUBLIC records to indicate that the address corresponds to more than one symbol. Controls this by a command line flag for now to give symbol file users a chance to update. Also reduces the number of IDiaSymbols retained in memory to one per address. This reduces memory consumption by 8% when processing chrome.dll.pdb. Updates the processor to parse the new optional field. Bug: google-breakpad:751 Change-Id: I6503edaf057312d21a1d63d9c84e5a4fa019dc46 Reviewed-on: https://chromium-review.googlesource.com/773418 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Make identical-code-folded symbol output more consistent between runsMike Wittman2017-11-141-37/+43
| | | | | | | | | | | | | | Consistently output the "least" symbol by decorated name when multiple symbols share an address. Testing with chrome.dll.pdb the diffs between the new and old output look sensible, and this is actually ~20% faster than the existing implementation. Bug: 749 Change-Id: Ie638559b63f0eb2dcb80b1ebb579228d62c63bb2 Reviewed-on: https://chromium-review.googlesource.com/758885 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Avoid skipping an initializer with a gotoBruce Dawson2017-10-261-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | C++ doesn't allow skipping initialization with a goto. This means that this code is illegal: void func(bool b) { if(b) goto END; int value = 0; //error C2362 with /permissive- //... value used here END: return; } Adding an extra scope makes the code legal. This problem is only detected with /permissive- but now that compiling with this switch is practical we might as well stay /permissive- clean: https://blogs.msdn.microsoft.com/vcblog/2016/11/16/permissive-switch/ Note that compiling /permissive- clean only works with the 10.0.16299.0 SDK which currently has other issues... Bug: 773476 Change-Id: I54e64aaef46d70a817cf7da272f76d9ae5f6a6f7 Reviewed-on: https://chromium-review.googlesource.com/740287 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Fix dump_syms clang compilation on WindowsMaciej Pawlowski2017-03-021-8/+8
| | | | | | | | | | | | Clang complains about bad format strings (DWORD is an unsigned long, not unsigned int) and signed/unsigned comparison. This change is necessary for https://codereview.chromium.org/2712423002/ BUG=245456 Change-Id: I58da92d43d90ac535c165fca346ee6866dfce22e Reviewed-on: https://chromium-review.googlesource.com/448037 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Handle ntdll only emitting PUBLIC at func entryScott Graham2017-02-231-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This handles a case encountered in ntdll.dll symbols for Windows 7, where a PUBLIC would be emitted only for the entry point to the function. The body of the function, however, is split in a PGO-ish fashion to another remote location in the binary. Because of this, there were large gaps in the RVA space that would be attributed to the "last" function that happened to have an entry point before the gap. In practice, something like this: 0x100 Func1 0x110 Func2 0x120 Func3 0x130 Func4 ... 0x800 LaterFuncs The bodies of Func1/2/3 tend to be implemented as a fast-path check, followed by a jmp to somewhere in the range between 0x130 and 0x800. Because no symbols are emitted for this range, everything is attributed to Func4, causing crash misattribution. In this CL, the change is: after emitting the entry point symbol, also walk in the original OMAP entries through the untranslated binary, and for each block until we resolve to a new symbol (via the same mechanism as we found the entry point) emit another PUBLIC indicating that there's another block that belongs to that symbol. This effectively breaks up the "0x130 - 0x800" range above. R=mark@chromium.org BUG=chromium:678874 Change-Id: Ib3741abab2e7158c81e3e34bca4340ce4d3153a1 Reviewed-on: https://chromium-review.googlesource.com/446717 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Don't let PDBSourceLineWriter::GetSymbolFunctionName return empty function namesTed Mielczarek2016-05-161-0/+10
| | | | | | | | | | | | | | It's possible for `IDiaSymbol::get_name` to return S_OK and provide and empty string. I haven't figured out the exact root cause yet (the symbols in question are coming from the Rust standard library), but FUNC lines with missing function names break the processor and so we should never do it. This change makes it output "<name omitted>" which matches the behavior of the DWARF dumping code. R=mark@chromium.org BUG=https://bugzilla.mozilla.org/show_bug.cgi?id=1272278 Review URL: https://codereview.chromium.org/1985643004 .
* Try loading msdiaNNN.dll if CoCreateInstance(CLSID_DiaSource) failsBirunthan Mohanathas2016-02-171-4/+36
| | | | | | | | | | Because tools/windows/symupload/symupload.cc uses `nullptr` (which requires VS2010), the CLSID comparison is only performed for msdia100.dll and later. When compiling with an older (or future) CLSID_DiaSource, we retain the existing behaviour (i.e. fail if CoCreateInstance fails). R=ivanpe@chromium.org BUG=https://bugzilla.mozilla.org/show_bug.cgi?id=1236343
* Fix regression on x86 for "Fix compile error with Windows clang"Will Harris2015-09-031-6/+5
| | | | | | R=thakis@chromium.org Review URL: https://codereview.chromium.org/1318013002 .
* Fix compile error with Windows clang.wfh@chromium.org2015-08-191-4/+7
| | | | | | | | | | | | | | | This change fixes the following errors shown during compile with Windows clang: error: cannot pass non-trivial object of type 'ATL::CComBSTR' to variadic function; expected type from format string was 'wchar_t *' [-Wnon-pod-varargs] Original CL: https://codereview.chromium.org/1252913009/ BUG=https://code.google.com/p/google-breakpad/issues/detail?id=662 Review URL: https://codereview.chromium.org/1307463003 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1494 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Add parameter --product to symupload.exeivanpe@chromium.org2014-11-171-0/+2
| | | | | | | | | | | | | | | | | Adding an optional parameter --product to symupload.exe. If specified it will be passed to the symbol server as POST parameter 'product'. As part of this, I'm also fixing: - Removed the .vcproj file as it can be generated from the .gyp file on demand. - error C4335: Mac file format detected. Fixed the line endings for omap.cc and dia_util.cc. - warning C4003: not enough actual parameters for macro 'max' Symupload.exe was compiled using MSVS 2013 and DIA SDK 12.0. Review URL: https://breakpad.appspot.com/9734002/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1402 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Change PrintFunctions to print functions in address order and not print ↵wfh@chromium.org2014-04-231-11/+53
| | | | | | | | | | | duplicate public functions. BUG=427 R=mark@chromium.org Review URL: https://breakpad.appspot.com/1634002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1319 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Change the way function and public symbols are obtained to use the ↵wfh@chromium.org2014-04-161-37/+48
| | | | | | | | | | | | | | findChildren DIA function. This has a substantial performance improvement over using the getSymbolsByAddr iterator, especially on certain 64bit DLLS. e.g. Time to process chrome_child.dll drops from 51 minutes to 21 secs. Note: new test data looks different because the ordering of lines is no longer by memory address. This does not affect processing. The test data has been manually compared to old data and matches (except additional PUBLIC symbols). Also, INFO lines are omitted because the source executable files are not checked in, so they are unavailable. R=ivanpe@chromium.org, mark@chromium.org Review URL: https://breakpad.appspot.com/1574002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1316 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Adding support for 64-bit Windows modules to ms_symbol_server_converter.ivan.penkov@gmail.com2014-04-101-9/+21
| | | | | | | | | | | | | | | | As part of that: - Updated MSSymbolServerConverter to also download the executable files from the symbol server and pass them to the PDBSourceLineWriter as it is required for successful conversion of symbols for 64-bit modules. - Added a .gyp file and target for the ms_symbol_server_converter library. - Updated PDBSourceLineWriter to allow executable files to be in locations different from the locations of the PDB files. - Minor style issue: * #define guards. * No space before ')' and after '('. R=mark@chromium.org, wfh@chromium.org Review URL: https://breakpad.appspot.com/1434002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1309 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Add support for Win64 stack unwind data as STACK CFIwfh@chromium.org2014-03-241-1/+191
| | | | | | | | | | | | | | | | This is a copy of https://breakpad.appspot.com/1264002/ where code review took place. See https://bugzilla.mozilla.org/show_bug.cgi?id=548035 and https://code.google.com/p/chromium/issues/detail?id=115922 Credit to Mikhail I. Izmestev <izmmishao5@gmail.com> for original patch in https://breakpad.appspot.com/345002/ BUG=572 TEST=Run dump_syms_unittest after compiling dump_syms_regtest.cc with x64 toolchain R=mark@chromium.org Review URL: https://breakpad.appspot.com/1274002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1290 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Fix missing semi-colons from r1267.thestig@chromium.org2014-01-171-3/+3
| | | | | | | | R=mark@chromium.org Review URL: https://breakpad.appspot.com/1094002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1275 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Windows: Fix remaining level 4 warnings.thestig@chromium.org2013-12-181-3/+5
| | | | | | | | R=mark@chromium.org Review URL: https://breakpad.appspot.com/954002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1267 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Add explicit OMAP support to dump_syms.chrisha@chromium.org2013-05-011-47/+112
| | | | | | | | | | | | | | This CL adds new utilities to common/windows for handling OMAP information in PDB files. It then augments PdbSourceLineWriter with explicit OMAP knowledge so that symbolization will proceed more cleanly for images whose PDB files contain OMAP information. This makes breakpad handle OMAPped symbol files as cleanly as WinDbg. Review URL: https://breakpad.appspot.com/570002/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1167 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Add filename to error message when PDBSourceLineWriter::Open failsted.mielczarek2012-02-151-3/+3
| | | | | | | P=Albert Zeyer R=ted at http://breakpad.appspot.com/286002/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@919 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Fixed message about unregistered msdia*dll. Builds with different DiaSDK ↵vitalybuka@chromium.org2011-04-261-2/+7
| | | | | | | | | | | | | need different dll. Rebuilt with Visual Studio 2008. Slightly improved refresh_binaries.bat. BUG=none TEST=none Review URL: http://breakpad.appspot.com/281001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@787 4c0a9323-5329-0410-9bdc-e9ce6186880e
* enable writing INFO CODE_ID line in symbol filested.mielczarek2011-02-151-3/+1
| | | | | | R=mark (originally from http://breakpad.appspot.com/180001) git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@773 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Make dump_syms output an INFO CODE_ID line that includes the code file and ↵ted.mielczarek2010-10-051-5/+119
| | | | | | | | code identifier. (Currently disabled to give Breakpad users time to update their processor code.) R=mark at http://breakpad.appspot.com/180001/show git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@710 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Issue 370 - fix PDBSourceLineWriter::GetModuleInfo's CPU detectionted.mielczarek2010-08-311-5/+19
| | | | | | R=nealsid at http://breakpad.appspot.com/181001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@678 4c0a9323-5329-0410-9bdc-e9ce6186880e
* don't output duplicate filenames in PDBSourceLineWriter. r=mark at ↵ted.mielczarek2009-11-231-3/+14
| | | | | | http://breakpad.appspot.com/43001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@431 4c0a9323-5329-0410-9bdc-e9ce6186880e
* output function names for PGO-optimized cold function blocks. r=mark at ↵ted.mielczarek2009-11-201-4/+63
| | | | | | http://breakpad.appspot.com/40007 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@430 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Emergency crash fix, tbr=brynermmentovai2007-04-251-1/+2
| | | | git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@147 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Replace GB_WSU_SAFE_SWPRINTF_TERMINATE with inline code (#145 followup).mmentovai2007-04-041-5/+8
| | | | | | | | | r=bryner http://groups.google.com/group/google-breakpad-dev/browse_thread/thread/f77da3d219cf9388 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@140 4c0a9323-5329-0410-9bdc-e9ce6186880e
* vswprintf causes Purify to fail (#145). r=darinmmentovai2007-03-301-7/+10
| | | | | | | http://groups.google.com/group/google-breakpad-dev/browse_thread/thread/88e18d9fac4eee22 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@135 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Don't output FUNC lines for 0-length functions (#139). r=brynermmentovai2007-03-221-0/+5
| | | | | | | http://groups.google.com/group/google-breakpad-dev/browse_thread/thread/c684520587356ec3 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@129 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Rename Airbag to Breakpad.mmentovai2007-02-141-2/+2
| | | | git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@122 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Fix capitalization of identifiers (#94). r=brynermmentovai2006-12-121-2/+6
| | | | | | | http://groups.google.com/group/airbag-dev/browse_thread/thread/15cf4d0ce5ed1014 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@85 4c0a9323-5329-0410-9bdc-e9ce6186880e
* symupload parameters don't match processor expectations (#91). r=brynermmentovai2006-12-061-47/+43
| | | | | | | | | | | | | | | | | - Interface change: the "guid" and "age" parameters supplied to a symbol server by symupload have been merged into "debug_identifier". Some other parameters have had their names changed. Additional code_file, os, and cpu parameters have been added. - Interface change: the format of the MODULE line at the top of dumped .sym files has changed slightly. The fields used for uuid and age have merged into a debug_identifier-type field. - debug_identifier is formatted the same way as CodeModule::debug_identifier for ease of server-side processing. http://groups.google.com/group/airbag-dev/browse_thread/thread/8022f504cf01f994 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@77 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Support GUID-less PDBs (#77). r=brynermmentovai2006-11-211-15/+105
| | | | | | | | | | | | - Handle MDCVInfoPDB20-based PDBs by outputting a signature instead of a guid in the MODULE line. - Identify the OS and CPU in the MODULE line. - Suppress multiple subsequent identical STACK WIN lines. http://groups.google.com/group/airbag-dev/browse_thread/thread/0f54e2c33ed5d82d git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@70 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Airbag client libraries should compile under MSVC .NET 2003/7.1 (#64).mmentovai2006-11-151-5/+14
| | | | | | | | | r=bryner http://groups.google.com/group/airbag-dev/browse_thread/thread/b838faeb50f71818 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@64 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Symbol file should contain module GUID at beginning (#66). r=brynermmentovai2006-11-061-10/+60
| | | | | | | | | | | | | | | | - The dumped symbol format now begins with a MODULE line identifying the uuid, age, and name of the source pdb file. - The processor ignores MODULE lines, but they are useful in figuring out how to index symbol files in a symbol store. - dump_syms and symupload now both accept either a pdb or exe/dll and will read the pdb regardless. - Figured out that MSSS always represents a module's age in pathnames in hexadecimal, and updated SimpleSymbolSupplier to match. http://groups.google.com/group/airbag-dev/browse_thread/thread/572108d6567edd58 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@59 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Support building with WIN32_LEAN_AND_MEAN (#60)mmentovai2006-10-261-10/+5
| | | | | | | | | | | | | - All Windows code now builds with WIN32_LEAN_AND_MEAN by default. - Header inclusion is adjusted as needed. Remove use of UuidToString (#39) - Also breaks dependency on RpcStringFree and therefore rpcrt4.lib. r=bryner http://groups.google.com/group/airbag-dev/browse_thread/thread/30f844cfc7ccd37f git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@51 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Add PUBLIC support to SourceLineResolver (resolve function names in Windowsmmentovai2006-10-201-1/+1
| | | | | | | | | | | system libraries) (#53) StackFrame::function_base is not populated (#49) r=bryner http://groups.google.com/group/airbag-dev/browse_thread/thread/a17d35348e7027bb git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@43 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Handle frame pointer omission, (#21), part 4 (final part!): FPO stackwalker.mmentovai2006-10-201-19/+316
| | | | | | | | | | | | | r=bryner - This change allows Airbag to properly walk win32 stacks produced by code built with MSVC's frame pointer omission optimization (/Oy). This optimization is enabled at /O1 and /O2. - There too many interface and file format changes to list here. http://groups.google.com/group/airbag-dev/browse_thread/thread/85ce85bfa8457ece git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@42 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Implement a tool to upload symbols on Windows, given an exe or dll file withbryner2006-10-161-0/+347
debugging info. Refactor common code into HTTPUpload so that the multipart POST request code can be shared with CrashReportSender. #47 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@39 4c0a9323-5329-0410-9bdc-e9ce6186880e