aboutsummaryrefslogtreecommitdiff
path: root/src/processor/source_line_resolver_unittest.cc
diff options
context:
space:
mode:
authormmentovai <mmentovai@4c0a9323-5329-0410-9bdc-e9ce6186880e>2006-09-28 21:09:37 +0000
committermmentovai <mmentovai@4c0a9323-5329-0410-9bdc-e9ce6186880e>2006-09-28 21:09:37 +0000
commitfc1c78e60e9b305386f4c3fc811463f3b24cf6d4 (patch)
tree1e6eb65851d509851267d003f0bf5bd478ed9dbe /src/processor/source_line_resolver_unittest.cc
parentAdd static-CRT build configurations. Get rid of the largely redundant README, (diff)
downloadbreakpad-fc1c78e60e9b305386f4c3fc811463f3b24cf6d4.tar.xz
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
Diffstat (limited to 'src/processor/source_line_resolver_unittest.cc')
-rw-r--r--src/processor/source_line_resolver_unittest.cc25
1 files changed, 18 insertions, 7 deletions
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 <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"));