diff options
author | mmentovai <mmentovai@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2006-10-23 19:24:58 +0000 |
---|---|---|
committer | mmentovai <mmentovai@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2006-10-23 19:24:58 +0000 |
commit | d119a921ea611dc38cfcb7411759ddf2c688603f (patch) | |
tree | 392d79dada82458d74b010a4974ca09cb204211c /src/processor/source_line_resolver_unittest.cc | |
parent | Update comments to reflect HTTPS support, r=mark. (diff) | |
download | breakpad-d119a921ea611dc38cfcb7411759ddf2c688603f.tar.xz |
Make stack_frame_info vector hold linked_ptrs instead of objects;
make Stackwalker::Walk create and return a CallStack instead of filling a
caller-supplied one (#54). r=bryner
Interface change: Stackwalker::Walk and MinidumpProcessor::Process now return
a new CallStack*.
http://groups.google.com/group/airbag-dev/browse_thread/thread/d2bad5d7c115c3fe
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@45 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/processor/source_line_resolver_unittest.cc')
-rw-r--r-- | src/processor/source_line_resolver_unittest.cc | 50 |
1 files changed, 27 insertions, 23 deletions
diff --git a/src/processor/source_line_resolver_unittest.cc b/src/processor/source_line_resolver_unittest.cc index 6cc9afd3..e9ee9d91 100644 --- a/src/processor/source_line_resolver_unittest.cc +++ b/src/processor/source_line_resolver_unittest.cc @@ -28,12 +28,16 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <stdio.h> +#include <memory> #include <string> #include "processor/source_line_resolver.h" #include "google/stack_frame.h" +#include "processor/linked_ptr.h" #include "processor/stack_frame_info.h" +using std::auto_ptr; using std::string; +using google_airbag::linked_ptr; using google_airbag::SourceLineResolver; using google_airbag::StackFrame; using google_airbag::StackFrameInfo; @@ -55,12 +59,10 @@ static bool VerifyEmpty(const StackFrame &frame) { return true; } -static void ClearSourceLineInfo(StackFrame *frame, - StackFrameInfo *frame_info) { +static void ClearSourceLineInfo(StackFrame *frame) { frame->function_name.clear(); frame->source_file_name.clear(); frame->source_line = 0; - frame_info->program_string.clear(); } static bool RunTests() { @@ -74,62 +76,64 @@ static bool RunTests() { ASSERT_TRUE(resolver.HasModule("module2")); StackFrame frame; - StackFrameInfo frame_info; frame.instruction = 0x1000; frame.module_name = "module1"; - resolver.FillSourceLineInfo(&frame, &frame_info); + auto_ptr<StackFrameInfo> frame_info(resolver.FillSourceLineInfo(&frame)); ASSERT_EQ(frame.function_name, "Function1_1"); ASSERT_EQ(frame.source_file_name, "file1_1.cc"); ASSERT_EQ(frame.source_line, 44); - ASSERT_FALSE(frame_info.allocates_base_pointer); - ASSERT_EQ(frame_info.program_string, + ASSERT_TRUE(frame_info.get()); + ASSERT_FALSE(frame_info->allocates_base_pointer); + ASSERT_EQ(frame_info->program_string, "$eip 4 + ^ = $esp $ebp 8 + = $ebp $ebp ^ ="); - ClearSourceLineInfo(&frame, &frame_info); + ClearSourceLineInfo(&frame); frame.instruction = 0x800; - resolver.FillSourceLineInfo(&frame, &frame_info); + frame_info.reset(resolver.FillSourceLineInfo(&frame)); ASSERT_TRUE(VerifyEmpty(frame)); - ASSERT_FALSE(frame_info.allocates_base_pointer); - ASSERT_TRUE(frame_info.program_string.empty()); + ASSERT_FALSE(frame_info.get()); frame.instruction = 0x1280; - resolver.FillSourceLineInfo(&frame, &frame_info); + frame_info.reset(resolver.FillSourceLineInfo(&frame)); ASSERT_EQ(frame.function_name, "Function1_3"); ASSERT_TRUE(frame.source_file_name.empty()); ASSERT_EQ(frame.source_line, 0); - ASSERT_FALSE(frame_info.allocates_base_pointer); - ASSERT_TRUE(frame_info.program_string.empty()); + ASSERT_TRUE(frame_info.get()); + ASSERT_FALSE(frame_info->allocates_base_pointer); + ASSERT_TRUE(frame_info->program_string.empty()); frame.instruction = 0x1380; - resolver.FillSourceLineInfo(&frame, &frame_info); + frame_info.reset(resolver.FillSourceLineInfo(&frame)); ASSERT_EQ(frame.function_name, "Function1_4"); ASSERT_TRUE(frame.source_file_name.empty()); ASSERT_EQ(frame.source_line, 0); - ASSERT_FALSE(frame_info.allocates_base_pointer); - ASSERT_FALSE(frame_info.program_string.empty()); + ASSERT_TRUE(frame_info.get()); + ASSERT_FALSE(frame_info->allocates_base_pointer); + ASSERT_FALSE(frame_info->program_string.empty()); frame.instruction = 0x2180; frame.module_name = "module2"; - resolver.FillSourceLineInfo(&frame, &frame_info); + frame_info.reset(resolver.FillSourceLineInfo(&frame)); 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_TRUE(frame_info.get()); + ASSERT_EQ(frame_info->prolog_size, 1); frame.instruction = 0x216f; frame.module_name = "module2"; - resolver.FillSourceLineInfo(&frame, &frame_info); + resolver.FillSourceLineInfo(&frame); ASSERT_EQ(frame.function_name, "Public2_1"); - ClearSourceLineInfo(&frame, &frame_info); + ClearSourceLineInfo(&frame); frame.instruction = 0x219f; frame.module_name = "module2"; - resolver.FillSourceLineInfo(&frame, &frame_info); + resolver.FillSourceLineInfo(&frame); ASSERT_TRUE(frame.function_name.empty()); frame.instruction = 0x21a0; frame.module_name = "module2"; - resolver.FillSourceLineInfo(&frame, &frame_info); + resolver.FillSourceLineInfo(&frame); ASSERT_EQ(frame.function_name, "Public2_2"); ASSERT_FALSE(resolver.LoadModule("module3", |