Re: [PATCH] Display full file path in MI style disassembly listing

Andrew Burgess
2012-10-18T09:34:31Z

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