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:
mmentovai 2006-09-07 15:56:38 +00:00
parent 8d2f465c8a
commit 53d0f69d35
8 changed files with 506 additions and 527 deletions

View file

@ -48,14 +48,10 @@ class MemoryRegion {
// program. Returns true on success. Fails and returns false if address
// is out of the region's bounds (after considering the width of value),
// or for other types of errors.
virtual bool GetMemoryAtAddress(u_int64_t address,
u_int8_t* value) = 0;
virtual bool GetMemoryAtAddress(u_int64_t address,
u_int16_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;
virtual bool GetMemoryAtAddress(u_int64_t address, u_int8_t* value) = 0;
virtual bool GetMemoryAtAddress(u_int64_t address, u_int16_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;
};

View file

@ -199,8 +199,8 @@ static string* UTF16ToUTF8(const vector<u_int16_t>& in,
MinidumpObject::MinidumpObject(Minidump* minidump)
: minidump_(minidump)
, valid_(false) {
: minidump_(minidump),
valid_(false) {
}
@ -220,8 +220,8 @@ MinidumpStream::MinidumpStream(Minidump* minidump)
MinidumpContext::MinidumpContext(Minidump* minidump)
: MinidumpStream(minidump)
, context_() {
: MinidumpStream(minidump),
context_() {
}
@ -346,9 +346,9 @@ void MinidumpContext::Print() {
MinidumpMemoryRegion::MinidumpMemoryRegion(Minidump* minidump)
: MinidumpObject(minidump)
, descriptor_(NULL)
, memory_(NULL) {
: MinidumpObject(minidump),
descriptor_(NULL),
memory_(NULL) {
}
@ -481,10 +481,10 @@ void MinidumpMemoryRegion::Print() {
MinidumpThread::MinidumpThread(Minidump* minidump)
: MinidumpObject(minidump)
, thread_()
, memory_(NULL)
, context_(NULL) {
: MinidumpObject(minidump),
thread_(),
memory_(NULL),
context_(NULL) {
}
@ -608,10 +608,10 @@ void MinidumpThread::Print() {
MinidumpThreadList::MinidumpThreadList(Minidump* minidump)
: MinidumpStream(minidump)
, id_to_thread_map_()
, threads_(NULL)
, thread_count_(0) {
: MinidumpStream(minidump),
id_to_thread_map_(),
threads_(NULL),
thread_count_(0) {
}
@ -712,12 +712,12 @@ void MinidumpThreadList::Print() {
MinidumpModule::MinidumpModule(Minidump* minidump)
: MinidumpObject(minidump)
, module_()
, name_(NULL)
, cv_record_(NULL)
, misc_record_(NULL)
, debug_filename_(NULL) {
: MinidumpObject(minidump),
module_(),
name_(NULL),
cv_record_(NULL),
misc_record_(NULL),
debug_filename_(NULL) {
}
@ -1135,10 +1135,10 @@ void MinidumpModule::Print() {
MinidumpModuleList::MinidumpModuleList(Minidump* minidump)
: MinidumpStream(minidump)
, range_map_()
, modules_(NULL)
, module_count_(0) {
: MinidumpStream(minidump),
range_map_(),
modules_(NULL),
module_count_(0) {
}
@ -1245,11 +1245,11 @@ void MinidumpModuleList::Print() {
MinidumpMemoryList::MinidumpMemoryList(Minidump* minidump)
: MinidumpStream(minidump)
, range_map_()
, descriptors_(NULL)
, regions_(NULL)
, region_count_(0) {
: MinidumpStream(minidump),
range_map_(),
descriptors_(NULL),
regions_(NULL),
region_count_(0) {
}
@ -1387,9 +1387,9 @@ void MinidumpMemoryList::Print() {
MinidumpException::MinidumpException(Minidump* minidump)
: MinidumpStream(minidump)
, exception_()
, context_(NULL) {
: MinidumpStream(minidump),
exception_(),
context_(NULL) {
}
@ -1505,9 +1505,9 @@ void MinidumpException::Print() {
MinidumpSystemInfo::MinidumpSystemInfo(Minidump* minidump)
: MinidumpStream(minidump)
, system_info_()
, csd_version_(NULL) {
: MinidumpStream(minidump),
system_info_(),
csd_version_(NULL) {
}
@ -1619,8 +1619,8 @@ void MinidumpSystemInfo::Print() {
MinidumpMiscInfo::MinidumpMiscInfo(Minidump* minidump)
: MinidumpStream(minidump)
, misc_info_() {
: MinidumpStream(minidump),
misc_info_() {
}
@ -1694,12 +1694,12 @@ void MinidumpMiscInfo::Print() {
Minidump::Minidump(int fd)
: header_()
, directory_(NULL)
, stream_map_(NULL)
, fd_(fd)
, swap_(false)
, valid_(false) {
: header_(),
directory_(NULL),
stream_map_(NULL),
fd_(fd),
swap_(false),
valid_(false) {
}

View file

@ -148,8 +148,7 @@ class MinidumpStream : public MinidumpObject {
// user wants).
class MinidumpContext : public MinidumpStream {
public:
const MDRawContextX86* context() const {
return valid_ ? &context_ : NULL; }
const MDRawContextX86* context() const { return valid_ ? &context_ : NULL; }
// Print a human-readable representation of the object to stdout.
void Print();
@ -250,7 +249,7 @@ class MinidumpThread : public MinidumpObject {
void Print();
private:
// This objects are managed by MinidumpThreadList.
// These objects are managed by MinidumpThreadList.
friend class MinidumpThreadList;
MinidumpThread(Minidump* minidump);
@ -540,8 +539,7 @@ class MinidumpSystemInfo : public MinidumpStream {
// information. See also MinidumpSystemInfo.
class MinidumpMiscInfo : public MinidumpStream {
public:
const MDRawMiscInfo* misc_info() const {
return valid_ ? &misc_info_ : 0; }
const MDRawMiscInfo* misc_info() const { return valid_ ? &misc_info_ : 0; }
// Print a human-readable representation of the object to stdout.
void Print();
@ -629,30 +627,17 @@ class Minidump {
// type in a single minidump file.
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.
void Print();
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
// the Minidump object locate interesting streams quickly, and
// provides a convenient place to stash MinidumpStream objects.
struct MinidumpStreamInfo {
MinidumpStreamInfo()
: stream_index(0)
, stream(NULL) {}
MinidumpStreamInfo() : stream_index(0), stream(NULL) {}
~MinidumpStreamInfo() { delete stream; }
// Index into the MinidumpDirectoryEntries vector
@ -665,8 +650,6 @@ class Minidump {
typedef vector<MDRawDirectory> MinidumpDirectoryEntries;
typedef map<u_int32_t, MinidumpStreamInfo> MinidumpStreamMap;
bool swap() const { return valid_ ? swap_ : false; }
template<typename T> T* GetStream(T** stream);
MDRawHeader header_;

View file

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// stackwalker.cc: Generic stackwalker.
// stackwalker.h: Generic stackwalker.
//
// The Stackwalker class is an abstract base class providing common generic
// methods that apply to stacks from all systems. Specific implementations

View file

@ -29,8 +29,8 @@ namespace google_airbag {
StackwalkerX86::StackwalkerX86(MinidumpContext* context,
MemoryRegion* memory,
MinidumpModuleList* modules)
: Stackwalker(memory, modules)
, last_frame_pointer_(0) {
: Stackwalker(memory, modules),
last_frame_pointer_(0) {
if (memory_->GetBase() + memory_->GetSize() - 1 > 0xffffffff) {
// The x86 is a 32-bit CPU, the limits of the supplied stack are invalid.
// Mark memory_ = NULL, which will cause stackwalking to fail.