mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 02:39:44 +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:
|
||||
path = THREAD_PATTERN.format(procnum=nproc, tnum=nthrd)
|
||||
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')
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
## ###
|
||||
# IP: GHIDRA
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
# IP: GHIDRA
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
##
|
||||
from collections import namedtuple
|
||||
from concurrent.futures import Future
|
||||
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue