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: [patch v4 03/13] cli, btrace: add btrace cli


> -----Original Message-----
> From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-owner@sourceware.org] On Behalf Of Tom Tromey
> Sent: Tuesday, November 27, 2012 10:54 PM
> To: Metzger, Markus T
> Cc: gdb-patches@sourceware.org; markus.t.metzger@gmail.com; jan.kratochvil@redhat.com; palves@redhat.com;
> kettenis@gnu.org
> Subject: Re: [patch v4 03/13] cli, btrace: add btrace cli
> Importance: High
> 
> >>>>> "Markus" == markus t metzger <markus.t.metzger@intel.com> writes:
> 
> Markus> +/* Print the function containing the btrace list item @trace.  */
> Markus> +static void
> Markus> +do_btrace_list_function (struct btrace_block *trace)
> Markus> +{
> Markus> +  struct symbol *symbol = find_pc_function (trace->begin);
> Markus> +
> Markus> +  ui_out_text (current_uiout, " in ");
> Markus> +  if (symbol)
> Markus> +    ui_out_field_string (current_uiout, "function",
> Markus> +			 SYMBOL_PRINT_NAME (symbol));
> Markus> +  else
> Markus> +    {
> Markus> +      struct minimal_symbol *msymbol =
> Markus> +	lookup_minimal_symbol_by_pc (trace->begin);
> Markus> +
> Markus> +      if (msymbol)
> Markus> +	ui_out_field_string (current_uiout, "function",
> Markus> +			     SYMBOL_PRINT_NAME (msymbol));
> Markus> +      else
> Markus> +	ui_out_text (current_uiout, "??");
> Markus> +    }
> Markus> +
> Markus> +  ui_out_text (current_uiout, " ()");
> 
> I think these parens will look strange if you try it with C++ code.
> There, the argument types are part of the symbol name.

Thanks.

The easiest thing for me to do would be to only print "()" if lang != language_cplus. Since the demangler prints the parameters right after the function name, though, I would also remove the space before "()" for other languages.

The backtrace command uses cp_remove_params () to get the name for a C++ function. Since I do not have a frame and thus cannot print the parameters, I think I should at least print the parameter types. I would thus print the function name returned by cp_remove_params (), a space, and the parameter list I obtained via strstr (demangled_name, "("). This should strip the return type but would leave qualifiers. Actually, I have never seen the return type to be printed.

What would you prefer?

Thanks,
Markus.
Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen, Deutschland
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk
Registergericht: Muenchen HRB 47456
Ust.-IdNr./VAT Registration No.: DE129385895
Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052


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