refactored main_module_name calls to pwndbg.aglib.proc.exe (#3246)

pull/3248/head
jxuanli 4 months ago committed by GitHub
parent 870825cd5f
commit 776bd079de
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -230,7 +230,7 @@ def attachp(
) -> None: ) -> None:
# As a default, the user may want to attach to a binary name taken from currently loaded file name # As a default, the user may want to attach to a binary name taken from currently loaded file name
if target is None: if target is None:
bin_path = pwndbg.dbg.selected_inferior().main_module_name() bin_path = pwndbg.aglib.proc.exe
if bin_path is None: if bin_path is None:
print( print(
message.error( message.error(

@ -37,11 +37,10 @@ def kbase(rebase=False) -> None:
if not rebase: if not rebase:
return return
symbol_file = pwndbg.dbg.selected_inferior().main_module_name() symbol_file = pwndbg.aglib.proc.exe
if symbol_file: if symbol_file:
if pwndbg.dbg.is_gdblib_available(): if pwndbg.dbg.is_gdblib_available():
gdb.execute("symbol-file")
gdb.execute(f"add-symbol-file {symbol_file} {hex(base)}") gdb.execute(f"add-symbol-file {symbol_file} {hex(base)}")
else: else:
print(M.error("Adding symbol not supported in LLDB yet")) print(M.error("Adding symbol not supported in LLDB yet"))

@ -108,7 +108,7 @@ def decompile(func=None):
if pwndbg.dbg.is_gdblib_available(): if pwndbg.dbg.is_gdblib_available():
src_filename = pwndbg.gdblib.symbol.selected_frame_source_absolute_filename() src_filename = pwndbg.gdblib.symbol.selected_frame_source_absolute_filename()
if not src_filename: if not src_filename:
filename = pwndbg.dbg.selected_inferior().main_module_name() filename = pwndbg.aglib.proc.exe
src_filename = filename + ".c" if os.path.basename(filename).find(".") < 0 else filename src_filename = filename + ".c" if os.path.basename(filename).find(".") < 0 else filename
source = H.syntax_highlight(source, src_filename) source = H.syntax_highlight(source, src_filename)

@ -23,7 +23,7 @@ def r2pipe():
Returns a r2pipe.open handle. Returns a r2pipe.open handle.
""" """
filename = pwndbg.dbg.selected_inferior().main_module_name() filename = pwndbg.aglib.proc.exe
if not filename: if not filename:
raise Exception("Could not find objfile to create a r2pipe for") raise Exception("Could not find objfile to create a r2pipe for")

@ -21,7 +21,7 @@ def rzpipe():
Raises Exception if anything goes fatally wrong. Raises Exception if anything goes fatally wrong.
Returns a rzpipe.open handle. Returns a rzpipe.open handle.
""" """
filename = pwndbg.dbg.selected_inferior().main_module_name() filename = pwndbg.aglib.proc.exe
if not filename: if not filename:
raise Exception("Could not find objfile to create a rzpipe for") raise Exception("Could not find objfile to create a rzpipe for")

Loading…
Cancel
Save