Handle frame pointer omission (#21), part 3: SourceLineResolver and PDBSourceLineWriter changes. r=bryner.

- PDBSourceLineWriter (dump_syms) outputs stack frame debugging information
 - SourceLineResolver reads the new information and puts it into a
   new StackFrameInfo structure, which is stored in a ContainedRangeMap.
   FillSourceLineInfo passes the StackFrameInfo back to the caller.
 - The base Stackwalker makes StackFrameInfo data available to subclasses
   during stackwalking, but does not use this information directly itself.
   Stackwalkers may access stack_frame_info_ for enhanced stackwalking
   (this will be part 4).
 - New test data for the updated dumped-symbol format

735f191c9a


git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@38 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
mmentovai 2006-09-28 21:09:37 +00:00
parent f140025664
commit fc1c78e60e
14 changed files with 1312 additions and 51 deletions

View file

@ -31,10 +31,12 @@
#include <string>
#include "processor/source_line_resolver.h"
#include "google/stack_frame.h"
#include "processor/stack_frame_info.h"
using std::string;
using google_airbag::SourceLineResolver;
using google_airbag::StackFrame;
using google_airbag::StackFrameInfo;
#define ASSERT_TRUE(cond) \
if (!(cond)) { \
@ -53,10 +55,12 @@ static bool VerifyEmpty(const StackFrame &frame) {
return true;
}
static void ClearSourceLineInfo(StackFrame *frame) {
static void ClearSourceLineInfo(StackFrame *frame,
StackFrameInfo *frame_info) {
frame->function_name.clear();
frame->source_file_name.clear();
frame->source_line = 0;
frame_info->program_string.clear();
}
static bool RunTests() {
@ -68,36 +72,43 @@ static bool RunTests() {
ASSERT_TRUE(resolver.LoadModule("module2", testdata_dir + "/module2.out"));
StackFrame frame;
StackFrameInfo frame_info;
frame.instruction = 0x1000;
frame.module_name = "module1";
resolver.FillSourceLineInfo(&frame);
resolver.FillSourceLineInfo(&frame, &frame_info);
ASSERT_EQ(frame.function_name, "Function1_1");
ASSERT_EQ(frame.source_file_name, "file1_1.cc");
ASSERT_EQ(frame.source_line, 44);
ASSERT_EQ(frame_info.program_string,
"$eip 4 + ^ = $esp $ebp 8 + = $ebp $ebp ^ =");
ClearSourceLineInfo(&frame);
ClearSourceLineInfo(&frame, &frame_info);
frame.instruction = 0x800;
resolver.FillSourceLineInfo(&frame);
resolver.FillSourceLineInfo(&frame, &frame_info);
ASSERT_TRUE(VerifyEmpty(frame));
ASSERT_TRUE(frame_info.program_string.empty());
frame.instruction = 0x1280;
resolver.FillSourceLineInfo(&frame);
resolver.FillSourceLineInfo(&frame, &frame_info);
ASSERT_EQ(frame.function_name, "Function1_3");
ASSERT_TRUE(frame.source_file_name.empty());
ASSERT_EQ(frame.source_line, 0);
ASSERT_TRUE(frame_info.program_string.empty());
frame.instruction = 0x1380;
resolver.FillSourceLineInfo(&frame);
resolver.FillSourceLineInfo(&frame, &frame_info);
ASSERT_EQ(frame.function_name, "Function1_4");
ASSERT_TRUE(frame.source_file_name.empty());
ASSERT_EQ(frame.source_line, 0);
ASSERT_FALSE(frame_info.program_string.empty());
frame.instruction = 0x2180;
frame.module_name = "module2";
resolver.FillSourceLineInfo(&frame);
resolver.FillSourceLineInfo(&frame, &frame_info);
ASSERT_EQ(frame.function_name, "Function2_2");
ASSERT_EQ(frame.source_file_name, "file2_2.cc");
ASSERT_EQ(frame.source_line, 21);
ASSERT_EQ(frame_info.prolog_size, 1);
ASSERT_FALSE(resolver.LoadModule("module3",
testdata_dir + "/module3_bad.out"));