Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Side by Side Diff: experimental/visual_studio_plugin/third_party/breakpad/common/dump_stabs.h

Issue 10928195: First round of dead file removal (Closed) Base URL: https://github.com/samclegg/nativeclient-sdk.git@master
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // -*- mode: C++ -*-
2
3 // Copyright (c) 2010 Google Inc.
4 // All rights reserved.
5 //
6 // Redistribution and use in source and binary forms, with or without
7 // modification, are permitted provided that the following conditions are
8 // met:
9 //
10 // * Redistributions of source code must retain the above copyright
11 // notice, this list of conditions and the following disclaimer.
12 // * Redistributions in binary form must reproduce the above
13 // copyright notice, this list of conditions and the following disclaimer
14 // in the documentation and/or other materials provided with the
15 // distribution.
16 // * Neither the name of Google Inc. nor the names of its
17 // contributors may be used to endorse or promote products derived from
18 // this software without specific prior written permission.
19 //
20 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
32 // Original author: Jim Blandy <jimb@mozilla.com> <jimb@red-bean.com>
33
34 // dump_stabs.h: Define the DumpStabsHandler class, which receives
35 // STABS debugging information from a parser and adds it to a Breakpad
36 // symbol file.
37
38 #ifndef COMMON_LINUX_DUMP_STABS_H__
39 #define COMMON_LINUX_DUMP_STABS_H__
40
41 //#include <stdint.h>
42
43 #include <string>
44 #include <vector>
45
46 #include "common/module.h"
47 #include "common/stabs_reader.h"
48
49 namespace google_breakpad {
50
51 using std::string;
52 using std::vector;
53
54 // A DumpStabsHandler is a handler that receives parsed STABS
55 // debugging information from a StabsReader, and uses that to populate
56 // a Module. (All classes are in the google_breakpad namespace.) A
57 // Module represents the contents of a Breakpad symbol file, and knows
58 // how to write itself out as such. A DumpStabsHandler thus acts as
59 // the bridge between STABS and Breakpad data.
60 class DumpStabsHandler: public google_breakpad::StabsHandler {
61 public:
62 // Receive parsed debugging information from a StabsReader, and
63 // store it all in MODULE.
64 DumpStabsHandler(Module *module) :
65 module_(module),
66 in_compilation_unit_(false),
67 comp_unit_base_address_(0),
68 current_function_(NULL),
69 current_source_file_(NULL),
70 current_source_file_name_(NULL) { }
71
72 // The standard StabsHandler virtual member functions.
73 bool StartCompilationUnit(const char *name, uint64_t address,
74 const char *build_directory);
75 bool EndCompilationUnit(uint64_t address);
76 bool StartFunction(const string &name, uint64_t address);
77 bool EndFunction(uint64_t address);
78 bool Line(uint64_t address, const char *name, int number);
79 void Warning(const char *format, ...);
80
81 // Do any final processing necessary to make module_ contain all the
82 // data provided by the STABS reader.
83 //
84 // Because STABS does not provide reliable size information for
85 // functions and lines, we need to make a pass over the data after
86 // processing all the STABS to compute those sizes. We take care of
87 // that here.
88 void Finalize();
89
90 private:
91
92 // An arbitrary, but very large, size to use for functions whose
93 // size we can't compute properly.
94 static const uint64_t kFallbackSize = 0x10000000;
95
96 // The module we're contributing debugging info to.
97 Module *module_;
98
99 // The functions we've generated so far. We don't add these to
100 // module_ as we parse them. Instead, we wait until we've computed
101 // their ending address, and their lines' ending addresses.
102 //
103 // We could just stick them in module_ from the outset, but if
104 // module_ already contains data gathered from other debugging
105 // formats, that would complicate the size computation.
106 vector<Module::Function *> functions_;
107
108 // Boundary addresses. STABS doesn't necessarily supply sizes for
109 // functions and lines, so we need to compute them ourselves by
110 // finding the next object.
111 vector<Module::Address> boundaries_;
112
113 // True if we are currently within a compilation unit: we have gotten a
114 // StartCompilationUnit call, but no matching EndCompilationUnit call
115 // yet. We use this for sanity checks.
116 bool in_compilation_unit_;
117
118 // The base address of the current compilation unit. We use this to
119 // recognize functions we should omit from the symbol file. (If you
120 // know the details of why we omit these, please patch this
121 // comment.)
122 Module::Address comp_unit_base_address_;
123
124 // The function we're currently contributing lines to.
125 Module::Function *current_function_;
126
127 // The last Module::File we got a line number in.
128 Module::File *current_source_file_;
129
130 // The pointer in the .stabstr section of the name that
131 // current_source_file_ is built from. This allows us to quickly
132 // recognize when the current line is in the same file as the
133 // previous one (which it usually is).
134 const char *current_source_file_name_;
135 };
136
137 } // namespace google_breakpad
138
139 #endif // COMMON_LINUX_DUMP_STABS_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698