Skip to content

[lldb] Reland 370734: Test 'frame select -r' and fix that INT32_MIN b… #220

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,42 @@ def test_relative(self):

self.expect("frame select -r 100")
self.expect("frame select -r 1", error=True, substrs=["Already at the top of the stack."])

@no_debug_info_test
@skipIfWindows
def test_mixing_relative_and_abs(self):
self.build()

lldbutil.run_to_source_breakpoint(self,
"// Set break point at this line.", lldb.SBFileSpec("main.cpp"))

# The function associated with each frame index can change depending
# on the function calling main (e.g. `start`), so this only tests that
# the frame index number is correct. We test the actual functions
# in the relative test.

# Jump to the top of the stack.
self.expect("frame select 0", substrs=["frame #0"])

# Run some relative commands.
self.expect("up", substrs=["frame #1"])
self.expect("frame select -r 1", substrs=["frame #2"])
self.expect("frame select -r -1", substrs=["frame #1"])

# Test that absolute indices still work.
self.expect("frame select 2", substrs=["frame #2"])
self.expect("frame select 1", substrs=["frame #1"])
self.expect("frame select 3", substrs=["frame #3"])
self.expect("frame select 0", substrs=["frame #0"])
self.expect("frame select 1", substrs=["frame #1"])

# Run some other relative frame select commands.
self.expect("down", substrs=["frame #0"])
self.expect("frame select -r 1", substrs=["frame #1"])
self.expect("frame select -r -1", substrs=["frame #0"])

# Test that absolute indices still work.
self.expect("frame select 2", substrs=["frame #2"])
self.expect("frame select 1", substrs=["frame #1"])
self.expect("frame select 3", substrs=["frame #3"])
self.expect("frame select 0", substrs=["frame #0"])
6 changes: 4 additions & 2 deletions lldb/source/Commands/CommandObjectFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,10 @@ class CommandObjectFrameSelect : public CommandObjectParsed {
return error;
}

void OptionParsingStarting(ExecutionContext *execution_context) override {}

void OptionParsingStarting(ExecutionContext *execution_context) override {
relative_frame_offset.reset();
}

llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
return llvm::makeArrayRef(g_frame_select_options);
}
Expand Down