This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC] -thread-select double print stack frame
> > But why do you think that while file and line details are currenly
> > duplicated in MI, they are not in CLI? (I mean what is the underlying
> > logic/cause, not the just the code differences).
>
> Here's what I get from the CLI:
>
> [Switching to thread 1 (Thread 46912506009296 (LWP 28747))]#0 main
> (argc=1, argv=0x7fffffffe178)
> at /space/fsf/commit/src/gdb/gdb.c:28
> 28 {
>
> The first line is the frame description and becomes the new-thread-id
> and the frame={} tuple. The second line ("28 {") comes from
> print_source_lines (from lack of ui_source_list). I think we need
> both, because we use print_source_lines in other contexts too, but I'm
> not sure about that.
>
> So the short answer is that they are duplicated in the CLI too. The
> two copies are just formatted so differently that it isn't obvious.
OK. I think I understand the second call now.
I was looking specifically at this clause in print_source_lines_base:
if (desc < 0)
{
last_source_error = desc;
if (!noerror)
{
char *name = alloca (strlen (s->filename) + 100);
sprintf (name, "%d\t%s", line, s->filename);
print_sys_errmsg (name, errno);
}
else
ui_out_field_int (uiout, "line", line);
ui_out_text (uiout, "\tin ");
ui_out_field_string (uiout, "file", s->filename);
ui_out_text (uiout, "\n");
return;
}
I think this code may only be reached when there is duplicated MI output.
> This does make me wonder about the patch though. Denis, could you
> hold off on committing it? Which duplicate copy are you eliminating?
> Maybe we should diff two testsuite runs to see what else changes.
No, I think this change is alright (I haven't run the testsuite though.).
It's your decision but the next release is a long way off and if these changes
are not the right ones they are not far off. So I would suggest committing
them all i.e this one, yours and Denis's -thread-* commands now. That way
if there are problems we will quite likely discover them before the release.
--
Nick http://www.inet.net.nz/~nickrob