File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 1919#include " lldb/API/SBFileSpec.h"
2020#include " lldb/API/SBFrame.h"
2121#include " lldb/API/SBFunction.h"
22+ #include " lldb/API/SBInstruction.h"
23+ #include " lldb/API/SBInstructionList.h"
2224#include " lldb/API/SBLineEntry.h"
2325#include " lldb/API/SBModule.h"
2426#include " lldb/API/SBQueue.h"
@@ -776,10 +778,12 @@ llvm::json::Value CreateStackFrame(lldb::SBFrame &frame,
776778
777779 // Calculate the line of the current PC from the start of the current
778780 // symbol.
779- lldb::addr_t inst_offset = frame.GetPCAddress ().GetOffset () -
780- frame.GetSymbol ().GetStartAddress ().GetOffset ();
781- lldb::addr_t inst_line =
782- inst_offset / (frame.GetThread ().GetProcess ().GetAddressByteSize () / 2 );
781+ lldb::SBAddress current_address = frame.GetPCAddress ();
782+ lldb::SBTarget target = frame.GetThread ().GetProcess ().GetTarget ();
783+ lldb::SBInstructionList inst_list =
784+ target.ReadInstructions (frame.GetSymbol ().GetStartAddress (), current_address, nullptr );
785+ size_t inst_line = inst_list.GetSize ();
786+
783787 // Line numbers are 1-based.
784788 object.try_emplace (" line" , inst_line + 1 );
785789 object.try_emplace (" column" , 1 );
You can’t perform that action at this time.
0 commit comments