This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Display full file path in MI style disassembly listing
- From: "Andrew Burgess" <aburgess at broadcom dot com>
- To: "Tom Tromey" <tromey at redhat dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Thu, 18 Oct 2012 10:34:15 +0100
- Subject: Re: [PATCH] Display full file path in MI style disassembly listing
- References: <506DB4B8.5030001@broadcom.com> <87a9vl3tq2.fsf@fleche.redhat.com>
On 17/10/2012 6:15 PM, Tom Tromey wrote:
>>>>>> "Andrew" == Andrew Burgess <aburgess@broadcom.com> writes:
>
> Andrew> + char *filename;
>
> I think this could be const.
>
> Andrew> +
> Andrew> + filename = s->fullname;
> Andrew> + if (filename == NULL)
> Andrew> + {
> Andrew> + filename = symtab_to_fullname (s);
> Andrew> + if (filename == NULL)
> Andrew> + filename = s->filename;
> Andrew> + }
> Andrew> +
> Andrew> ui_out_field_int (uiout, "line", line);
> Andrew> ui_out_text (uiout, "\tin ");
> Andrew> - ui_out_field_string (uiout, "file", s->filename);
> Andrew> + ui_out_field_string (uiout, "file", filename);
> Andrew> ui_out_text (uiout, "\n");
>
> It isn't obvious to me that this only applies to the MI case.
> Can you explain that?
You are correct, and my subject line is miss-leading. It is possible to
hit this code from cli gdb, but I believe this only happens if we fail
to open the file.
- we first test "ui_out_test_flags (uiout, ui_source_list)" which I
believe is always true for cli gdb. I couldn't see a way this can be
turned off, but maybe I missed something.
- we then try to open the file in question.
If we're not printing source (mi) or the open failed (mi/cli) then we'll
pass through the code I changed.
Thanks,
Andrew