public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Tom de Vries <tdevries@suse.de>,
	Simon Marchi <simon.marchi@efficios.com>,
	gdb-patches@sourceware.org
Cc: "Metzger, Markus T" <markus.t.metzger@intel.com>
Subject: Re: [PATCH 1/2] gdb: call frame unwinders' dealloc_cache methods through destroying the frame cache
Date: Thu, 9 Feb 2023 14:53:44 -0500	[thread overview]
Message-ID: <8398b742-6684-a60b-9ee5-fa70dd8991b2@simark.ca> (raw)
In-Reply-To: <b2b562dc-eead-08a2-9f39-baf2ebfd2ac4@suse.de>

On 2/9/23 07:42, Tom de Vries via Gdb-patches wrote:
> On 2/9/23 08:40, Tom de Vries wrote:
>> On 1/30/23 21:02, Simon Marchi via Gdb-patches wrote:
>>> Currently, some frame resources are deallocated by iterating on the
>>> frame chain (starting from the sentinel), calling dealloc_cache.  The
>>> problem is that user-created frames are not part of that chain, so we
>>> never call dealloc_cache for them.
>>>
>>> I propose to make it so the dealloc_cache callbacks are called when the
>>> frames are removed from the frame_stash hash table, by registering a
>>> deletion function to the hash table.  This happens when
>>> frame_stash_invalidate is called by reinit_frame_cache.  This way, all
>>> frames registered in the cache will get their unwinder's dealloc_cache
>>> callbacks called.
>>>
>>> Note that at the moment, the sentinel frames are not registered in the
>>> cache, so we won't call dealloc_cache for them.  However, it's just a
>>> theoritical problem, because the sentinel frame unwinder does not
>>> provide this callback.  Also, a subsequent patch will change things so
>>> that sentinel frames are registered to the cache.
>>>
>>> I moved the obstack_free / obstack_init pair below the
>>> frame_stash_invalidate call in reinit_frame_cache, because I assumed
>>> that some dealloc_cache would need to access some data on that obstack,
>>> so it would be better to free it after clearing the hash table.
>>>
>>
>> For me this causes:
>> ...
>> (gdb) PASS: gdb.btrace/record_goto.exp: instruction-history from 19 forwards
>> record goto 27^M
>> /data/vries/gdb/src/gdb/record-btrace.c:1654: internal-error: bfcache_new: Assertion `*slot == NULL' failed.^M
>> A problem internal to GDB has been detected,^M
>> further debugging may prove unreliable.^M
>> ----- Backtrace -----^M
>> FAIL: gdb.btrace/record_goto.exp: record goto 27 (GDB internal error)
>> ...
>>
>> Note that I've been having some problems with btrace tests, possible related to cpu/kernel combination (PRs 30073 and 30075), so this may be difficult to reproduce, I'm not sure.
>>
> 
> I also managed to reproduce this on openSUSE Tumbleweed, which doesn't show the problems with btrace tests, so I'm hoping this is easy to reproduce.
> 
> Thanks,
> - Tom

Thanks for reporting.  I managed to reproduce on gcc13 (I only have
computers with AMD cpus at the moment, so I can't run the btrace tests).

I sent a patch, the explications of the cause and proposed solution are
there:

  https://inbox.sourceware.org/gdb-patches/20230209195037.100368-1-simon.marchi@efficios.com/T/#u

Simon

  reply	other threads:[~2023-02-09 19:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-30 20:02 [PATCH 0/2] Fix gdb.base/frame-view.exp on AArch64 Simon Marchi
2023-01-30 20:02 ` [PATCH 1/2] gdb: call frame unwinders' dealloc_cache methods through destroying the frame cache Simon Marchi
2023-02-09  7:40   ` Tom de Vries
2023-02-09 12:42     ` Tom de Vries
2023-02-09 19:53       ` Simon Marchi [this message]
2023-01-30 20:02 ` [PATCH 2/2] gdb: give sentinel for user frames distinct IDs, register sentinel frames to " Simon Marchi
2023-02-07 17:02   ` Alexandra Petlanova Hajkova
2023-02-08 21:37     ` Simon Marchi
2023-02-08 17:05   ` Luis Machado
2023-02-08 21:38     ` 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=8398b742-6684-a60b-9ee5-fa70dd8991b2@simark.ca \
    --to=simark@simark.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=markus.t.metzger@intel.com \
    --cc=simon.marchi@efficios.com \
    --cc=tdevries@suse.de \
    /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).