File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 19
19
#include " lldb/API/SBFileSpec.h"
20
20
#include " lldb/API/SBFrame.h"
21
21
#include " lldb/API/SBFunction.h"
22
+ #include " lldb/API/SBInstructionList.h"
22
23
#include " lldb/API/SBLineEntry.h"
23
24
#include " lldb/API/SBModule.h"
24
25
#include " lldb/API/SBQueue.h"
@@ -776,10 +777,11 @@ llvm::json::Value CreateStackFrame(lldb::SBFrame &frame,
776
777
777
778
// Calculate the line of the current PC from the start of the current
778
779
// 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 );
780
+ lldb::SBTarget target = frame.GetThread ().GetProcess ().GetTarget ();
781
+ lldb::SBInstructionList inst_list = target.ReadInstructions (
782
+ frame.GetSymbol ().GetStartAddress (), frame.GetPCAddress (), nullptr );
783
+ size_t inst_line = inst_list.GetSize ();
784
+
783
785
// Line numbers are 1-based.
784
786
object.try_emplace (" line" , inst_line + 1 );
785
787
object.try_emplace (" column" , 1 );
You can’t perform that action at this time.
0 commit comments