Issue 49012: Breakpad Processor: Rename 'StackFrameInfo' structure to 'WindowsFrameInfo'.

Also, rename stack_frame_info.h to windows_frame_info.h.

If it seems odd to have functions like FillSourceLineInfo returning
Windows-specific data structures... well, it is! This patch just makes
it more obvious what's going on.

a=jimblandy, r=nealsid


git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@471 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
jimblandy 2009-12-23 22:32:14 +00:00
parent 92b1f834d1
commit b64d76a3b8
19 changed files with 55 additions and 55 deletions

View file

@ -91,7 +91,7 @@ src_libbreakpad_la_SOURCES = \
src/processor/scoped_ptr.h \
src/processor/simple_symbol_supplier.cc \
src/processor/simple_symbol_supplier.h \
src/processor/stack_frame_info.h \
src/processor/windows_frame_info.h \
src/processor/stackwalker.cc \
src/processor/stackwalker_amd64.cc \
src/processor/stackwalker_amd64.h \

View file

@ -475,7 +475,7 @@ src_libbreakpad_la_SOURCES = \
src/processor/scoped_ptr.h \
src/processor/simple_symbol_supplier.cc \
src/processor/simple_symbol_supplier.h \
src/processor/stack_frame_info.h \
src/processor/windows_frame_info.h \
src/processor/stackwalker.cc \
src/processor/stackwalker_amd64.cc \
src/processor/stackwalker_amd64.h \

View file

@ -63,7 +63,7 @@ class BasicSourceLineResolver : public SourceLineResolverInterface {
virtual bool HasModule(const string &module_name) const;
virtual StackFrameInfo* FillSourceLineInfo(StackFrame *frame) const;
virtual WindowsFrameInfo* FillSourceLineInfo(StackFrame *frame) const;
private:
template<class T> class MemAddrMap;

View file

@ -40,7 +40,7 @@ namespace google_breakpad {
using std::string;
struct StackFrame;
struct StackFrameInfo;
struct WindowsFrameInfo;
class SourceLineResolverInterface {
public:
@ -68,9 +68,9 @@ class SourceLineResolverInterface {
// module_name fields must already be filled in. Additional debugging
// information, if available, is returned. If the information is not
// available, returns NULL. A NULL return value does not indicate an
// error. The caller takes ownership of any returned StackFrameInfo
// error. The caller takes ownership of any returned WindowsFrameInfo
// object.
virtual StackFrameInfo* FillSourceLineInfo(StackFrame *frame) const = 0;
virtual WindowsFrameInfo* FillSourceLineInfo(StackFrame *frame) const = 0;
protected:
// SourceLineResolverInterface cannot be instantiated except by subclasses

View file

@ -53,7 +53,7 @@ class MemoryRegion;
class MinidumpContext;
class SourceLineResolverInterface;
struct StackFrame;
struct StackFrameInfo;
struct WindowsFrameInfo;
class SymbolSupplier;
class SystemInfo;
@ -135,7 +135,7 @@ class Stackwalker {
// the caller.
virtual StackFrame* GetCallerFrame(
const CallStack *stack,
const vector< linked_ptr<StackFrameInfo> > &stack_frame_info) = 0;
const vector< linked_ptr<WindowsFrameInfo> > &stack_frame_info) = 0;
// The optional SymbolSupplier for resolving source line info.
SymbolSupplier *supplier_;

View file

@ -46,7 +46,7 @@
#include "google_breakpad/processor/stack_frame.h"
#include "processor/linked_ptr.h"
#include "processor/scoped_ptr.h"
#include "processor/stack_frame_info.h"
#include "processor/windows_frame_info.h"
using std::map;
using std::vector;
@ -117,8 +117,8 @@ class BasicSourceLineResolver::Module {
// with the result. Additional debugging information, if available, is
// returned. If no additional information is available, returns NULL.
// A NULL return value is not an error. The caller takes ownership of
// any returned StackFrameInfo object.
StackFrameInfo* LookupAddress(StackFrame *frame) const;
// any returned WindowsFrameInfo object.
WindowsFrameInfo* LookupAddress(StackFrame *frame) const;
private:
friend class BasicSourceLineResolver;
@ -175,7 +175,7 @@ class BasicSourceLineResolver::Module {
// StackInfoTypes. These are split by type because there may be overlaps
// between maps of different types, but some information is only available
// as certain types.
ContainedRangeMap< MemAddr, linked_ptr<StackFrameInfo> >
ContainedRangeMap< MemAddr, linked_ptr<WindowsFrameInfo> >
stack_info_[STACK_INFO_LAST];
};
@ -236,7 +236,7 @@ bool BasicSourceLineResolver::HasModule(const string &module_name) const {
return modules_->find(module_name) != modules_->end();
}
StackFrameInfo* BasicSourceLineResolver::FillSourceLineInfo(
WindowsFrameInfo* BasicSourceLineResolver::FillSourceLineInfo(
StackFrame *frame) const {
if (frame->module) {
ModuleMap::const_iterator it = modules_->find(frame->module->code_file());
@ -413,11 +413,11 @@ bool BasicSourceLineResolver::Module::LoadMap(const string &map_file) {
return LoadMapFromBuffer(map_buffer);
}
StackFrameInfo* BasicSourceLineResolver::Module::LookupAddress(
WindowsFrameInfo* BasicSourceLineResolver::Module::LookupAddress(
StackFrame *frame) const {
MemAddr address = frame->instruction - frame->module->base_address();
linked_ptr<StackFrameInfo> retrieved_info;
linked_ptr<WindowsFrameInfo> retrieved_info;
// Check for debugging info first, before any possible early returns.
//
// We only know about STACK_INFO_FRAME_DATA and STACK_INFO_FPO. Prefer
@ -429,9 +429,9 @@ StackFrameInfo* BasicSourceLineResolver::Module::LookupAddress(
stack_info_[STACK_INFO_FPO].RetrieveRange(address, &retrieved_info);
}
scoped_ptr<StackFrameInfo> frame_info;
scoped_ptr<WindowsFrameInfo> frame_info;
if (retrieved_info.get()) {
frame_info.reset(new StackFrameInfo());
frame_info.reset(new WindowsFrameInfo());
frame_info->CopyFrom(*retrieved_info.get());
}
@ -489,9 +489,9 @@ StackFrameInfo* BasicSourceLineResolver::Module::LookupAddress(
// about how much space their parameters consume on the stack. Prefer
// the STACK stuff (above), but if it's not present, take the
// information from the FUNC or PUBLIC line.
frame_info.reset(new StackFrameInfo());
frame_info.reset(new WindowsFrameInfo());
frame_info->parameter_size = parameter_size;
frame_info->valid |= StackFrameInfo::VALID_PARAMETER_SIZE;
frame_info->valid |= WindowsFrameInfo::VALID_PARAMETER_SIZE;
}
return frame_info.release();
@ -681,8 +681,8 @@ bool BasicSourceLineResolver::Module::ParseStackInfo(char *stack_info_line) {
// if ContainedRangeMap were modified to allow replacement of
// already-stored values.
linked_ptr<StackFrameInfo> stack_frame_info(
new StackFrameInfo(prolog_size,
linked_ptr<WindowsFrameInfo> stack_frame_info(
new WindowsFrameInfo(prolog_size,
epilog_size,
parameter_size,
saved_register_size,

View file

@ -35,7 +35,7 @@
#include "processor/linked_ptr.h"
#include "processor/logging.h"
#include "processor/scoped_ptr.h"
#include "processor/stack_frame_info.h"
#include "processor/windows_frame_info.h"
#define ASSERT_TRUE(cond) \
if (!(cond)) { \
@ -55,7 +55,7 @@ using google_breakpad::CodeModule;
using google_breakpad::linked_ptr;
using google_breakpad::scoped_ptr;
using google_breakpad::StackFrame;
using google_breakpad::StackFrameInfo;
using google_breakpad::WindowsFrameInfo;
class TestCodeModule : public CodeModule {
public:
@ -106,7 +106,7 @@ static bool RunTests() {
StackFrame frame;
frame.instruction = 0x1000;
frame.module = NULL;
scoped_ptr<StackFrameInfo> frame_info(resolver.FillSourceLineInfo(&frame));
scoped_ptr<WindowsFrameInfo> frame_info(resolver.FillSourceLineInfo(&frame));
ASSERT_FALSE(frame.module);
ASSERT_TRUE(frame.function_name.empty());
ASSERT_EQ(frame.function_base, 0);
@ -173,7 +173,7 @@ static bool RunTests() {
ASSERT_EQ(frame_info->prolog_size, 1);
frame.instruction = 0x216f;
StackFrameInfo *s;
WindowsFrameInfo *s;
s = resolver.FillSourceLineInfo(&frame);
ASSERT_EQ(frame.function_name, "Public2_1");
delete s;

View file

@ -47,7 +47,7 @@
#include "processor/linked_ptr.h"
#include "processor/logging.h"
#include "processor/scoped_ptr.h"
#include "processor/stack_frame_info.h"
#include "processor/windows_frame_info.h"
#include "processor/stackwalker_ppc.h"
#include "processor/stackwalker_sparc.h"
#include "processor/stackwalker_x86.h"
@ -78,7 +78,7 @@ bool Stackwalker::Walk(CallStack *stack) {
// stack_frame_info parallels the CallStack. The vector is passed to the
// GetCallerFrame function. It contains information that may be helpful
// for stackwalking.
vector< linked_ptr<StackFrameInfo> > stack_frame_info;
vector< linked_ptr<WindowsFrameInfo> > stack_frame_info;
// Begin with the context frame, and keep getting callers until there are
// no more.
@ -91,7 +91,7 @@ bool Stackwalker::Walk(CallStack *stack) {
// frame_pointer fields. The frame structure comes from either the
// context frame (above) or a caller frame (below).
linked_ptr<StackFrameInfo> frame_info;
linked_ptr<WindowsFrameInfo> frame_info;
// Resolve the module information, if a module map was provided.
if (modules_) {

View file

@ -74,7 +74,7 @@ StackFrame* StackwalkerAMD64::GetContextFrame() {
StackFrame* StackwalkerAMD64::GetCallerFrame(
const CallStack *stack,
const vector< linked_ptr<StackFrameInfo> > &stack_frame_info) {
const vector< linked_ptr<WindowsFrameInfo> > &stack_frame_info) {
if (!memory_ || !stack) {
BPLOG(ERROR) << "Can't get caller frame without memory or stack";
return NULL;

View file

@ -66,7 +66,7 @@ class StackwalkerAMD64 : public Stackwalker {
virtual StackFrame* GetContextFrame();
virtual StackFrame* GetCallerFrame(
const CallStack *stack,
const vector< linked_ptr<StackFrameInfo> > &stack_frame_info);
const vector< linked_ptr<WindowsFrameInfo> > &stack_frame_info);
// Stores the CPU context corresponding to the innermost stack frame to
// be returned by GetContextFrame.

View file

@ -74,7 +74,7 @@ StackFrame* StackwalkerARM::GetContextFrame() {
StackFrame* StackwalkerARM::GetCallerFrame(
const CallStack *stack,
const vector< linked_ptr<StackFrameInfo> > &stack_frame_info) {
const vector< linked_ptr<WindowsFrameInfo> > &stack_frame_info) {
if (!memory_ || !stack) {
BPLOG(ERROR) << "Can't get caller frame without memory or stack";
return NULL;

View file

@ -66,7 +66,7 @@ class StackwalkerARM : public Stackwalker {
virtual StackFrame* GetContextFrame();
virtual StackFrame* GetCallerFrame(
const CallStack *stack,
const vector< linked_ptr<StackFrameInfo> > &stack_frame_info);
const vector< linked_ptr<WindowsFrameInfo> > &stack_frame_info);
// Stores the CPU context corresponding to the innermost stack frame to
// be returned by GetContextFrame.

View file

@ -83,7 +83,7 @@ StackFrame* StackwalkerPPC::GetContextFrame() {
StackFrame* StackwalkerPPC::GetCallerFrame(
const CallStack *stack,
const vector< linked_ptr<StackFrameInfo> > &stack_frame_info) {
const vector< linked_ptr<WindowsFrameInfo> > &stack_frame_info) {
if (!memory_ || !stack) {
BPLOG(ERROR) << "Can't get caller frame without memory or stack";
return NULL;

View file

@ -67,7 +67,7 @@ class StackwalkerPPC : public Stackwalker {
virtual StackFrame* GetContextFrame();
virtual StackFrame* GetCallerFrame(
const CallStack *stack,
const vector< linked_ptr<StackFrameInfo> > &stack_frame_info);
const vector< linked_ptr<WindowsFrameInfo> > &stack_frame_info);
// Stores the CPU context corresponding to the innermost stack frame to
// be returned by GetContextFrame.

View file

@ -74,7 +74,7 @@ StackFrame* StackwalkerSPARC::GetContextFrame() {
StackFrame* StackwalkerSPARC::GetCallerFrame(
const CallStack *stack,
const vector< linked_ptr<StackFrameInfo> > &stack_frame_info) {
const vector< linked_ptr<WindowsFrameInfo> > &stack_frame_info) {
if (!memory_ || !stack) {
BPLOG(ERROR) << "Can't get caller frame without memory or stack";
return NULL;

View file

@ -72,7 +72,7 @@ class StackwalkerSPARC : public Stackwalker {
virtual StackFrame* GetContextFrame();
virtual StackFrame* GetCallerFrame(
const CallStack *stack,
const vector< linked_ptr<StackFrameInfo> > &stack_frame_info);
const vector< linked_ptr<WindowsFrameInfo> > &stack_frame_info);
// Stores the CPU context corresponding to the innermost stack frame to
// be returned by GetContextFrame.

View file

@ -43,7 +43,7 @@
#include "google_breakpad/processor/stack_frame_cpu.h"
#include "processor/linked_ptr.h"
#include "processor/logging.h"
#include "processor/stack_frame_info.h"
#include "processor/windows_frame_info.h"
namespace google_breakpad {
@ -88,7 +88,7 @@ StackFrame* StackwalkerX86::GetContextFrame() {
StackFrame* StackwalkerX86::GetCallerFrame(
const CallStack *stack,
const vector< linked_ptr<StackFrameInfo> > &stack_frame_info) {
const vector< linked_ptr<WindowsFrameInfo> > &stack_frame_info) {
if (!memory_ || !stack) {
BPLOG(ERROR) << "Can't get caller frame without memory or stack";
return NULL;
@ -96,7 +96,7 @@ StackFrame* StackwalkerX86::GetCallerFrame(
StackFrameX86::FrameTrust trust = StackFrameX86::FRAME_TRUST_NONE;
StackFrameX86 *last_frame = static_cast<StackFrameX86*>(
stack->frames()->back());
StackFrameInfo *last_frame_info = stack_frame_info.back().get();
WindowsFrameInfo *last_frame_info = stack_frame_info.back().get();
// This stackwalker sets each frame's %esp to its value immediately prior
// to the CALL into the callee. This means that %esp points to the last
@ -133,10 +133,10 @@ StackFrame* StackwalkerX86::GetCallerFrame(
int frames_already_walked = stack_frame_info.size();
u_int32_t last_frame_callee_parameter_size = 0;
if (frames_already_walked >= 2) {
StackFrameInfo *last_frame_callee_info =
WindowsFrameInfo *last_frame_callee_info =
stack_frame_info[frames_already_walked - 2].get();
if (last_frame_callee_info &&
last_frame_callee_info->valid & StackFrameInfo::VALID_PARAMETER_SIZE) {
last_frame_callee_info->valid & WindowsFrameInfo::VALID_PARAMETER_SIZE) {
last_frame_callee_parameter_size =
last_frame_callee_info->parameter_size;
}
@ -153,7 +153,7 @@ StackFrame* StackwalkerX86::GetCallerFrame(
dictionary["$esp"] = last_frame->context.esp;
dictionary[".cbCalleeParams"] = last_frame_callee_parameter_size;
if (last_frame_info && last_frame_info->valid == StackFrameInfo::VALID_ALL) {
if (last_frame_info && last_frame_info->valid == WindowsFrameInfo::VALID_ALL) {
// FPO debugging data is available. Initialize constants.
dictionary[".cbSavedRegs"] = last_frame_info->saved_register_size;
dictionary[".cbLocals"] = last_frame_info->local_size;
@ -163,7 +163,7 @@ StackFrame* StackwalkerX86::GetCallerFrame(
last_frame_info->saved_register_size;
}
if (last_frame_info &&
last_frame_info->valid & StackFrameInfo::VALID_PARAMETER_SIZE) {
last_frame_info->valid & WindowsFrameInfo::VALID_PARAMETER_SIZE) {
// This is treated separately because it can either come from FPO data or
// from other debugging data.
dictionary[".cbParams"] = last_frame_info->parameter_size;
@ -181,7 +181,7 @@ StackFrame* StackwalkerX86::GetCallerFrame(
string program_string;
bool traditional_frame = true;
bool recover_ebp = true;
if (last_frame_info && last_frame_info->valid == StackFrameInfo::VALID_ALL) {
if (last_frame_info && last_frame_info->valid == WindowsFrameInfo::VALID_ALL) {
// FPO data available.
traditional_frame = false;
trust = StackFrameX86::FRAME_TRUST_CFI;

View file

@ -68,7 +68,7 @@ class StackwalkerX86 : public Stackwalker {
virtual StackFrame* GetContextFrame();
virtual StackFrame* GetCallerFrame(
const CallStack *stack,
const vector< linked_ptr<StackFrameInfo> > &stack_frame_info);
const vector< linked_ptr<WindowsFrameInfo> > &stack_frame_info);
// Scan the stack starting at location_start, looking for an address
// that looks like a valid instruction pointer. Addresses must

View file

@ -27,7 +27,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// stack_frame_info.h: Holds debugging information about a stack frame.
// windows_frame_info.h: Holds debugging information about a stack frame.
//
// This structure is specific to Windows debugging information obtained
// from pdb files using the DIA API.
@ -35,8 +35,8 @@
// Author: Mark Mentovai
#ifndef PROCESSOR_STACK_FRAME_INFO_H__
#define PROCESSOR_STACK_FRAME_INFO_H__
#ifndef PROCESSOR_WINDOWS_FRAME_INFO_H__
#define PROCESSOR_WINDOWS_FRAME_INFO_H__
#include <string>
@ -44,7 +44,7 @@
namespace google_breakpad {
struct StackFrameInfo {
struct WindowsFrameInfo {
public:
enum Validity {
VALID_NONE = 0,
@ -52,7 +52,7 @@ struct StackFrameInfo {
VALID_ALL = -1
};
StackFrameInfo() : valid(VALID_NONE),
WindowsFrameInfo() : valid(VALID_NONE),
prolog_size(0),
epilog_size(0),
parameter_size(0),
@ -62,7 +62,7 @@ struct StackFrameInfo {
allocates_base_pointer(0),
program_string() {}
StackFrameInfo(u_int32_t set_prolog_size,
WindowsFrameInfo(u_int32_t set_prolog_size,
u_int32_t set_epilog_size,
u_int32_t set_parameter_size,
u_int32_t set_saved_register_size,
@ -80,8 +80,8 @@ struct StackFrameInfo {
allocates_base_pointer(set_allocates_base_pointer),
program_string(set_program_string) {}
// CopyFrom makes "this" StackFrameInfo object identical to "that".
void CopyFrom(const StackFrameInfo &that) {
// CopyFrom makes "this" WindowsFrameInfo object identical to "that".
void CopyFrom(const WindowsFrameInfo &that) {
valid = that.valid;
prolog_size = that.prolog_size;
epilog_size = that.epilog_size;
@ -93,7 +93,7 @@ struct StackFrameInfo {
program_string = that.program_string;
}
// Clears the StackFrameInfo object so that users will see it as though
// Clears the WindowsFrameInfo object so that users will see it as though
// it contains no information.
void Clear() {
valid = VALID_NONE;
@ -123,4 +123,4 @@ struct StackFrameInfo {
} // namespace google_breakpad
#endif // PROCESSOR_STACK_FRAME_INFO_H__
#endif // PROCESSOR_WINDOWS_FRAME_INFO_H__