This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: tracing broken if target doesn't do disconnected tracing


On Wednesday 07 April 2010 21:20:55, Stan Shebs wrote:
> >
> > Hmm, can you expand on what lameness you're referring to exactly?
> > Is it a technical limitation?
> >   
> 
> It's the requirement to describe the variable with a noun phrase like 
> "foo bar of baz", so that the output can be "foo bar of baz is on" etc.  
> For simple settings the algorithm is reasonable, but as the concept gets 
> more complicated, the phrasing gets more tortured.

I think you can already have what you want.  See how
the "show displaced-stepping", "show breakpoint always-inserted",
"show language" are implemented.  E.g.,

static void
show_can_use_displaced_stepping (struct ui_file *file, int from_tty,
				 struct cmd_list_element *c,
				 const char *value)
{
  if (can_use_displaced_stepping == can_use_displaced_stepping_auto)
    fprintf_filtered (file, _("\
Debugger's willingness to use displaced stepping to step over \
breakpoints is %s (currently %s).\n"),
		      value, non_stop ? "on" : "off");
  else
    fprintf_filtered (file, _("\
Debugger's willingness to use displaced stepping to step over \
breakpoints is %s.\n"), value);
}

So, here:

>  add_setshow_boolean_cmd ("disconnected-tracing", no_class,
>			   &disconnected_tracing, _("\
>Set whether tracing continues after GDB disconnects."), _("\
>Show whether tracing continues after GDB disconnects."), _("\
>Use this to continue a tracing run even if GDB disconnects\n\
>or detaches from the target.  You can reconnect later and look at\n\
>trace data collected in the meantime."),
>			   set_disconnected_tracing,
>			   NULL,
                                       ^^^^

this callback is NULL.  YOu can set to a callback that computes
the show string in response to "show disconnected-tracing".
In there you can use something like "target_can_use_disconnected_tracing()",
or "current_trace_status ()->circular" to do that "(currently foo)"/"(but
target is lame and doesn't support)" thing.

Does that help?

Actually, we should not be allowing new commands with that
callback as NULL.  Take a look at `deprecated_show_value_hack',
which is the default callback --- it's busted with i18n:

  /* Print doc minus "show" at start.  */
  print_doc_line (gdb_stdout, c->doc + 5);

This is PR8413 <http://sourceware.org/bugzilla/show_bug.cgi?id=8413>.

-- 
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]