diff --git a/pwndbg/commands/auxv.py b/pwndbg/commands/auxv.py index b2263705b..26cfe60e4 100644 --- a/pwndbg/commands/auxv.py +++ b/pwndbg/commands/auxv.py @@ -7,6 +7,9 @@ import pwndbg.commands @pwndbg.commands.ParsedCommand @pwndbg.commands.OnlyWhenRunning def auxv(): + """ + Print information from the Auxiliary ELF Vector. + """ for k,v in pwndbg.auxv.get().items(): if v is not None: print(k.ljust(24), v if not isinstance(v, (long, int)) else pwndbg.chain.format(v)) diff --git a/pwndbg/commands/context.py b/pwndbg/commands/context.py index 705951b92..5717d1a4d 100644 --- a/pwndbg/commands/context.py +++ b/pwndbg/commands/context.py @@ -16,6 +16,9 @@ import pwndbg.vmmap @pwndbg.commands.ParsedCommand @pwndbg.commands.OnlyWhenRunning def context(*args): + """ + Print out the current register, instruction, and stack context. + """ if len(args) == 0: args = ['reg','code','stack','backtrace'] diff --git a/pwndbg/commands/dt.py b/pwndbg/commands/dt.py index 497d76b7f..1894354f7 100644 --- a/pwndbg/commands/dt.py +++ b/pwndbg/commands/dt.py @@ -8,6 +8,11 @@ import pwndbg.vmmap @pwndbg.commands.Command @pwndbg.commands.OnlyWhenRunning def dt(typename, address=None): + """ + Dump out information on a type (e.g. ucontext_t). + + Optionally overlay that information at an address. + """ if address is not None: address = pwndbg.commands.fix(address) print(pwndbg.dt.dt(typename, addr=address)) diff --git a/pwndbg/commands/hexdump.py b/pwndbg/commands/hexdump.py index 8ebcd8653..d4abc14e2 100644 --- a/pwndbg/commands/hexdump.py +++ b/pwndbg/commands/hexdump.py @@ -7,7 +7,12 @@ import pwndbg.regs @pwndbg.commands.ParsedCommand @pwndbg.commands.OnlyWhenRunning def hexdump(address=None, count=64): - """Hexdumps some data""" + """ + Hexdumps data at the specified address. + Optionally provide the number of bytes to dump (default 64) + + Note that repeating rows are collapsed. + """ address = int(address or pwndbg.regs.sp) count = int(count) diff --git a/pwndbg/commands/ida.py b/pwndbg/commands/ida.py index 2153096f9..59c6f979b 100644 --- a/pwndbg/commands/ida.py +++ b/pwndbg/commands/ida.py @@ -8,6 +8,9 @@ import pwndbg.regs @pwndbg.commands.OnlyWhenRunning @pwndbg.events.stop def j(*args): + """ + Synchronize IDA's cursor with GDB + """ pc = int(gdb.selected_frame().pc()) pwndbg.ida.Jump(pc) @@ -15,12 +18,17 @@ def j(*args): if pwndbg.ida.available(): @pwndbg.commands.Command @pwndbg.commands.OnlyWhenRunning - def up(): + def up(n=1): + """ + Select and print stack frame that called this one. + An argument says how many frames up to go. + """ f = gdb.selected_frame() - o = f.older() - if o: - o.select() + for i in range(n): + o = f.older() + if o: + o.select() bt = pwndbg.commands.context.context_backtrace(with_banner=False) print('\n'.join(bt)) @@ -29,12 +37,17 @@ if pwndbg.ida.available(): @pwndbg.commands.Command @pwndbg.commands.OnlyWhenRunning - def down(): + def down(n=1): + """ + Select and print stack frame called by this one. + An argument says how many frames down to go. + """ f = gdb.selected_frame() - o = f.newer() - if o: - o.select() + for i in range(n): + o = f.older() + if o: + o.select() bt = pwndbg.commands.context.context_backtrace(with_banner=False) print('\n'.join(bt)) diff --git a/pwndbg/commands/nearpc.py b/pwndbg/commands/nearpc.py index 52d0ff387..af311d5f4 100644 --- a/pwndbg/commands/nearpc.py +++ b/pwndbg/commands/nearpc.py @@ -10,6 +10,9 @@ import pwndbg.vmmap @pwndbg.commands.ParsedCommand @pwndbg.commands.OnlyWhenRunning def nearpc(pc=None, lines=None, to_string=False): + """ + Disassemble near a specified address. + """ # Fix the case where we only have one argument, and # it's a small value. if lines is None and (pc is None or int(pc) < 0x100):