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: [RFA] Use GDB signal enum in corelow.c


On 06/14/2013 03:24 PM, Pierre Muller wrote:
>   This RFA is related to the
> thread started today by Sergio Durigan Junior
> [RFC/PATCH] Add new internal variable $_signo
> 
>  But the patch I sent in my answer was not applying correctly
> as I modified the patch file directly after using patch
> executable.
> 
>   The "inconsistency" is that in corelow.c
> the integer variable siggy is printed out, 
> but this corresponds to the value of the signal on the system
> on which the core dump was created, which might be different
> from the internal enum normally used by GDB.

That's OK.  If we're printing the signal number, we do
want the number on the system on which the core was created.
That's the number the program sees and uses, and the one
that has meaning for the user.  The internal GDB number has no
meaning for the user or the program.

> Other signals are always first converted to GDB enum values 
> before being printed, and apparently not in
> integer form but using the gdb_signal_to_name function.

Right, GDB enum values are never displayed.  They're an
internal implementation detail.

> 
>   Thus this patch simply converts the printout of the
> numerical value of the signal into the converted GDB signal name.

I only half agree with the rationale, but I agree with the patch.  :-)

With live debugging, we print:

  if (ui_out_is_mi_like_p (uiout))
    ui_out_field_string
      (uiout, "reason", async_reason_lookup (EXEC_ASYNC_EXITED_SIGNALLED));
  ui_out_text (uiout, "\nProgram terminated with signal ");
  annotate_signal_name ();
  ui_out_field_string (uiout, "signal-name",
		       gdb_signal_to_name (siggnal));
  annotate_signal_name_end ();
  ui_out_text (uiout, ", ");
  annotate_signal_string ();
  ui_out_field_string (uiout, "signal-meaning",
		       gdb_signal_to_string (siggnal));
  annotate_signal_string_end ();
  ui_out_text (uiout, ".\n");
  ui_out_text (uiout, "The program no longer exists.\n");
}

And it looks to me that your patch:

> -      printf_filtered (_("Program terminated with signal %d, %s.\n"),
> -                      siggy, gdb_signal_to_string (sig));
> +      printf_filtered (_("Program terminated with signal %s, %s.\n"),
> +                      gdb_signal_to_name (sig), gdb_signal_to_string

Makes the output of live debugging vs core debugging exactly
the same (please confirm).  _That_ rationale makes me agree
with the patch.

>         * corelow.c (core_open): Use GDB signal name instead of raw
>         signal value.

s/Use/Print/
s/raw/target/
s/value/number/

-- 
Pedro Alves


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