From: Kamil Rytarowski <n54@gmx.com>
To: Simon Marchi <simark@simark.ca>, gdb-patches@sourceware.org
Cc: tom@tromey.com
Subject: Re: [PATCH v4] Disable get_ptrace_pid for NetBSD
Date: Thu, 19 Mar 2020 16:51:18 +0100 [thread overview]
Message-ID: <06b42cfb-3d53-cbfe-e7db-fafda1adaa47@gmx.com> (raw)
In-Reply-To: <6e74c142-d3e7-6fd8-b765-594931be898b@simark.ca>
[-- Attachment #1.1: Type: text/plain, Size: 1706 bytes --]
On 19.03.2020 16:30, Simon Marchi wrote:
> On 2020-03-19 8:55 a.m., Simon Marchi wrote:
>> On 2020-03-19 8:28 a.m., Kamil Rytarowski wrote:
>>> Unlike most other Operating Systems, NetBSD tracks both pid and lwp.
>>> The process id on NetBSD is stored always in the pid field of ptid.
>>>
>>> gdb/ChangeLog:
>>>
>>> * inf-ptrace.h: Disable get_ptrace_pid on NetBSD.
>>> * inf-ptrace.c: Likewise.
>>> * (gdb_ptrace): Add.
>>> * (inf_ptrace_target::resume): Update.
>>> * (inf_ptrace_target::xfer_partial): Likewise.
>>> * (inf_ptrace_peek_poke): Change argument `pid' to `ptid'.
>>> * (inf_ptrace_peek_poke): Update.
>>
>> Hmm, this breaks simple debugging on Linux:
>>
>> $ ./gdb --data-directory=data-directory a.out -ex start
>> Reading symbols from a.out...
>> Temporary breakpoint 1 at 0x4004da: file test.c, line 2.
>> Starting program: /home/smarchi/build/binutils-gdb/gdb/a.out
>>
>> Program received signal SIGILL, Illegal instruction.
>> 0x00007ffff7dda96d in dl_main (phdr=<optimized out>, phnum=<optimized out>, user_entry=<optimized out>, auxv=<optimized out>) at rtld.c:1517
>> 1517 rtld.c: No such file or directory.
>>
>>
>> I haven't figured out why by inspecting the code yet, I'll try to debug it later today.
>>
>> Simon
>>
>
> Ah, it's because ptrace returns long and not int on GNU/Linux. So when we want to read
> a 64-bits word from memory, it gets truncated. gdb_ptrace should return PTRACE_TYPE_RET.
>
> In fact, to be consistent, all these gdb_ptrace functions should be changed to return
> PTRACE_TYPE_RET (as a separate patch).
>
Done in v5.
I will follow up with other gdb_ptrace() instances next.
> Simon
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2020-03-19 15:52 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-18 21:49 [PATCH] " Kamil Rytarowski
2020-03-18 21:51 ` Kamil Rytarowski
2020-03-18 21:55 ` [PATCH v2] " Kamil Rytarowski
2020-03-18 22:21 ` Simon Marchi
2020-03-18 23:30 ` Kamil Rytarowski
2020-03-18 23:16 ` [PATCH v3] " Kamil Rytarowski
2020-03-19 1:13 ` Simon Marchi
2020-03-19 12:01 ` Kamil Rytarowski
2020-03-19 12:28 ` [PATCH v4] " Kamil Rytarowski
2020-03-19 12:55 ` Simon Marchi
2020-03-19 15:30 ` Simon Marchi
2020-03-19 15:51 ` Kamil Rytarowski [this message]
2020-03-20 15:50 ` Tom Tromey
2020-03-19 15:45 ` [PATCH v5] " Kamil Rytarowski
2020-03-19 19:27 ` Simon Marchi
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=06b42cfb-3d53-cbfe-e7db-fafda1adaa47@gmx.com \
--to=n54@gmx.com \
--cc=gdb-patches@sourceware.org \
--cc=simark@simark.ca \
--cc=tom@tromey.com \
/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