Conform to style guidelines.
- In class definitions, one-space indent for public/protected/private. - Multi-line initializer format puts comma at end of line. Also: - Eliminate the long list of friends in Minidump by making swap() public. (People who need to access unknown stream types directly will need access to swap() too.) git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@16 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
8d2f465c8a
commit
53d0f69d35
8 changed files with 506 additions and 527 deletions
|
@ -48,14 +48,10 @@ class MemoryRegion {
|
||||||
// program. Returns true on success. Fails and returns false if address
|
// program. Returns true on success. Fails and returns false if address
|
||||||
// is out of the region's bounds (after considering the width of value),
|
// is out of the region's bounds (after considering the width of value),
|
||||||
// or for other types of errors.
|
// or for other types of errors.
|
||||||
virtual bool GetMemoryAtAddress(u_int64_t address,
|
virtual bool GetMemoryAtAddress(u_int64_t address, u_int8_t* value) = 0;
|
||||||
u_int8_t* value) = 0;
|
virtual bool GetMemoryAtAddress(u_int64_t address, u_int16_t* value) = 0;
|
||||||
virtual bool GetMemoryAtAddress(u_int64_t address,
|
virtual bool GetMemoryAtAddress(u_int64_t address, u_int32_t* value) = 0;
|
||||||
u_int16_t* value) = 0;
|
virtual bool GetMemoryAtAddress(u_int64_t address, u_int64_t* value) = 0;
|
||||||
virtual bool GetMemoryAtAddress(u_int64_t address,
|
|
||||||
u_int32_t* value) = 0;
|
|
||||||
virtual bool GetMemoryAtAddress(u_int64_t address,
|
|
||||||
u_int64_t* value) = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -199,8 +199,8 @@ static string* UTF16ToUTF8(const vector<u_int16_t>& in,
|
||||||
|
|
||||||
|
|
||||||
MinidumpObject::MinidumpObject(Minidump* minidump)
|
MinidumpObject::MinidumpObject(Minidump* minidump)
|
||||||
: minidump_(minidump)
|
: minidump_(minidump),
|
||||||
, valid_(false) {
|
valid_(false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -220,8 +220,8 @@ MinidumpStream::MinidumpStream(Minidump* minidump)
|
||||||
|
|
||||||
|
|
||||||
MinidumpContext::MinidumpContext(Minidump* minidump)
|
MinidumpContext::MinidumpContext(Minidump* minidump)
|
||||||
: MinidumpStream(minidump)
|
: MinidumpStream(minidump),
|
||||||
, context_() {
|
context_() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -346,9 +346,9 @@ void MinidumpContext::Print() {
|
||||||
|
|
||||||
|
|
||||||
MinidumpMemoryRegion::MinidumpMemoryRegion(Minidump* minidump)
|
MinidumpMemoryRegion::MinidumpMemoryRegion(Minidump* minidump)
|
||||||
: MinidumpObject(minidump)
|
: MinidumpObject(minidump),
|
||||||
, descriptor_(NULL)
|
descriptor_(NULL),
|
||||||
, memory_(NULL) {
|
memory_(NULL) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -481,10 +481,10 @@ void MinidumpMemoryRegion::Print() {
|
||||||
|
|
||||||
|
|
||||||
MinidumpThread::MinidumpThread(Minidump* minidump)
|
MinidumpThread::MinidumpThread(Minidump* minidump)
|
||||||
: MinidumpObject(minidump)
|
: MinidumpObject(minidump),
|
||||||
, thread_()
|
thread_(),
|
||||||
, memory_(NULL)
|
memory_(NULL),
|
||||||
, context_(NULL) {
|
context_(NULL) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -608,10 +608,10 @@ void MinidumpThread::Print() {
|
||||||
|
|
||||||
|
|
||||||
MinidumpThreadList::MinidumpThreadList(Minidump* minidump)
|
MinidumpThreadList::MinidumpThreadList(Minidump* minidump)
|
||||||
: MinidumpStream(minidump)
|
: MinidumpStream(minidump),
|
||||||
, id_to_thread_map_()
|
id_to_thread_map_(),
|
||||||
, threads_(NULL)
|
threads_(NULL),
|
||||||
, thread_count_(0) {
|
thread_count_(0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -712,12 +712,12 @@ void MinidumpThreadList::Print() {
|
||||||
|
|
||||||
|
|
||||||
MinidumpModule::MinidumpModule(Minidump* minidump)
|
MinidumpModule::MinidumpModule(Minidump* minidump)
|
||||||
: MinidumpObject(minidump)
|
: MinidumpObject(minidump),
|
||||||
, module_()
|
module_(),
|
||||||
, name_(NULL)
|
name_(NULL),
|
||||||
, cv_record_(NULL)
|
cv_record_(NULL),
|
||||||
, misc_record_(NULL)
|
misc_record_(NULL),
|
||||||
, debug_filename_(NULL) {
|
debug_filename_(NULL) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1135,10 +1135,10 @@ void MinidumpModule::Print() {
|
||||||
|
|
||||||
|
|
||||||
MinidumpModuleList::MinidumpModuleList(Minidump* minidump)
|
MinidumpModuleList::MinidumpModuleList(Minidump* minidump)
|
||||||
: MinidumpStream(minidump)
|
: MinidumpStream(minidump),
|
||||||
, range_map_()
|
range_map_(),
|
||||||
, modules_(NULL)
|
modules_(NULL),
|
||||||
, module_count_(0) {
|
module_count_(0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1245,11 +1245,11 @@ void MinidumpModuleList::Print() {
|
||||||
|
|
||||||
|
|
||||||
MinidumpMemoryList::MinidumpMemoryList(Minidump* minidump)
|
MinidumpMemoryList::MinidumpMemoryList(Minidump* minidump)
|
||||||
: MinidumpStream(minidump)
|
: MinidumpStream(minidump),
|
||||||
, range_map_()
|
range_map_(),
|
||||||
, descriptors_(NULL)
|
descriptors_(NULL),
|
||||||
, regions_(NULL)
|
regions_(NULL),
|
||||||
, region_count_(0) {
|
region_count_(0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1387,9 +1387,9 @@ void MinidumpMemoryList::Print() {
|
||||||
|
|
||||||
|
|
||||||
MinidumpException::MinidumpException(Minidump* minidump)
|
MinidumpException::MinidumpException(Minidump* minidump)
|
||||||
: MinidumpStream(minidump)
|
: MinidumpStream(minidump),
|
||||||
, exception_()
|
exception_(),
|
||||||
, context_(NULL) {
|
context_(NULL) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1505,9 +1505,9 @@ void MinidumpException::Print() {
|
||||||
|
|
||||||
|
|
||||||
MinidumpSystemInfo::MinidumpSystemInfo(Minidump* minidump)
|
MinidumpSystemInfo::MinidumpSystemInfo(Minidump* minidump)
|
||||||
: MinidumpStream(minidump)
|
: MinidumpStream(minidump),
|
||||||
, system_info_()
|
system_info_(),
|
||||||
, csd_version_(NULL) {
|
csd_version_(NULL) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1619,8 +1619,8 @@ void MinidumpSystemInfo::Print() {
|
||||||
|
|
||||||
|
|
||||||
MinidumpMiscInfo::MinidumpMiscInfo(Minidump* minidump)
|
MinidumpMiscInfo::MinidumpMiscInfo(Minidump* minidump)
|
||||||
: MinidumpStream(minidump)
|
: MinidumpStream(minidump),
|
||||||
, misc_info_() {
|
misc_info_() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1694,12 +1694,12 @@ void MinidumpMiscInfo::Print() {
|
||||||
|
|
||||||
|
|
||||||
Minidump::Minidump(int fd)
|
Minidump::Minidump(int fd)
|
||||||
: header_()
|
: header_(),
|
||||||
, directory_(NULL)
|
directory_(NULL),
|
||||||
, stream_map_(NULL)
|
stream_map_(NULL),
|
||||||
, fd_(fd)
|
fd_(fd),
|
||||||
, swap_(false)
|
swap_(false),
|
||||||
, valid_(false) {
|
valid_(false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -148,8 +148,7 @@ class MinidumpStream : public MinidumpObject {
|
||||||
// user wants).
|
// user wants).
|
||||||
class MinidumpContext : public MinidumpStream {
|
class MinidumpContext : public MinidumpStream {
|
||||||
public:
|
public:
|
||||||
const MDRawContextX86* context() const {
|
const MDRawContextX86* context() const { return valid_ ? &context_ : NULL; }
|
||||||
return valid_ ? &context_ : NULL; }
|
|
||||||
|
|
||||||
// Print a human-readable representation of the object to stdout.
|
// Print a human-readable representation of the object to stdout.
|
||||||
void Print();
|
void Print();
|
||||||
|
@ -250,7 +249,7 @@ class MinidumpThread : public MinidumpObject {
|
||||||
void Print();
|
void Print();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// This objects are managed by MinidumpThreadList.
|
// These objects are managed by MinidumpThreadList.
|
||||||
friend class MinidumpThreadList;
|
friend class MinidumpThreadList;
|
||||||
|
|
||||||
MinidumpThread(Minidump* minidump);
|
MinidumpThread(Minidump* minidump);
|
||||||
|
@ -540,8 +539,7 @@ class MinidumpSystemInfo : public MinidumpStream {
|
||||||
// information. See also MinidumpSystemInfo.
|
// information. See also MinidumpSystemInfo.
|
||||||
class MinidumpMiscInfo : public MinidumpStream {
|
class MinidumpMiscInfo : public MinidumpStream {
|
||||||
public:
|
public:
|
||||||
const MDRawMiscInfo* misc_info() const {
|
const MDRawMiscInfo* misc_info() const { return valid_ ? &misc_info_ : 0; }
|
||||||
return valid_ ? &misc_info_ : 0; }
|
|
||||||
|
|
||||||
// Print a human-readable representation of the object to stdout.
|
// Print a human-readable representation of the object to stdout.
|
||||||
void Print();
|
void Print();
|
||||||
|
@ -629,30 +627,17 @@ class Minidump {
|
||||||
// type in a single minidump file.
|
// type in a single minidump file.
|
||||||
bool SeekToStreamType(u_int32_t stream_type, u_int32_t* stream_length);
|
bool SeekToStreamType(u_int32_t stream_type, u_int32_t* stream_length);
|
||||||
|
|
||||||
|
bool swap() const { return valid_ ? swap_ : false; }
|
||||||
|
|
||||||
// Print a human-readable representation of the object to stdout.
|
// Print a human-readable representation of the object to stdout.
|
||||||
void Print();
|
void Print();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// These classes are friends to give them access to this class' file
|
|
||||||
// I/O utility routines.
|
|
||||||
friend class MinidumpContext;
|
|
||||||
friend class MinidumpMemoryRegion;
|
|
||||||
friend class MinidumpThread;
|
|
||||||
friend class MinidumpThreadList;
|
|
||||||
friend class MinidumpModule;
|
|
||||||
friend class MinidumpModuleList;
|
|
||||||
friend class MinidumpMemoryList;
|
|
||||||
friend class MinidumpException;
|
|
||||||
friend class MinidumpSystemInfo;
|
|
||||||
friend class MinidumpMiscInfo;
|
|
||||||
|
|
||||||
// MinidumpStreamInfo is used in the MinidumpStreamMap. It lets
|
// MinidumpStreamInfo is used in the MinidumpStreamMap. It lets
|
||||||
// the Minidump object locate interesting streams quickly, and
|
// the Minidump object locate interesting streams quickly, and
|
||||||
// provides a convenient place to stash MinidumpStream objects.
|
// provides a convenient place to stash MinidumpStream objects.
|
||||||
struct MinidumpStreamInfo {
|
struct MinidumpStreamInfo {
|
||||||
MinidumpStreamInfo()
|
MinidumpStreamInfo() : stream_index(0), stream(NULL) {}
|
||||||
: stream_index(0)
|
|
||||||
, stream(NULL) {}
|
|
||||||
~MinidumpStreamInfo() { delete stream; }
|
~MinidumpStreamInfo() { delete stream; }
|
||||||
|
|
||||||
// Index into the MinidumpDirectoryEntries vector
|
// Index into the MinidumpDirectoryEntries vector
|
||||||
|
@ -665,8 +650,6 @@ class Minidump {
|
||||||
typedef vector<MDRawDirectory> MinidumpDirectoryEntries;
|
typedef vector<MDRawDirectory> MinidumpDirectoryEntries;
|
||||||
typedef map<u_int32_t, MinidumpStreamInfo> MinidumpStreamMap;
|
typedef map<u_int32_t, MinidumpStreamInfo> MinidumpStreamMap;
|
||||||
|
|
||||||
bool swap() const { return valid_ ? swap_ : false; }
|
|
||||||
|
|
||||||
template<typename T> T* GetStream(T** stream);
|
template<typename T> T* GetStream(T** stream);
|
||||||
|
|
||||||
MDRawHeader header_;
|
MDRawHeader header_;
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
// stackwalker.cc: Generic stackwalker.
|
// stackwalker.h: Generic stackwalker.
|
||||||
//
|
//
|
||||||
// The Stackwalker class is an abstract base class providing common generic
|
// The Stackwalker class is an abstract base class providing common generic
|
||||||
// methods that apply to stacks from all systems. Specific implementations
|
// methods that apply to stacks from all systems. Specific implementations
|
||||||
|
|
|
@ -29,8 +29,8 @@ namespace google_airbag {
|
||||||
StackwalkerX86::StackwalkerX86(MinidumpContext* context,
|
StackwalkerX86::StackwalkerX86(MinidumpContext* context,
|
||||||
MemoryRegion* memory,
|
MemoryRegion* memory,
|
||||||
MinidumpModuleList* modules)
|
MinidumpModuleList* modules)
|
||||||
: Stackwalker(memory, modules)
|
: Stackwalker(memory, modules),
|
||||||
, last_frame_pointer_(0) {
|
last_frame_pointer_(0) {
|
||||||
if (memory_->GetBase() + memory_->GetSize() - 1 > 0xffffffff) {
|
if (memory_->GetBase() + memory_->GetSize() - 1 > 0xffffffff) {
|
||||||
// The x86 is a 32-bit CPU, the limits of the supplied stack are invalid.
|
// The x86 is a 32-bit CPU, the limits of the supplied stack are invalid.
|
||||||
// Mark memory_ = NULL, which will cause stackwalking to fail.
|
// Mark memory_ = NULL, which will cause stackwalking to fail.
|
||||||
|
|
Loading…
Reference in a new issue