[v2,1/2] Display ExceptionRecord for $_siginfo

Message ID 955533175.395475.1581196161533@mail.yahoo.com
State New, archived
Headers

Commit Message

Terekhov, Mikhail via Gdb-patches Feb. 8, 2020, 9:09 p.m. UTC
  Am Samstag, 8. Februar 2020, 21:13:54 MEZ hat Eli Zaretskii <eliz@gnu.org> Folgendes geschrieben:

> > From: Simon Marchi <simark@simark.ca>
> > Date: Sat, 8 Feb 2020 15:00:10 -0500
> >
> > > Program received signal SIGSEGV, Segmentation fault.
> > > main () at crasher.c:4
> > > 4        *(int*)0x123 = 0;
> > > (gdb) p $_siginfo
> > > $1 = {
> > >  ExceptionCode = 3221225477,
> > >  ExceptionFlags = 0,
> > >  ExceptionRecord = 0x0,
> > >  ExceptionAddress = 0x401632 <main+18>,
> > >  NumberParameters = 2,
> > >  ExceptionInformation = {1, 291, 0 <repeats 13 times>}
> > > }
> > > (gdb) p/x $_siginfo.ExceptionCode
> > > $2 = 0xc0000005
> > > (gdb) p/x $_siginfo.ExceptionInformation[1]
> > > $3 = 0x123
> > >
> > > And 0xc0000005 is the value of EXCEPTION_ACCESS_VIOLATION.
> > >
> > > [1] https://docs.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-exception_record
> >
> > Eli, could you please comment on this from a Windows user point of view, if this looks
> > correct to you?
>
> LGTM, although I'd prefer to have ExceptionCode be printed in hex by
> default.  But I guess that could be tricky, and the next patch makes
> then print as symbolic names anyway.

These were basically the same thoughts I had when I made this.


> > Also, does this need a manual/NEWS update?
>
>
> I think only NEWS, because the manual already says "on some targets",
> and gives an example from GNU/Linux only.

Is it fine if I add the following to this patch?:

    * NEWS: Mention $_siginfo support for Windows.
---
  

Comments

Eli Zaretskii Feb. 9, 2020, 3:28 a.m. UTC | #1
> Date: Sat, 8 Feb 2020 21:09:21 +0000 (UTC)
> From: "Hannes Domani via gdb-patches" <gdb-patches@sourceware.org>
> 
> Is it fine if I add the following to this patch?:
> 
>     * NEWS: Mention $_siginfo support for Windows.
> ---
> diff --git a/gdb/NEWS b/gdb/NEWS
> index d4e2e70f38..c202fe06de 100644
> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -10,6 +10,9 @@
>    that support it (see entry for GDB 9, below), providing faster
>    performance for programs with many symbols.
> 
> +* The $_siginfo convenience variable now also works on Windows targets,
> +  and will display the EXCEPTION_RECORD of the last handled exception.
> +
>  * New commands

Yes, this sounds good to me, thanks.
  
Simon Marchi Feb. 9, 2020, 5:33 a.m. UTC | #2
On 2020-02-08 10:28 p.m., Eli Zaretskii wrote:
>> Date: Sat, 8 Feb 2020 21:09:21 +0000 (UTC)
>> From: "Hannes Domani via gdb-patches" <gdb-patches@sourceware.org>
>>
>> Is it fine if I add the following to this patch?:
>>
>>     * NEWS: Mention $_siginfo support for Windows.
>> ---
>> diff --git a/gdb/NEWS b/gdb/NEWS
>> index d4e2e70f38..c202fe06de 100644
>> --- a/gdb/NEWS
>> +++ b/gdb/NEWS
>> @@ -10,6 +10,9 @@
>>    that support it (see entry for GDB 9, below), providing faster
>>    performance for programs with many symbols.
>>
>> +* The $_siginfo convenience variable now also works on Windows targets,
>> +  and will display the EXCEPTION_RECORD of the last handled exception.
>> +
>>  * New commands
> 
> Yes, this sounds good to me, thanks.

Thanks for chiming in Eli.

So Hannes, just to be clear, you can go ahead and push this series, thanks!

Simon
  
Terekhov, Mikhail via Gdb-patches Feb. 9, 2020, 11:19 a.m. UTC | #3
Am Sonntag, 9. Februar 2020, 06:33:39 MEZ hat Simon Marchi <simark@simark.ca> Folgendes geschrieben:

> On 2020-02-08 10:28 p.m., Eli Zaretskii wrote:
>
> >> Date: Sat, 8 Feb 2020 21:09:21 +0000 (UTC)
> >> From: "Hannes Domani via gdb-patches" <gdb-patches@sourceware.org>
> >>
> >> Is it fine if I add the following to this patch?:
> >>
> >>     * NEWS: Mention $_siginfo support for Windows.
> >> ---
> >> diff --git a/gdb/NEWS b/gdb/NEWS
> >> index d4e2e70f38..c202fe06de 100644
> >> --- a/gdb/NEWS
> >> +++ b/gdb/NEWS
> >> @@ -10,6 +10,9 @@
> >>    that support it (see entry for GDB 9, below), providing faster
> >>    performance for programs with many symbols.
> >>
> >> +* The $_siginfo convenience variable now also works on Windows targets,
> >> +  and will display the EXCEPTION_RECORD of the last handled exception.
> >> +
> >>  * New commands
> >
> > Yes, this sounds good to me, thanks.
>
>
> Thanks for chiming in Eli.
>
> So Hannes, just to be clear, you can go ahead and push this series, thanks!

Pushed, thanks.
  

Patch

diff --git a/gdb/NEWS b/gdb/NEWS
index d4e2e70f38..c202fe06de 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -10,6 +10,9 @@ 
   that support it (see entry for GDB 9, below), providing faster
   performance for programs with many symbols.

+* The $_siginfo convenience variable now also works on Windows targets,
+  and will display the EXCEPTION_RECORD of the last handled exception.
+
 * New commands

 set exec-file-mismatch -- Set exec-file-mismatch handling (ask|warn|off).