This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Rewrite mixed source/assembler disassembly
- From: Doug Evans <xdje42 at gmail dot com>
- To: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Sun, 19 Jul 2015 22:38:53 -0700
- Subject: Re: [PATCH] Rewrite mixed source/assembler disassembly
- Authentication-results: sourceware.org; auth=none
- References: <m3h9oz1k4m dot fsf at seba dot sebabeach dot org>
On Sun, Jul 19, 2015 at 10:19 PM, Doug Evans <xdje42@gmail.com> wrote:
> Hi.
>
> This is a patch I've wanted to write for a very long time.
> The current mixed source/assembler disassembly is not very usable.
> In the presence of multiple source files (inlined functions, etc.)
> it doesn't print usable output.
> In the presence of optimized code, trying to be source centric
> just doesn't work IMO. And with no optimization the before/after
> should be identical.
>
> One change I've made here is that I'm printing the source file
> in the output. This is critical when displaying inlined functions
> from another source file. If there's only one source file it's
> more a matter of taste. To keep things simple, this patch displays
> the source file name even if there's only one file.
>
> The other change I've made is to remove the blank line between
> assembly and the next source line. I'm ambivalent, what do you think?
>
> E.g.,
>
> (gdb) disas /m main
> Dump of assembler code for function main:
> hello.c: <<<--- this is new
> 5 {
> 0x08048330 <+0>: push %ebp
> 0x08048331 <+1>: mov %esp,%ebp
> 0x08048333 <+3>: sub $0x8,%esp
> 0x08048336 <+6>: and $0xfffffff0,%esp
> 0x08048339 <+9>: sub $0x10,%esp
> 6 printf ("Hello.\n");
> => 0x0804833c <+12>: movl $0x8048440,(%esp)
> 0x08048343 <+19>: call 0x8048284 <puts@@plt>
> 7 return 0;
> 0x08048348 <+24>: mov $0x0,%eax
> 8 }
> 0x0804834d <+29>: leave
> 0x0804834e <+30>: ret
>
> I still need to test this with an MI frontend.
>
> 2015-07-19 Doug Evans <xdje42@gmail.com>
>
> * NEWS: Document change is mixed source/assembly output.
> * disasm.c: #include "source.h".
> (dis_line_entry) <symtab>: New member.
> (dis_line_entry) <start_pc, end_pc>: Delete members.
> (hash_dis_line_entry, eq_dis_line_entry): New functions.
> (allocate_dis_line_table): New functions.
> (maybe_add_dis_line_entry, line_has_code_p): New functions.
> (compare_lines): Delete.
> (dump_insns): New arg end_pc. All callers updated.
> (do_mixed_source_and_assembly): Rewrite. Delete arg nlines, le.
> Rename arg symtab to main_symtab. All callers updated.
>
> doc/
> * gdb.texinfo (Machine Code): Update docs for mixed source/assembly
> disassembly.
>
> testsuite/
> * gdb.mi/basics.c (main): Add comment.
> * gdb.mi/mi-cli.exp: Update.
> * gdb.mi/mi-disassemble.exp: Update.
Hmmm, looks like I need to do a bit of testing with TUI too.
TUI doesn't have a mixed source+assembly in one window AFAICT.
That would be cool, but that's a separate project.
For now I'm just going to make sure things work at least
as well as before (I'm seeing some problems I need to investigate).