mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 10:49:34 +02:00
GP-5169: minor edit
GP-5169: stack requires regs update GP-5169: first pass dbgeng GP-5169: fix for gdb GP-5169: fix for lldb
This commit is contained in:
parent
420dd7ce0c
commit
e1f1eb7774
5 changed files with 57 additions and 32 deletions
|
@ -888,7 +888,11 @@ def activate(path=None):
|
|||
if nthrd is None:
|
||||
path = PROCESS_PATTERN.format(procnum=nproc)
|
||||
else:
|
||||
frame = util.selected_frame()
|
||||
if frame is None:
|
||||
path = THREAD_PATTERN.format(procnum=nproc, tnum=nthrd)
|
||||
else:
|
||||
path = FRAME_PATTERN.format(procnum=nproc, tnum=nthrd, level=frame)
|
||||
trace.proxy_object_path(path).activate()
|
||||
|
||||
|
||||
|
|
|
@ -140,8 +140,12 @@ def find_thread_by_regs_obj(object):
|
|||
return find_thread_by_pattern(REGS_PATTERN0, object, "a RegisterValueContainer")
|
||||
|
||||
|
||||
@util.dbg.eng_thread
|
||||
def find_frame_by_level(level):
|
||||
return dbg().backtrace_list()[level]
|
||||
for f in util.dbg._base.backtrace_list():
|
||||
if f.FrameNumber == level:
|
||||
return f
|
||||
#return dbg().backtrace_list()[level]
|
||||
|
||||
|
||||
def find_frame_by_pattern(pattern, object, err_msg):
|
||||
|
@ -269,13 +273,16 @@ def refresh_threads(node: sch.Schema('ThreadContainer')):
|
|||
def refresh_stack(node: sch.Schema('Stack')):
|
||||
"""Refresh the backtrace for the thread."""
|
||||
tnum = find_thread_by_stack_obj(node)
|
||||
util.reset_frames()
|
||||
with commands.open_tracked_tx('Refresh Stack'):
|
||||
commands.ghidra_trace_put_frames()
|
||||
with commands.open_tracked_tx('Refresh Registers'):
|
||||
commands.ghidra_trace_putreg()
|
||||
|
||||
|
||||
@REGISTRY.method(action='refresh', display='Refresh Registers')
|
||||
def refresh_registers(node: sch.Schema('RegisterValueContainer')):
|
||||
"""Refresh the register values for the frame."""
|
||||
"""Refresh the register values for the selected frame"""
|
||||
tnum = find_thread_by_regs_obj(node)
|
||||
with commands.open_tracked_tx('Refresh Registers'):
|
||||
commands.ghidra_trace_putreg()
|
||||
|
@ -314,7 +321,12 @@ def activate_thread(thread: sch.Schema('Thread')):
|
|||
@REGISTRY.method(action='activate')
|
||||
def activate_frame(frame: sch.Schema('StackFrame')):
|
||||
"""Select the frame."""
|
||||
find_frame_by_obj(frame)
|
||||
f = find_frame_by_obj(frame)
|
||||
util.select_frame(f.FrameNumber)
|
||||
with commands.open_tracked_tx('Refresh Stack'):
|
||||
commands.ghidra_trace_put_frames()
|
||||
with commands.open_tracked_tx('Refresh Registers'):
|
||||
commands.ghidra_trace_putreg()
|
||||
|
||||
|
||||
@REGISTRY.method(action='delete')
|
||||
|
|
|
@ -530,7 +530,12 @@ def select_thread(id: int):
|
|||
|
||||
@dbg.eng_thread
|
||||
def select_frame(id: int):
|
||||
return dbg.cmd('.frame 0x{:x}'.format(id))
|
||||
return dbg.cmd('.frame /c {}'.format(id))
|
||||
|
||||
|
||||
@dbg.eng_thread
|
||||
def reset_frames():
|
||||
return dbg.cmd('.cxr')
|
||||
|
||||
|
||||
@dbg.eng_thread
|
||||
|
|
|
@ -1427,6 +1427,8 @@ def put_frames():
|
|||
f = f.older()
|
||||
level += 1
|
||||
fobj.insert()
|
||||
robj = STATE.trace.create_object(fpath+".Registers")
|
||||
robj.insert()
|
||||
STATE.trace.proxy_object_path(STACK_PATTERN.format(
|
||||
infnum=inf.num, tnum=t.num)).retain_values(keys)
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ import time
|
|||
try:
|
||||
import psutil
|
||||
except ImportError:
|
||||
print(f"Unable to import 'psutil' - check that it has been installed")
|
||||
print("Unable to import 'psutil' - check that it has been installed")
|
||||
|
||||
from ghidratrace import sch
|
||||
from ghidratrace.client import Client, Address, AddressRange, TraceObject
|
||||
|
@ -1867,6 +1867,8 @@ def put_frames():
|
|||
fobj.set_value('Function', str(f.GetFunctionName()))
|
||||
fobj.set_value('_display', util.get_description(f))
|
||||
fobj.insert()
|
||||
robj = STATE.trace.create_object(fpath+".Registers")
|
||||
robj.insert()
|
||||
STATE.trace.proxy_object_path(STACK_PATTERN.format(
|
||||
procnum=proc.GetProcessID(), tnum=t.GetThreadID())).retain_values(keys)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue