public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "simark at simark dot ca" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug threads/28014] gdb coredumps when remote+kgdbing a system that OOMs too hard
Date: Sat, 26 Jun 2021 04:27:49 +0000	[thread overview]
Message-ID: <bug-28014-4717-rAxHybKB3v@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-28014-4717@http.sourceware.org/bugzilla/>

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

--- Comment #5 from Simon Marchi <simark at simark dot ca> ---
It dug a little bit.  I checked why GDB couldn't see any shared library, I
think there's a little bug in the MIPS-specific code where GDB uses a
MIPS-specific auxv entry to locate the base of the runtime loader.  It doesn't
take into account the main executable's runtime address.

With the hack below, I can get a shared library list.  I then idenfitied that
the current PC was in libc, so I downloaded and extracted
libc6_2.31-12_mips64el.deb in my sysroot.  The backtrace becomes a bit better:

(gdb) bt
#0  0x0000004003148b4c in raise () from
/tmp/investigation/lib/mips64el-linux-gnuabi64/libc.so.6
#1  0x000000400312fa50 in abort () from
/tmp/investigation/lib/mips64el-linux-gnuabi64/libc.so.6
Backtrace stopped: frame did not save the PC

To get further, we would need libc's debug info.  I tried to find debug info
for libc.so.6 but can't find it.  It's supposed to be in the libc6 package,
which I think should be found here:

http://debug.mirrors.debian.org/debian-debug/pool/main/g/glibc/

But I can't find the debug package corresponding to libc6_2.31-12_mips64el.deb.
The libc's build-id is 59aa6ff984aff00883acda7feef7613cce475991, I can't find
that in any of the packages.  Do you have an idea?

>From a52228d3bb10cc6d1f6d748d22ee8a4cabff3304 Mon Sep 17 00:00:00 2001
From: Simon Marchi <simon.marchi@polymtl.ca>
Date: Sat, 26 Jun 2021 00:16:55 -0400
Subject: [PATCH] fix

Change-Id: I0d90e5432a5a998840dae7446bfcdb8995cf0297
---
 gdb/solib-svr4.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index a8a7d1171dc6..d60427cd46bc 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -798,7 +798,7 @@ elf_locate_base (void)
       pbuf = (gdb_byte *) alloca (pbuf_size);
       /* DT_MIPS_RLD_MAP_REL contains an offset from the address of the
         DT slot to the address of the dynamic link structure.  */
-      if (target_read_memory (dyn_ptr + dyn_ptr_addr, pbuf, pbuf_size))
+      if (target_read_memory (dyn_ptr + dyn_ptr_addr + 0x4000000000, pbuf,
pbuf_size))
        return 0;
       return extract_typed_address (pbuf, ptr_type);
     }
-- 
2.32.0

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

  parent reply	other threads:[~2021-06-26  4:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-25 23:43 [Bug threads/28014] New: " rincebrain at gmail dot com
2021-06-26  1:20 ` [Bug threads/28014] " simark at simark dot ca
2021-06-26  2:15 ` rincebrain at gmail dot com
2021-06-26  2:29 ` simark at simark dot ca
2021-06-26  2:41 ` rincebrain at gmail dot com
2021-06-26  4:27 ` simark at simark dot ca [this message]
2021-06-26 10:55 ` rincebrain at gmail dot com
2021-06-26 13:04 ` simark at simark dot ca
2021-06-27  5:27 ` simark at simark dot ca
2021-06-27 12:24 ` rincebrain at gmail dot com

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-28014-4717-rAxHybKB3v@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).