This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: What about add a interface to output the assembly codes follow inferior execution


On Mon, Mar 2, 2009 at 7:10 PM, teawater <teawater@gmail.com> wrote:
> Hi guys,
>
> I am not sure gdb have a interface to output assembly codes except
> "disassemble".
> Maybe gdb can support a interface can output assembly codes of next
> part of code.
>
> For example:
> #If exec-disassemble set to auto, just output assembly codes if there
> is not line message.
> #It will be the default value.
> (gdb) set exec-disassemble auto
> (gdb) si
> 0x080483ee ? ? ?24 ? ? ? ? ? ? ?b = printf ("a = %d b = %d c = %d\n", a, b, c);
> (gdb) si
> 0x080482d8 in printf@plt ()
> Current language: ?auto; currently asm
> 0x080482d8 <printf@plt+0>: ? ? ?jmp ? ?*0x8049670
> (gdb) si
> 0x080482de in printf@plt ()
> 0x080482de <printf@plt+6>: ? ? ?push ? $0x10
>
> #If exec-disassemble set to on, gdb will always output assembly codes.
> (gdb) set exec-disassemble on
> (gdb) n
> 26 ? ? ? ? ? ? ?printf ("a = %d b = %d c = %d\n", a, b, c);
> ?80483fe: ? ? ? 8b 15 84 96 04 08 ? ? ? mov ? ?0x8049684,%edx
> ?8048404: ? ? ? 8b 45 f4 ? ? ? ? ? ? ? ?mov ? ?-0xc(%ebp),%eax
> ?8048407: ? ? ? 89 44 24 0c ? ? ? ? ? ? mov ? ?%eax,0xc(%esp)
> ?804840b: ? ? ? 8b 45 f8 ? ? ? ? ? ? ? ?mov ? ?-0x8(%ebp),%eax
> ?804840e: ? ? ? 89 44 24 08 ? ? ? ? ? ? mov ? ?%eax,0x8(%esp)
> ?8048412: ? ? ? 89 54 24 04 ? ? ? ? ? ? mov ? ?%edx,0x4(%esp)
> ?8048416: ? ? ? c7 04 24 58 85 04 08 ? ?movl ? $0x8048558,(%esp)
> ?804841d: ? ? ? e8 b6 fe ff ff ? ? ? ? ?call ? 80482d8 <printf@plt>
>
> #If exec-disassemble set to off, gdb will work like before.
> (gdb) set exec-disassemble off
>
>
> What do you think about it?

Are you looking for behaviour different than what "disp/8i $pc" would give you?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]