1e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org// Copyright (c) 2013, Google Inc.
2e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org// All rights reserved.
3e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org//
4e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org// Redistribution and use in source and binary forms, with or without
5e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org// modification, are permitted provided that the following conditions are
6e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org// met:
7e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org//
8e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org//     * Redistributions of source code must retain the above copyright
9e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org// notice, this list of conditions and the following disclaimer.
10e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org//     * Redistributions in binary form must reproduce the above
11e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org// copyright notice, this list of conditions and the following disclaimer
12e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org// in the documentation and/or other materials provided with the
13e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org// distribution.
14e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org//     * Neither the name of Google Inc. nor the names of its
15e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org// contributors may be used to endorse or promote products derived from
16e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org// this software without specific prior written permission.
17e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org//
18e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org
30e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org// stackwalker_address_list_unittest.cc: Unit tests for the
31e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org// StackwalkerAddressList class.
32e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org//
33e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org// Author: Chris Hamilton <chrisha@chromium.org>
34e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org
35e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org#include <string>
36e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org#include <vector>
37e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org
38e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org#include "breakpad_googletest_includes.h"
39e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org#include "common/using_std_string.h"
40e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org#include "google_breakpad/common/minidump_format.h"
41e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org#include "google_breakpad/processor/basic_source_line_resolver.h"
42e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org#include "google_breakpad/processor/call_stack.h"
43e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org#include "google_breakpad/processor/code_module.h"
44e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org#include "google_breakpad/processor/source_line_resolver_interface.h"
45e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org#include "google_breakpad/processor/stack_frame.h"
46e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org#include "processor/stackwalker_unittest_utils.h"
47e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org#include "processor/stackwalker_address_list.h"
48e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org
49e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.orgusing google_breakpad::BasicSourceLineResolver;
50e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.orgusing google_breakpad::CallStack;
51e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.orgusing google_breakpad::CodeModule;
52e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.orgusing google_breakpad::StackFrameSymbolizer;
53e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.orgusing google_breakpad::StackFrame;
54e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.orgusing google_breakpad::Stackwalker;
55e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.orgusing google_breakpad::StackwalkerAddressList;
56e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.orgusing std::vector;
57e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.orgusing testing::_;
58e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.orgusing testing::AnyNumber;
59e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.orgusing testing::Return;
60e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.orgusing testing::SetArgumentPointee;
61e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org
62e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org#define arraysize(f) (sizeof(f) / sizeof(*f))
63e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org
64e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org// Addresses and sizes of a couple dummy modules.
65e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.orguint64_t kModule1Base = 0x40000000;
66e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.orguint64_t kModule1Size = 0x10000;
67e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.orguint64_t kModule2Base = 0x50000000;
68e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.orguint64_t kModule2Size = 0x10000;
69e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org
70e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org// A handful of addresses that lie within the modules above.
71e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.orgconst uint64_t kDummyFrames[] = {
72e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org    0x50003000, 0x50002000, 0x50001000, 0x40002000, 0x40001000 };
73e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org
74e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.orgclass StackwalkerAddressListTest : public testing::Test {
75e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org public:
76e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  StackwalkerAddressListTest()
77e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org    : // Give the two modules reasonable standard locations and names
78e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org      // for tests to play with.
79e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org      module1(kModule1Base, kModule1Size, "module1", "version1"),
80e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org      module2(kModule2Base, kModule2Size, "module2", "version2") {
81e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org    // Create some modules with some stock debugging information.
82e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org    modules.Add(&module1);
83e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org    modules.Add(&module2);
84e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org
85e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org    // By default, none of the modules have symbol info; call
86e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org    // SetModuleSymbols to override this.
87e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org    EXPECT_CALL(supplier, GetCStringSymbolData(_, _, _, _, _))
88e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org      .WillRepeatedly(Return(MockSymbolSupplier::NOT_FOUND));
89e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org
90e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org    // Avoid GMOCK WARNING "Uninteresting mock function call - returning
91e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org    // directly" for FreeSymbolData().
92e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org    EXPECT_CALL(supplier, FreeSymbolData(_)).Times(AnyNumber());
93e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  }
94e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org
95e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  // Set the Breakpad symbol information that supplier should return for
96e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  // MODULE to INFO.
97e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  void SetModuleSymbols(MockCodeModule *module, const string &info) {
98e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org    size_t buffer_size;
99e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org    char *buffer = supplier.CopySymbolDataAndOwnTheCopy(info, &buffer_size);
100e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org    EXPECT_CALL(supplier, GetCStringSymbolData(module, NULL, _, _, _))
101e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org      .WillRepeatedly(DoAll(SetArgumentPointee<3>(buffer),
102e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org                            SetArgumentPointee<4>(buffer_size),
103e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org                            Return(MockSymbolSupplier::FOUND)));
104e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  }
105e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org
106e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  void CheckCallStack(const CallStack& call_stack) {
107e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org    const std::vector<StackFrame*>* frames = call_stack.frames();
108e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org    ASSERT_EQ(arraysize(kDummyFrames), frames->size());
1095a82db4773c983cfa2adc0d7f9682ce5717d523echrisha@chromium.org    for (size_t i = 0; i < arraysize(kDummyFrames); ++i) {
110e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org      ASSERT_EQ(kDummyFrames[i], frames->at(i)->instruction);
1118d58ea41134906c4e3f3f6ed813720f9d8e5e065chrisha@chromium.org      ASSERT_EQ(StackFrame::FRAME_TRUST_PREWALKED, frames->at(i)->trust);
1125a82db4773c983cfa2adc0d7f9682ce5717d523echrisha@chromium.org    }
113e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org    ASSERT_EQ(static_cast<const CodeModule*>(&module2), frames->at(0)->module);
114e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org    ASSERT_EQ(static_cast<const CodeModule*>(&module2), frames->at(1)->module);
115e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org    ASSERT_EQ(static_cast<const CodeModule*>(&module2), frames->at(2)->module);
116e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org    ASSERT_EQ(static_cast<const CodeModule*>(&module1), frames->at(3)->module);
117e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org    ASSERT_EQ(static_cast<const CodeModule*>(&module1), frames->at(4)->module);
118e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  }
119e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org
120e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  MockCodeModule module1;
121e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  MockCodeModule module2;
122e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  MockCodeModules modules;
123e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  MockSymbolSupplier supplier;
124e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  BasicSourceLineResolver resolver;
125e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org};
126e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org
127e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.orgTEST_F(StackwalkerAddressListTest, ScanWithoutSymbols) {
128e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  StackFrameSymbolizer frame_symbolizer(&supplier, &resolver);
129e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  StackwalkerAddressList walker(kDummyFrames, arraysize(kDummyFrames),
130e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org                         &modules, &frame_symbolizer);
131e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org
132e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  CallStack call_stack;
133e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  vector<const CodeModule*> modules_without_symbols;
134e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  vector<const CodeModule*> modules_with_corrupt_symbols;
135e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  ASSERT_TRUE(walker.Walk(&call_stack, &modules_without_symbols,
136e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org                          &modules_with_corrupt_symbols));
137e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org
138e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  // The stack starts in module2, so we expect that to be the first module
139e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  // found without symbols.
140e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  ASSERT_EQ(2U, modules_without_symbols.size());
141e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  ASSERT_EQ("module2", modules_without_symbols[0]->debug_file());
142e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  ASSERT_EQ("module1", modules_without_symbols[1]->debug_file());
143e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  ASSERT_EQ(0u, modules_with_corrupt_symbols.size());
144e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org
145e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  ASSERT_NO_FATAL_FAILURE(CheckCallStack(call_stack));
146e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org}
147e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org
148e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.orgTEST_F(StackwalkerAddressListTest, ScanWithSymbols) {
149e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  // File    : FILE number(dex) name
150e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  // Function: FUNC address(hex) size(hex) parameter_size(hex) name
151e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  // Line    : address(hex) size(hex) line(dec) filenum(dec)
152e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  SetModuleSymbols(&module2,
153e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org                   "FILE 1 module2.cc\n"
154e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org                   "FUNC 3000 100 10 mod2func3\n"
155e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org                   "3000 10 1  1\n"
156e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org                   "FUNC 2000 200 10 mod2func2\n"
157e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org                   "FUNC 1000 300 10 mod2func1\n");
158e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  SetModuleSymbols(&module1,
159e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org                   "FUNC 2000 200 10 mod1func2\n"
160e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org                   "FUNC 1000 300 10 mod1func1\n");
161e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org
162e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  StackFrameSymbolizer frame_symbolizer(&supplier, &resolver);
163e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  StackwalkerAddressList walker(kDummyFrames, arraysize(kDummyFrames),
164e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org                         &modules, &frame_symbolizer);
165e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org
166e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  CallStack call_stack;
167e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  vector<const CodeModule*> modules_without_symbols;
168e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  vector<const CodeModule*> modules_with_corrupt_symbols;
169e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  ASSERT_TRUE(walker.Walk(&call_stack, &modules_without_symbols,
170e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org                          &modules_with_corrupt_symbols));
171e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org
172e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  ASSERT_EQ(0u, modules_without_symbols.size());
173e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  ASSERT_EQ(0u, modules_with_corrupt_symbols.size());
174e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org
175e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  ASSERT_NO_FATAL_FAILURE(CheckCallStack(call_stack));
176e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org
177e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  const std::vector<StackFrame*>* frames = call_stack.frames();
178e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org
179e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  // We have full file/line information for the first function call.
180e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  ASSERT_EQ("mod2func3", frames->at(0)->function_name);
181e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  ASSERT_EQ(0x50003000u, frames->at(0)->function_base);
182e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  ASSERT_EQ("module2.cc", frames->at(0)->source_file_name);
183e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  ASSERT_EQ(1, frames->at(0)->source_line);
184e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  ASSERT_EQ(0x50003000u, frames->at(0)->source_line_base);
185e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org
186e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  ASSERT_EQ("mod2func2", frames->at(1)->function_name);
187e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  ASSERT_EQ(0x50002000u, frames->at(1)->function_base);
188e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org
189e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  ASSERT_EQ("mod2func1", frames->at(2)->function_name);
190e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  ASSERT_EQ(0x50001000u, frames->at(2)->function_base);
191e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org
192e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  ASSERT_EQ("mod1func2", frames->at(3)->function_name);
193e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  ASSERT_EQ(0x40002000u, frames->at(3)->function_base);
194e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org
195e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  ASSERT_EQ("mod1func1", frames->at(4)->function_name);
196e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org  ASSERT_EQ(0x40001000u, frames->at(4)->function_base);
197e6758b14481b3ee1eddc4d51725375c7fc7cf6bfchrisha@chromium.org}
198