src/developer/debug/zxdb/client/step_thread_controller_unittest.cc
// Tests doing a "step" when the current instruction is about to execute the first instruction of
// an inline, with the current function being the caller. This location is ambiguous so the step
// operation should go into the inline without actually executing any code.
Tests doing a "step" when the current instruction is about to execute the first instruction of
an inline, with the current function being the caller. This location is ambiguous so the step
operation should go into the inline without actually executing any code.
Tests doing a " step " when the current instruction is about to execute the first instruction of an inline with the current function being the caller . This location is ambiguous so the step operation should go into the inline without actually executing any code .
TEST_F(StepThreadControllerTest, AmbiguousInline) {
  auto mock_frames = GetStack();
  FileLine file_line = mock_frames[1]->GetLocation().file_line();
  InjectExceptionWithStack(process()->GetKoid(), thread()->GetKoid(),
                           debug_ipc::ExceptionType::kSingleStep,
                           MockFrameVectorToFrameVector(std::move(mock_frames)), true);
  Stack& stack = thread()->GetStack();
  stack.SetHideAmbiguousInlineFrameCount(1);
  module_symbols()->AddLineDetails(
      kTopInlineFunctionRange.begin(),
      LineDetails(kTopInlineFileLine, {LineDetails::LineEntry(kTopInlineFunctionRange)}));
  auto step_into_controller = std::make_unique<StepThreadController>(StepMode::kSourceLine);
  bool continued = false;
  thread()->ContinueWith(std::move(step_into_controller), [&continued](const Err& err) {
    if (!err.has_error())
      continued = true;
  });
  EXPECT_TRUE(continued);
  EXPECT_EQ(0, mock_remote_api()->GetAndResetResumeCount());  
  loop().RunUntilNoTasks();
  EXPECT_EQ(0, mock_remote_api()->GetAndResetResumeCount());
  EXPECT_EQ(0u, stack.hide_ambiguous_inline_frame_count());
  step_into_controller = std::make_unique<StepThreadController>(StepMode::kSourceLine);
  continued = false;
  thread()->ContinueWith(std::move(step_into_controller), [&continued](const Err& err) {
    if (!err.has_error())
      continued = true;
  });
  EXPECT_TRUE(continued);
  EXPECT_EQ(1, mock_remote_api()->GetAndResetResumeCount());
  EXPECT_EQ(0u, stack.hide_ambiguous_inline_frame_count());
}
TEST_F ( StepThreadControllerTest , AmbiguousInline ) { auto mock_frames = GetStack ( ) ; FileLine file_line = mock_frames [ 1 ] -> GetLocation ( ) . file_line ( ) ; InjectExceptionWithStack ( process ( ) -> GetKoid ( ) , thread ( ) -> GetKoid ( ) , debug_ipc :: ExceptionType :: kSingleStep , MockFrameVectorToFrameVector ( std :: move ( mock_frames ) ) , true ) ; Stack & stack = thread ( ) -> GetStack ( ) ; stack . SetHideAmbiguousInlineFrameCount ( 1 ) ; module_symbols ( ) -> AddLineDetails ( kTopInlineFunctionRange . begin ( ) , LineDetails ( kTopInlineFileLine , { LineDetails :: LineEntry ( kTopInlineFunctionRange ) } ) ) ; auto step_into_controller = std :: make_unique < StepThreadController > ( StepMode :: kSourceLine ) ; bool continued = false ; thread ( ) -> ContinueWith ( std :: move ( step_into_controller ) , [ & continued ] ( const Err & err ) { if ( ! err . has_error ( ) ) continued = true ; } ) ; EXPECT_TRUE ( continued ) ; EXPECT_EQ ( 0 , mock_remote_api ( ) -> GetAndResetResumeCount ( ) ) ; loop ( ) . RunUntilNoTasks ( ) ; EXPECT_EQ ( 0 , mock_remote_api ( ) -> GetAndResetResumeCount ( ) ) ; EXPECT_EQ ( 0u , stack . hide_ambiguous_inline_frame_count ( ) ) ; step_into_controller = std :: make_unique < StepThreadController > ( StepMode :: kSourceLine ) ; continued = false ; thread ( ) -> ContinueWith ( std :: move ( step_into_controller ) , [ & continued ] ( const Err & err ) { if ( ! err . has_error ( ) ) continued = true ; } ) ; EXPECT_TRUE ( continued ) ; EXPECT_EQ ( 1 , mock_remote_api ( ) -> GetAndResetResumeCount ( ) ) ; EXPECT_EQ ( 0u , stack . hide_ambiguous_inline_frame_count ( ) ) ; }
Tests doing a "step" when the current instruction is about to execute the first instruction of
an inline, with the current function being the caller.
Tests doing a " step " when the current instruction is about to execute the first instruction of an inline with the current function being the caller .
// Recall the top frame from GetStack() is inline. // Stepping into the 0th frame from the first. These are the source locations. // Hide the inline frame at the top so we're about to step into it. // Provide a line mapping for this address so the symbolic stepping doesn't think we're in code // with no symbols. This maps the first address of the inline function to its code. This is // specifically not the file/line above because the line table maps generated code which will be // the inlined function. // Do the "step into". // That should have requested a synthetic exception which will be sent out asynchronously. The // Resume() call will cause the MockRemoteAPI to exit the message loop. // Nothing yet. // The operation should have unhidden the inline stack frame rather than actually affecting the // backend. // Now that we're at the top of the inline stack, do a subsequent "step into" which this time // should resume the backend.