public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@palves.net>
To: Luis Machado <luis.machado@arm.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 0/2] Fix gdbserver/linux memory access regression
Date: Wed, 4 May 2022 10:45:47 +0100	[thread overview]
Message-ID: <51c7d9e9-7d84-f826-be2d-be559847da9b@palves.net> (raw)
In-Reply-To: <d823d74b-62ce-12f5-b224-6f80d6ad0925@arm.com>

On 2022-05-04 10:42, Luis Machado wrote:
> On 5/4/22 10:11, Luis Machado via Gdb-patches wrote:
>> On 5/3/22 15:24, Pedro Alves wrote:
>>> On 2022-04-19 23:47, Pedro Alves wrote:
>>>> The recent change to make GDBserver always access memory via
>>>> /proc/pid/mem caused a regression in
>>>> gdb.threads/access-mem-running-thread-exit.exp that I somehow missed.
>>>> This is actually a pre-existing GDBserver issue being now exposed.
>>>>
>>>> Patch #2 fixes the GDBserver bug.
>>>>
>>>> Patch #1 fixes the gdb.threads/access-mem-running-thread-exit.exp
>>>> testcase itself -- it doesn't run properly against
>>>> --target_board=native-extended-gdbserver today.
>>>>
>>>
>>> I'm pushing this in.
>>
>> Just a heads-up, this seems to have regressed a few gdb.multi/*.exp tests for aarch64-linux.
>>
>> I see the following internal error for gdb.multi/multi-target-continue.exp for example:
>>
>> Starting program: binutils-gdb/gdb/testsuite/outputs/gdb.multi/multi-target-continue/multi-target-continue ^M
>> Error in re-setting breakpoint 2: Remote connection closed^M
>> ../../../repos/binutils-gdb/gdb/thread.c:85: internal-error: inferior_thread: Assertion `current_thread_ != nullptr' failed.^M
>> A problem internal to GDB has been detected,^M
>> further debugging may prove unreliable.
>>
>> I haven't investigated this yet.
> 
> Ok. I tracked this down to gdbserver crashing when trying to fetch the register cache using a nullptr for the thread pointer. This happens when trying to read memory, then the backend goes to try to figure out if it is 64-bit and then eventually tries to fetch the regcache with current_thread (nullptr).
> 
> I'm guessing we should really be using the process pointer if there isn't a valid thread pointer to fetch the register data.
> 

Can you show a backtrace?  If this is when reading memory, what code cares whether it's 64-bit?  Reading memory
out of /proc/pid/mem should not care about that.

  reply	other threads:[~2022-05-04  9:45 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-19 22:47 Pedro Alves
2022-04-19 22:47 ` [PATCH 1/2] Fix gdb.threads/access-mem-running-thread-exit.exp w/ native-extended-gdbserver Pedro Alves
2022-04-19 22:47 ` [PATCH 2/2] gdbserver: track current process as well as current thread Pedro Alves
2023-04-25 13:57   ` Andrew Burgess
2023-04-26  6:35     ` Aktemur, Tankut Baris
2023-06-19 16:46       ` Aktemur, Tankut Baris
2023-06-22 17:49       ` Andrew Burgess
2023-06-28  8:39         ` Aktemur, Tankut Baris
2022-05-03 14:24 ` [PATCH 0/2] Fix gdbserver/linux memory access regression Pedro Alves
2022-05-04  9:11   ` Luis Machado
2022-05-04  9:42     ` Luis Machado
2022-05-04  9:45       ` Pedro Alves [this message]
2022-05-04  9:52         ` Luis Machado
2022-05-04 10:14           ` Pedro Alves
2022-05-04 13:44             ` Pedro Alves
2022-05-04 14:03               ` Luis Machado

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=51c7d9e9-7d84-f826-be2d-be559847da9b@palves.net \
    --to=pedro@palves.net \
    --cc=gdb-patches@sourceware.org \
    --cc=luis.machado@arm.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).