public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/30547] [gdb, s390x, ppc64] segfault in for_each_block
Date: Tue, 31 Oct 2023 15:53:18 +0000	[thread overview]
Message-ID: <bug-30547-4717-OierZnvxuS@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-30547-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=30547

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
I set a watchpoint:
...
(gdb) p reg_obj
$3 = (registry<address_space> *) 0x12ee2e80
(gdb) p *reg_obj
$4 = {m_fields = std::vector of length 1, capacity 1 = {0x0}}
(gdb) what *reg_obj
type = registry<address_space>
(gdb) p *(registry<address_space> *) 0x12ee2e80
$5 = {m_fields = std::vector of length 1, capacity 1 = {0x0}}
(gdb) watch *(registry<address_space> *) 0x12ee2e80
Watchpoint 2: *(registry<address_space> *) 0x12ee2e80
...
and ran into:
...
Watchpoint 2: *(registry<address_space> *) 0x12ee2e80

Old value = {m_fields = std::vector of length 1, capacity 1 = {0x13322180}}
New value = {m_fields = std::vector of length 39665389, capacity 39665389 =
{<error reading variable>
0x00003fffb738b4f0 in .__libc_free () from /lib64/libc.so.6
(gdb) bt
#0  0x00003fffb738b4f0 in .__libc_free () from /lib64/libc.so.6
#1  0x000000001176e760 in operator delete (p=0x12ee2e80) at
/home/vries/gdb/src/gdbsupport/new-op.cc:109
#2  0x00000000108fffa8 in program_space::~program_space (this=0x13312100,
__in_chrg=<optimized out>)
    at /home/vries/gdb/src/gdb/progspace.c:125
#3  0x000000001068e44c in delete_inferior (inf=0x13327290) at
/home/vries/gdb/src/gdb/inferior.c:290
#4  0x000000001068ef6c in prune_inferiors () at
/home/vries/gdb/src/gdb/inferior.c:480
#5  0x00000000106a72d4 in fetch_inferior_event () at
/home/vries/gdb/src/gdb/infrun.c:4558
#6  0x0000000010672994 in inferior_event_handler (event_type=INF_REG_EVENT) at
/home/vries/gdb/src/gdb/inf-loop.c:42
#7  0x000000001071bef0 in handle_target_event (error=0, client_data=0x0) at
/home/vries/gdb/src/gdb/linux-nat.c:4243
#8  0x0000000011764ec8 in handle_file_event (file_ptr=0x1311beb0, ready_mask=1)
    at /home/vries/gdb/src/gdbsupport/event-loop.cc:573
#9  0x00000000117654a0 in gdb_wait_for_event (block=0) at
/home/vries/gdb/src/gdbsupport/event-loop.cc:694
#10 0x0000000011763ac8 in gdb_do_one_event (mstimeout=-1) at
/home/vries/gdb/src/gdbsupport/event-loop.cc:217
#11 0x0000000010c5936c in wait_sync_command_done () at
/home/vries/gdb/src/gdb/top.c:427
#12 0x0000000010c59470 in maybe_wait_sync_command_done (was_sync=0) at
/home/vries/gdb/src/gdb/top.c:444
#13 0x0000000010c59c08 in execute_command (p=0x1329c830 "", from_tty=0) at
/home/vries/gdb/src/gdb/top.c:577
#14 0x0000000010576c60 in command_handler (command=0x1329c828 "continue") at
/home/vries/gdb/src/gdb/event-top.c:552
#15 0x0000000010c58f90 in read_command_file (stream=0x12ff05b0) at
/home/vries/gdb/src/gdb/top.c:342
#16 0x0000000010323214 in script_from_file (stream=0x12ff05b0, 
    file=0x3ffffffff6a2
"./build/gdb/testsuite/outputs/gdb.base/vfork-follow-parent/gdb.in.2")
    at /home/vries/gdb/src/gdb/cli/cli-script.c:1642
#17 0x00000000102f99c8 in source_script_from_stream (stream=0x12ff05b0, 
    file=0x3ffffffff6a2
"./build/gdb/testsuite/outputs/gdb.base/vfork-follow-parent/gdb.in.2", 
    file_to_open=0x12f57e28
"./build/gdb/testsuite/outputs/gdb.base/vfork-follow-parent/gdb.in.2")
    at /home/vries/gdb/src/gdb/cli/cli-cmds.c:730
#18 0x00000000102f9b94 in source_script_with_search (
    file=0x3ffffffff6a2
"./build/gdb/testsuite/outputs/gdb.base/vfork-follow-parent/gdb.in.2",
from_tty=0, 
    search_path=0) at /home/vries/gdb/src/gdb/cli/cli-cmds.c:775
---Type <return> to continue, or q <return> to quit---
#19 0x00000000102f9c7c in source_script (
    file=0x3ffffffff6a2
"./build/gdb/testsuite/outputs/gdb.base/vfork-follow-parent/gdb.in.2",
from_tty=0)
    at /home/vries/gdb/src/gdb/cli/cli-cmds.c:784
#20 0x000000001078c7c4 in catch_command_errors (command=@0x12867548: 0x102f9c44
<source_script(char const*, int)>, 
    arg=0x3ffffffff6a2
"./build/gdb/testsuite/outputs/gdb.base/vfork-follow-parent/gdb.in.2",
from_tty=0, 
    do_bp_actions=false) at /home/vries/gdb/src/gdb/main.c:513
#21 0x000000001078cadc in execute_cmdargs (cmdarg_vec=0x3fffffffec18,
file_type=CMDARG_FILE, 
    cmd_type=CMDARG_COMMAND, ret=0x3fffffffec48) at
/home/vries/gdb/src/gdb/main.c:610
#22 0x000000001078e848 in captured_main_1 (context=0x3fffffffeee0) at
/home/vries/gdb/src/gdb/main.c:1293
#23 0x000000001078eb1c in captured_main (data=0x3fffffffeee0) at
/home/vries/gdb/src/gdb/main.c:1314
#24 0x000000001078ec14 in gdb_main (args=0x3fffffffeee0) at
/home/vries/gdb/src/gdb/main.c:1343
#25 0x000000001001a180 in main (argc=8, argv=0x3ffffffff358) at
/home/vries/gdb/src/gdb/gdb.c:39
(gdb) 
...

So, AFAIU we have program_space::~program_space:
...
  if (!gdbarch_has_shared_address_space (target_gdbarch ()))
    delete this->aspace;
...
which calls the address space destructor, which deletes:
...
  /* Per aspace data-pointers required by other GDB modules.  */
  registry<address_space> registry_fields;
...
which invalidates:
...
static const registry<address_space>::key<DCACHE, dcache_deleter>
  target_dcache_aspace_key;
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2023-10-31 15:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-13 13:16 [Bug gdb/30547] New: [gdb, s390x] " vries at gcc dot gnu.org
2023-10-31  8:02 ` [Bug gdb/30547] [gdb, s390x, ppc64] " vries at gcc dot gnu.org
2023-10-31  8:28 ` vries at gcc dot gnu.org
2023-10-31 15:53 ` vries at gcc dot gnu.org [this message]
2023-11-01  9:42 ` vries at gcc dot gnu.org
2023-11-01  9:56 ` vries at gcc dot gnu.org
2023-11-02 10:49 ` vries at gcc dot gnu.org
2023-11-04 15:57 ` vries at gcc dot gnu.org
2023-11-28  9:31 ` cvs-commit at gcc dot gnu.org
2023-11-28  9:31 ` cvs-commit at gcc dot gnu.org
2023-11-28  9:54 ` vries at gcc dot gnu.org

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=bug-30547-4717-OierZnvxuS@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /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).