public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* gdb and core files
@ 2020-06-28  0:50 Ken Brown
  2020-06-28 13:31 ` Jon Turney
  0 siblings, 1 reply; 6+ messages in thread
From: Ken Brown @ 2020-06-28  0:50 UTC (permalink / raw)
  To: cygwin

Following the instructions at 
https://cygwin.com/cygwin-ug-net/using-cygwinenv.html, I tried to create a core 
file that I could examine with gdb, but I apparently ran into a gdb bug.  I 
tried both gdb 9.2-1 and 8.3.1-1.  Here are the results with 9.2-1.

$ cat crash.c
#include <stddef.h>
int
main ()
{
   char *p = NULL;
   char c = *p;
}

$ gcc -g crash.c

$ CYGWIN='error_start:c:\cygwin64\bin\dumper.exe' ./a
*** starting debugger for pid 2034, tid 99552

$ gdb ./a.exe a.exe.core
GNU gdb (GDB) (Cygwin 9.2-1) 9.2
[...]
Reading symbols from ./a.exe...

warning: core file may not match specified executable file.
[New Thread 0x1b724]
[New Thread 0x23450]
[New Thread 0x16cb4]
[New Thread 0x1c4b4]
[New Thread 0x9050]

warning: Unexpected size of section `.reg/112420' in core file.
/wip/cygport-git/gdb/gdb-9.2-1.x86_64/src/gdb-9.2/gdb/corelow.c:640: 
internal-error: void core_target::get_core_register_section(regcache*, const 
regset*, const char*, int, int, const char*, bool): Assertion `m_core_vec != 
nullptr' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) y

This is a bug, please report it.  For instructions, see:
<http://www.gnu.org/software/gdb/bugs/>.

/wip/cygport-git/gdb/gdb-9.2-1.x86_64/src/gdb-9.2/gdb/corelow.c:640: 
internal-error: void core_target::get_core_register_section(regcache*, const 
regset*, const char*, int, int, const char*, bool): Assertion `m_core_vec != 
nullptr' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) n

Did I do something wrong?

Ken

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: gdb and core files
  2020-06-28  0:50 gdb and core files Ken Brown
@ 2020-06-28 13:31 ` Jon Turney
  2020-06-29 16:03   ` Ken Brown
  0 siblings, 1 reply; 6+ messages in thread
From: Jon Turney @ 2020-06-28 13:31 UTC (permalink / raw)
  To: The Cygwin Mailing List

On 28/06/2020 01:50, Ken Brown via Cygwin wrote:
> Following the instructions at 
> https://cygwin.com/cygwin-ug-net/using-cygwinenv.html, I tried to create 
> a core file that I could examine with gdb, but I apparently ran into a 
> gdb bug.  I tried both gdb 9.2-1 and 8.3.1-1.  Here are the results with 
> 9.2-1.
> 
[...]

Unfortunately, I think dumper doesn't produce anything useful on x86_64. 
See [1] et seq.

[1] https://cygwin.com/pipermail/cygwin/2019-October/242801.html

> Did I do something wrong?

No.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: gdb and core files
  2020-06-28 13:31 ` Jon Turney
@ 2020-06-29 16:03   ` Ken Brown
  2020-06-30  3:24     ` Mark Geisert
  0 siblings, 1 reply; 6+ messages in thread
From: Ken Brown @ 2020-06-29 16:03 UTC (permalink / raw)
  To: Jon Turney, The Cygwin Mailing List

On 6/28/2020 9:31 AM, Jon Turney wrote:
> On 28/06/2020 01:50, Ken Brown via Cygwin wrote:
>> Following the instructions at 
>> https://cygwin.com/cygwin-ug-net/using-cygwinenv.html, I tried to create a 
>> core file that I could examine with gdb, but I apparently ran into a gdb bug.  
>> I tried both gdb 9.2-1 and 8.3.1-1.  Here are the results with 9.2-1.
>>
> [...]
> 
> Unfortunately, I think dumper doesn't produce anything useful on x86_64. See [1] 
> et seq.

Thanks.  Sorry I didn't notice that people had asked the same question before.

We should probably fix the documentation:

   https://cygwin.com/cygwin-ug-net/using-cygwinenv.html
   https://cygwin.com/cygwin-ug-net/dumper.html

Or maybe we should just remove all mention of dumper from the documentation.
Given that we're trying to move people away from 32-bit Cygwin, I don't think it 
makes sense to document a feature that works only on the latter.

Ken

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: gdb and core files
  2020-06-29 16:03   ` Ken Brown
@ 2020-06-30  3:24     ` Mark Geisert
  2020-07-01 21:37       ` Jon Turney
  0 siblings, 1 reply; 6+ messages in thread
From: Mark Geisert @ 2020-06-30  3:24 UTC (permalink / raw)
  To: The Cygwin Mailing List

Ken Brown via Cygwin wrote:
> On 6/28/2020 9:31 AM, Jon Turney wrote:
>> On 28/06/2020 01:50, Ken Brown via Cygwin wrote:
>>> Following the instructions at 
>>> https://cygwin.com/cygwin-ug-net/using-cygwinenv.html, I tried to create a 
>>> core file that I could examine with gdb, but I apparently ran into a gdb bug. 
>>> I tried both gdb 9.2-1 and 8.3.1-1.  Here are the results with 9.2-1.
>>>
>> [...]
>>
>> Unfortunately, I think dumper doesn't produce anything useful on x86_64. See 
>> [1] et seq.
> 
> Thanks.  Sorry I didn't notice that people had asked the same question before.
> 
> We should probably fix the documentation:
> 
>    https://cygwin.com/cygwin-ug-net/using-cygwinenv.html
>    https://cygwin.com/cygwin-ug-net/dumper.html
> 
> Or maybe we should just remove all mention of dumper from the documentation.
> Given that we're trying to move people away from 32-bit Cygwin, I don't think it 
> makes sense to document a feature that works only on the latter.

I hesitate to comment when I can't immediately work on this, but, ...making 
dumper work on 64-bit Cygwin is on my TODO list but not right at the top.  It 
would be helpful to keep the program around in its current 32-bit state as a 
template for 64-bit.

Re the documentation, I do think the first example should probably not mention 
dumper, or should parenthetically add "(32-bit only)".  The second example doc 
should say somewhere that the tool is currently 32-bit only.  In addition, the 
current dumper should probably detect when it's running in the wrong environment 
and stop with an error, rather than running as if it's doing something useful.

Whatever is decided for the short term, I can make time to implement that.

..mark

P.S. For the long term, I think it was Jon who suggested dumper generate Windows 
minidumps rather than the current Frankensteinish dumps.  I intend to 
investigate that when I get to this project.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: gdb and core files
  2020-06-30  3:24     ` Mark Geisert
@ 2020-07-01 21:37       ` Jon Turney
  2020-07-03  6:37         ` Mark Geisert
  0 siblings, 1 reply; 6+ messages in thread
From: Jon Turney @ 2020-07-01 21:37 UTC (permalink / raw)
  To: The Cygwin Mailing List; +Cc: Mark Geisert

On 30/06/2020 04:24, Mark Geisert wrote:
> Ken Brown via Cygwin wrote:
>> On 6/28/2020 9:31 AM, Jon Turney wrote:
>>> On 28/06/2020 01:50, Ken Brown via Cygwin wrote:
>>>> Following the instructions at 
>>>> https://cygwin.com/cygwin-ug-net/using-cygwinenv.html, I tried to 
>>>> create a core file that I could examine with gdb, but I apparently 
>>>> ran into a gdb bug. I tried both gdb 9.2-1 and 8.3.1-1.  Here are 
>>>> the results with 9.2-1.
>>>>
>>> [...]
>>>
>>> Unfortunately, I think dumper doesn't produce anything useful on 
>>> x86_64. See [1] et seq.
>>
>> Thanks.  Sorry I didn't notice that people had asked the same question 
>> before.
>>
>> We should probably fix the documentation:
>>
>>    https://cygwin.com/cygwin-ug-net/using-cygwinenv.html
>>    https://cygwin.com/cygwin-ug-net/dumper.html

Yeah, with hindsight, that would have been a good idea.

> I hesitate to comment when I can't immediately work on this, but, 
> ...making dumper work on 64-bit Cygwin is on my TODO list but not right 
> at the top.  It would be helpful to keep the program around in its 
> current 32-bit state as a template for 64-bit.

I had a poke at this problem this week.

[1] https://cygwin.com/pipermail/cygwin-patches/2020q3/010313.html
[2] https://sourceware.org/pipermail/gdb-patches/2020-July/170023.html

> P.S. For the long term, I think it was Jon who suggested dumper generate 
> Windows minidumps rather than the current Frankensteinish dumps.  I 
> intend to investigate that when I get to this project.

Not quite.  There's already a tool ('minidumper') to generate minidumps. 
  But gdb can't read those (yet).

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: gdb and core files
  2020-07-01 21:37       ` Jon Turney
@ 2020-07-03  6:37         ` Mark Geisert
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Geisert @ 2020-07-03  6:37 UTC (permalink / raw)
  To: The Cygwin Mailing List

Jon Turney wrote:
> On 30/06/2020 04:24, Mark Geisert wrote:
>> Ken Brown via Cygwin wrote:
>>> On 6/28/2020 9:31 AM, Jon Turney wrote:
>>>> On 28/06/2020 01:50, Ken Brown via Cygwin wrote:
>>>>> Following the instructions at 
>>>>> https://cygwin.com/cygwin-ug-net/using-cygwinenv.html, I tried to create a 
>>>>> core file that I could examine with gdb, but I apparently ran into a gdb 
>>>>> bug. I tried both gdb 9.2-1 and 8.3.1-1.  Here are the results with 9.2-1.
>>>>>
>>>> [...]
>>>>
>>>> Unfortunately, I think dumper doesn't produce anything useful on x86_64. See 
>>>> [1] et seq.
>>>
>>> Thanks.  Sorry I didn't notice that people had asked the same question before.
>>>
>>> We should probably fix the documentation:
>>>
>>>    https://cygwin.com/cygwin-ug-net/using-cygwinenv.html
>>>    https://cygwin.com/cygwin-ug-net/dumper.html
> 
> Yeah, with hindsight, that would have been a good idea.
> 
>> I hesitate to comment when I can't immediately work on this, but, ...making 
>> dumper work on 64-bit Cygwin is on my TODO list but not right at the top.  It 
>> would be helpful to keep the program around in its current 32-bit state as a 
>> template for 64-bit.
> 
> I had a poke at this problem this week.
> 
> [1] https://cygwin.com/pipermail/cygwin-patches/2020q3/010313.html
> [2] https://sourceware.org/pipermail/gdb-patches/2020-July/170023.html

Ow, I've been ninja'd!  Seriously, nice to see this work.  Great!

>> P.S. For the long term, I think it was Jon who suggested dumper generate 
>> Windows minidumps rather than the current Frankensteinish dumps.  I intend to 
>> investigate that when I get to this project.
> 
> Not quite.  There's already a tool ('minidumper') to generate minidumps.  But 
> gdb can't read those (yet).

Appreciate the correction.  I'll check in when I can spend time on this.
Cheers,

..mark


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-07-03  6:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-28  0:50 gdb and core files Ken Brown
2020-06-28 13:31 ` Jon Turney
2020-06-29 16:03   ` Ken Brown
2020-06-30  3:24     ` Mark Geisert
2020-07-01 21:37       ` Jon Turney
2020-07-03  6:37         ` Mark Geisert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).