aboutsummaryrefslogtreecommitdiff
path: root/src/common/windows/pdb_source_line_writer.h
diff options
context:
space:
mode:
authorNelson Billing <nbilling@google.com>2019-06-12 14:19:57 -0700
committerNelson Billing <nbilling@google.com>2019-06-12 21:20:27 +0000
commit87bc4022100020b2d01e5e8a97e3766db6a4ce5b (patch)
treeedec3ba67f0c431c88e33a0e899c17feb2d04b91 /src/common/windows/pdb_source_line_writer.h
parentPort new symbol upload API to Windows symupload tool. (diff)
downloadbreakpad-87bc4022100020b2d01e5e8a97e3766db6a4ce5b.tar.xz
Enable PE-only metadata dumping for 64bit (aka. PE32+ format) PEs files.
- 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>
Diffstat (limited to 'src/common/windows/pdb_source_line_writer.h')
-rw-r--r--src/common/windows/pdb_source_line_writer.h48
1 files changed, 7 insertions, 41 deletions
diff --git a/src/common/windows/pdb_source_line_writer.h b/src/common/windows/pdb_source_line_writer.h
index 3ed07361..c0adf29f 100644
--- a/src/common/windows/pdb_source_line_writer.h
+++ b/src/common/windows/pdb_source_line_writer.h
@@ -35,9 +35,10 @@
#include <atlcomcli.h>
-#include <unordered_map>
#include <string>
+#include <unordered_map>
+#include "common/windows/module_info.h"
#include "common/windows/omap.h"
struct IDiaEnumLineNumbers;
@@ -49,41 +50,6 @@ namespace google_breakpad {
using std::wstring;
using std::unordered_map;
-// A structure that carries information that identifies a pdb file.
-struct PDBModuleInfo {
- public:
- // The basename of the pdb file from which information was loaded.
- wstring debug_file;
-
- // The pdb's identifier. For recent pdb files, the identifier consists
- // of the pdb's guid, in uppercase hexadecimal form without any dashes
- // or separators, followed immediately by the pdb's age, also in
- // uppercase hexadecimal form. For older pdb files which have no guid,
- // the identifier is the pdb's 32-bit signature value, in zero-padded
- // hexadecimal form, followed immediately by the pdb's age, in lowercase
- // hexadecimal form.
- wstring debug_identifier;
-
- // A string identifying the cpu that the pdb is associated with.
- // Currently, this may be "x86" or "unknown".
- wstring cpu;
-};
-
-// A structure that carries information that identifies a PE file,
-// either an EXE or a DLL.
-struct PEModuleInfo {
- // The basename of the PE file.
- wstring code_file;
-
- // The PE file's code identifier, which consists of its timestamp
- // and file size concatenated together into a single hex string.
- // (The fields IMAGE_OPTIONAL_HEADER::SizeOfImage and
- // IMAGE_FILE_HEADER::TimeDateStamp, as defined in the ImageHlp
- // documentation.) This is not well documented, if it's documented
- // at all, but it's what symstore does and what DbgHelp supports.
- wstring code_identifier;
-};
-
class PDBSourceLineWriter {
public:
enum FileFormat {
@@ -101,6 +67,9 @@ class PDBSourceLineWriter {
// Returns true on success.
bool Open(const wstring &file, FileFormat format);
+ // Closes the current pdb file and its associated resources.
+ void Close();
+
// Sets the code file full path. This is optional for 32-bit modules. It is
// also optional for 64-bit modules when there is an executable file stored
// in the same directory as the PDB file. It is only required for 64-bit
@@ -110,12 +79,9 @@ class PDBSourceLineWriter {
// SetCodeFile() with a different file path and it will return false.
bool SetCodeFile(const wstring &exe_file);
- // Writes a map file from the current pdb file to the given file stream.
+ // Writes a Breakpad symbol file from the current pdb file to |symbol_file|.
// Returns true on success.
- bool WriteMap(FILE *map_file);
-
- // Closes the current pdb file and its associated resources.
- void Close();
+ bool WriteSymbols(FILE *symbol_file);
// Retrieves information about the module's debugging file. Returns
// true on success and false on failure.