From fc1c78e60e9b305386f4c3fc811463f3b24cf6d4 Mon Sep 17 00:00:00 2001 From: mmentovai Date: Thu, 28 Sep 2006 21:09:37 +0000 Subject: 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 http://groups.google.com/group/airbag-dev/browse_thread/thread/735f191c9a1a1de4 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@38 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/processor/source_line_resolver_unittest.cc | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'src/processor/source_line_resolver_unittest.cc') diff --git a/src/processor/source_line_resolver_unittest.cc b/src/processor/source_line_resolver_unittest.cc index d9e27e27..053bc21e 100644 --- a/src/processor/source_line_resolver_unittest.cc +++ b/src/processor/source_line_resolver_unittest.cc @@ -31,10 +31,12 @@ #include #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")); -- cgit v1.2.1