Skip to content

Commit

Permalink
lldb plugins fixes
Browse files Browse the repository at this point in the history
Two things:
* the base address of the current module wasn't correct
* the first frame was always choosen, even if not the current one
  • Loading branch information
aguinetqb committed Mar 2, 2016
1 parent acd6fb4 commit 2c70e4d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ext_lldb/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,11 @@ def _locate(self, process):
if not pinfo:
return

target = self._dbg.GetSelectedTarget()
ptr_size = target.GetAddressByteSize()
last_addr = (-1)%(2**(ptr_size*8))
thread = process.GetSelectedThread()
frame = thread.GetFrameAtIndex(0)
frame = thread.GetSelectedFrame()
offset = frame.pc

mod = frame.GetModule()
Expand All @@ -173,8 +176,8 @@ def _locate(self, process):
base = 0
for i in range(4):
sect = mod.GetSectionAtIndex(i)
addr = int(sect.addr)
if addr:
addr = sect.addr.GetLoadAddress(target)
if addr != last_addr:
base = addr
break

Expand Down

0 comments on commit 2c70e4d

Please sign in to comment.