class InlineThreadControllerTest
Defined at line 94 of file ../../src/developer/debug/zxdb/client/inline_thread_controller_test.h
Helper class used for testing thread controllers that need inline stacks.
Note on code locations: The source location for inline calls and physical calls is different. The
current instruction for a non-topmost physical frame is always the return address of the function
call (typically the next line) because the debuggers knows the return address but don't
necessarily know the exact call location. For inline calls, however, we show the inline call
location because we do have that information, but don't know exactly where the inline call will
"return" to since there's no clear return address.
The code looks like this, with line numbers and the code locations (see note above):
10 inline void TopInline() {
11 ...
<
- kTopInlineFileLine
12 }
13 void Top() {
14 ...
15 TopInlineFunction();
<
- kTopFileLine
16 ...
17 }
18
19 inline void MiddleInline2() {
20 ...
21 Top(); // Non-inline call.
22 ...
<
- kMiddleInline2FileLine
23 }
24 inline void MiddleInline1() {
25 MiddleInline2();
<
- kMiddleInline1FileLine
26 ...
27 }
28 void Middle() {
29 ...
30 MiddleInline1();
<
- kMiddleFileLine
31 ...
32 }
33
34 void Bottom() {
35 ...
36 Middle();
37 ...
38 }
The stack looks like this:
[0] = inline from frame 1: TopInline()
[1] = physical frame at kTopSP: Top()
[2] = inline #2 from frame 4: MiddleInline2()
[3] = inline #1 from frame 4: MiddleInline1()
[4] = physical frame at kMiddleSP: Middle()
[5] = physical frame at kBottomSP
Binary code layout
+--------------------------+
| TopFunction |
| |
| +--------------------+ |
| | TopInlineFunction | |
| +--------------------+ |
+--------------------------+
+----------------------------------------------------------+
| MiddleFunction |
| |
| +------------------------+------------------------+--+ |
| | MiddleFunctionInline1 | MiddleFunctionInline2 | | |
| | +------------------------+ | |
| | | |
| +----------------------------------------------------+ |
| |
+----------------------------------------------------------+
Note that MiddleInline1() and MiddleInline2() start at the same location
(as if calling #2 was the first thing #1 did).
Public Members
static const uint64_t kTopSP
static const uint64_t kMiddleSP
static const uint64_t kBottomSP
static AddressRange kTopFunctionRange
static AddressRange kTopInlineFunctionRange
static AddressRange kMiddleFunctionRange
static AddressRange kMiddleInline1FunctionRange
static AddressRange kMiddleInline2FunctionRange
static FileLine kTopInlineFileLine
static FileLine kTopFileLine
static FileLine kMiddleInline2FileLine
static FileLine kMiddleInline1FileLine
static FileLine kMiddleFileLine
Public Methods
fxl::RefPtr<Function> GetTopFunction ()
Creates functions associated with each of the frames.
Defined at line 57 of file ../../src/developer/debug/zxdb/client/inline_thread_controller_test.cc
fxl::RefPtr<Function> GetTopInlineFunction ()
static
Defined at line 62 of file ../../src/developer/debug/zxdb/client/inline_thread_controller_test.cc
fxl::RefPtr<Function> GetMiddleFunction ()
static
Defined at line 69 of file ../../src/developer/debug/zxdb/client/inline_thread_controller_test.cc
fxl::RefPtr<Function> GetMiddleInline1Function ()
static
Defined at line 74 of file ../../src/developer/debug/zxdb/client/inline_thread_controller_test.cc
fxl::RefPtr<Function> GetMiddleInline2Function ()
static
Defined at line 81 of file ../../src/developer/debug/zxdb/client/inline_thread_controller_test.cc
Location GetTopLocation (uint64_t address)
Creates locations. The address is passed in and must be inside of the
range for the corresponding function.
Defined at line 88 of file ../../src/developer/debug/zxdb/client/inline_thread_controller_test.cc
Location GetTopInlineLocation (uint64_t address)
static
Defined at line 94 of file ../../src/developer/debug/zxdb/client/inline_thread_controller_test.cc
Location GetMiddleLocation (uint64_t address)
static
Defined at line 100 of file ../../src/developer/debug/zxdb/client/inline_thread_controller_test.cc
Location GetMiddleInline1Location (uint64_t address)
static
Defined at line 106 of file ../../src/developer/debug/zxdb/client/inline_thread_controller_test.cc
Location GetMiddleInline2Location (uint64_t address)
static
Defined at line 112 of file ../../src/developer/debug/zxdb/client/inline_thread_controller_test.cc
std::unique_ptr<MockFrame> GetTopFrame (uint64_t address)
Constructor for frames.
Defined at line 118 of file ../../src/developer/debug/zxdb/client/inline_thread_controller_test.cc
std::unique_ptr<MockFrame> GetTopInlineFrame (uint64_t address, MockFrame * top)
static
Defined at line 123 of file ../../src/developer/debug/zxdb/client/inline_thread_controller_test.cc
std::unique_ptr<MockFrame> GetMiddleFrame (uint64_t address)
static
Defined at line 132 of file ../../src/developer/debug/zxdb/client/inline_thread_controller_test.cc
std::unique_ptr<MockFrame> GetMiddleInline1Frame (uint64_t address, MockFrame * middle)
static
Defined at line 138 of file ../../src/developer/debug/zxdb/client/inline_thread_controller_test.cc
std::unique_ptr<MockFrame> GetMiddleInline2Frame (uint64_t address, MockFrame * middle)
static
Defined at line 146 of file ../../src/developer/debug/zxdb/client/inline_thread_controller_test.cc
std::unique_ptr<MockFrame> GetBottomFrame (uint64_t address)
static
Defined at line 154 of file ../../src/developer/debug/zxdb/client/inline_thread_controller_test.cc
std::vector<std::unique_ptr<MockFrame>> GetStack ()
Constructs a fake stack. Even frame will have the address at the beginning of its range.
This function returns a vector of MockFrames so the caller can modify the locations. It can
then call MockFrameVectorToFrameVector() below to convert to the frame vector other code
expects.
Defined at line 160 of file ../../src/developer/debug/zxdb/client/inline_thread_controller_test.cc
std::vector<std::unique_ptr<Frame>> MockFrameVectorToFrameVector (std::vector<std::unique_ptr<MockFrame>> mock_frames)
Downcasts a vector of owning MockFrame pointers to the corresponding Frame pointers.
Defined at line 182 of file ../../src/developer/debug/zxdb/client/inline_thread_controller_test.cc