Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jon Turney <jon.turney@dronecode.org.uk>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simark@simark.ca>
Subject: Re: [PATCH 1/4] Add sniffer for Cygwin x86_64 core dumps
Date: Fri, 21 Aug 2020 16:25:02 +0100	[thread overview]
Message-ID: <9c6ae1b6-c8b2-6219-1e2a-ed4954350fb1@dronecode.org.uk> (raw)
In-Reply-To: <e3286e62-7ee8-01a1-2fc3-dd3e28fcbf57@simark.ca>

On 20/08/2020 23:20, Simon Marchi wrote:
> On 2020-08-12 3:18 p.m., Jon Turney wrote:
>> Similarly to existing i386_cygwin_core_osabi_sniffer()
>>
>> gdb/ChangeLog:
>>
>> 2020-07-01  Jon Turney  <jon.turney@dronecode.org.uk>
>>
>> 	* amd64-windows-tdep.c (amd64_cygwin_core_osabi_sniffer): New.
>> 	(_initialize_amd64_windows_tdep): Register amd64_cygwin_core_osabi_sniffer.
> 
> Hi Jon,
> 
> I am trying to test this using these steps:

Wow.  Thanks for testing.

> 1. Write a dummy C program that just sleeps in Cygwin, compile it (gcc test.c -g3 -O0) and run it
> 2. Run "dumper" on it

The "dumper" currently shipping in x86_64 Cygwin is utterly broken. (See 
[1] et seq.).

If you use "dumper" from the latest snapshot [2], you may have more success

[1] 
https://cygwin.com/git/?p=newlib-cygwin.git;a=commitdiff;h=7dd1b08836e8a7bb37d330995096540afce152a0;hp=38f88601469f4a6ab7cf42e1f076775c99eb17f2
[2] https://cygwin.com/snapshots/

> 3. Load it in GDB (back on my amd64 Linux host)
> 
> I get this in step 3:
> 
> $ ./gdb --data-directory=data-directory -nx -q ~/a.exe
> Reading symbols from /home/simark/a.exe...
> (gdb) core ~/core.core
> BFD: BFD (GNU Binutils) 2.35.50.20200820 internal error, aborting at /home/simark/src/binutils-gdb/bfd/bfd.c:1311 in _bfd_doprnt_scan
> 
> BFD: Please report this bug.
> 
> This happens while BFD encounters an error and tries to print this format string:
> 
>    "%pB: win32pstatus NOTE_INFO_MODULE of size %lu is too small to contain a name of size %zu"
> 
> _bfd_doprnt_scan aborts because it doesn't like the z length modifier:
> 
> (top-gdb) p ptr[-1]
> $2 = 122 'z'
> 
> So there are two issues here:
> 
> 1. The actual error, the note being too small for the name.  If I go up in
>     elfcore_grok_win32pstatus, the name_size doesn't make sense:
> 
>     (top-gdb) p name_size
>     $9 = 4194304
> 
>     whereas the note size makes sense:
> 
>     (top-gdb) p note->descsz
>     $10 = 1276

This should be resolved by using a fixed "dumper".

> 2. The internal error from trying to print that error message

Clearly, I shouldn't be using '%zu' here, so I'll make a patch to fix 
that (once I work out what I should be using :) )


  reply	other threads:[~2020-08-21 15:25 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-12 19:18 [PATCH 0/4] Add gdb support for Cygwin x86_64 core dumps (v2) Jon Turney
2020-08-12 19:18 ` [PATCH 1/4] Add sniffer for Cygwin x86_64 core dumps Jon Turney
2020-08-20 22:20   ` Simon Marchi
2020-08-21 15:25     ` Jon Turney [this message]
2020-08-21 16:22       ` Simon Marchi
2020-08-21 16:28         ` Jon Turney
2020-08-22 19:41           ` Simon Marchi
2020-08-22 19:52             ` Jon Turney
2020-08-24 15:47               ` Simon Marchi
2020-08-24 17:02                 ` Jon Turney
2020-08-12 19:18 ` [PATCH 2/4] Add amd64_windows_gregset_reg_offset Jon Turney
2020-08-20 22:08   ` Simon Marchi
2020-09-18 16:31     ` Jon Turney
2020-08-12 19:18 ` [PATCH 3/4] Promote windows_core_xfer_shared_libraries and windows_core_pid_to_str Jon Turney
2020-08-12 19:18 ` [PATCH 4/4] Add handling for 64-bit module addresses in Cygwin core dumps Jon Turney
2020-08-24 18:34   ` Simon Marchi
2020-09-15 21:44     ` Jon Turney
2020-09-16  2:20       ` Simon Marchi
2020-09-16  9:15         ` Christian Biesinger
2020-08-12 19:30 ` [PATCH 0/4] Add gdb support for Cygwin x86_64 core dumps (v2) Eli Zaretskii
2020-08-13 14:43   ` Jon Turney
2020-08-13 16:48     ` Eli Zaretskii
2020-08-18 15:32       ` Jon Turney
2020-08-18 16:15         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9c6ae1b6-c8b2-6219-1e2a-ed4954350fb1@dronecode.org.uk \
    --to=jon.turney@dronecode.org.uk \
    --cc=gdb-patches@sourceware.org \
    --cc=simark@simark.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox