This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] Implement -thread-info.
> > mi_info_threads is nearly the same function as thread_command.
>
> You probably meant info_threads_command?
Yes.
> > Can this be
> > used in a dual way just as -break-list uses breakpoint_1?
>
> I don't know -- I actually have no idea what magic makes breakpoint_1 to
> work both for MI and CLI. Do you happen to know?
It just seems to be a kind of overloading where the output format of
functions like ui_out_field_string depends on the interpreter used (value
of uiout). In cases where only one interpreter outputs anything
ui_out_is_mi_like_p is used.
> > Also Denis Pilat has already proposed a patch for -thread-info:
> > http://sourceware.org/ml/gdb-patches/2007-03/msg00167.html
>
> I did not notice that.
>
> >
> > How does your patch compare? (assuming the problem of return type is solved
> > as has been done for thread_select).
>
> It appears that my patch:
>
> 1. Does not bother with making non-throwing function, as MI top-level can
> handle exceptions.
>
> 2. Allows to print information about all threads.
I see. Denis also proposed something for -thread-list-all-threads
(http://sourceware.org/ml/gdb-patches/2007-03/msg00144.html)
Do you not want to print the frame level? Also do you want to
catch errors in print_stack_frame? Rather than:
+ print_stack_frame (get_selected_frame (NULL), 0, LOCATION);
Would it be better to use:
+ print_frame_info (get_selected_frame (NULL), 1, LOC_AND_ADDRESS, 0);
?
Note that with MI (following the thread with Denis) that the address gets
printed anyway when print_stack_frame is used:
args.print_what = ui_out_is_mi_like_p (uiout) ? LOC_AND_ADDRESS : print_what;
> I don't know what problem of return type you refer to -- can you clarify?
That, in Denis' patch, gdb_thread_info returns type enum gdb_rc but
catch_exceptions_with_msg returns type int. (just like gdb_breakpoint and
break_command_really did for a while).
--
Nick http://www.inet.net.nz/~nickrob