From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 189EC385DC2E; Sat, 26 Jun 2021 13:04:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 189EC385DC2E From: "simark at simark dot ca" 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 13:04:22 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: threads X-Bugzilla-Version: 10.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: simark at simark dot ca X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gdb-prs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-prs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Jun 2021 13:04:23 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D28014 --- Comment #7 from Simon Marchi --- (In reply to Rich from comment #6) > (In reply to Simon Marchi from comment #5) > > 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. >=20=20 > Lovely. Actually, the bug is in svr4_exec_displacement, which doesn't find the executable displacement correctly. I now use the following hack instead: >>From fa346c1961e206a67ccad84c13c0d9f3a1217bfc Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Sat, 26 Jun 2021 00:16:55 -0400 Subject: [PATCH] fix Change-Id: I0d90e5432a5a998840dae7446bfcdb8995cf0297 --- gdb/solib-svr4.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index a8a7d1171dc6..215d3f3a2250 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -2574,6 +2574,9 @@ svr4_exec_displacement (CORE_ADDR *displacementp) a call to gdbarch_convert_from_func_ptr_addr. */ CORE_ADDR entry_point, exec_displacement; + *displacementp =3D 0x0000004000000000; + return 1; + if (current_program_space->exec_bfd () =3D=3D NULL) return 0; --=20 2.32.0 > > 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 pack= age, > > which I think should be found here: > >=20 > > http://debug.mirrors.debian.org/debian-debug/pool/main/g/glibc/ > >=20 > > 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 t= he > > packages. Do you have an idea? >=20 > I think you're getting burned because glibc is one of the ones that (for > legacy reasons, now that $RELEASE-debug is a thing? I'm unsure.) gets sho= ved > in a -dbg package in the main repos. gdb finds those symbols and loads th= em > for me, even as everything else horfs; I haven't tried recompiling gdb wi= th > that patch, though. Ah, got it. libc6-dbg has the right file. So I got this backtrace: (gdb) bt #0 __GI_raise (sig=3D) at ../sysdeps/unix/sysv/linux/raise.= c:50 #1 0x000000400312fa50 in __GI_abort () at abort.c:79 #2 0x00000040005ce440 in dump_core () at /build/gdb-OSO7kB/gdb-10.1/gdb/utils.c:204 #3 0x00000040005d4ea0 in internal_vproblem (problem=3D, file=3D, line=3D, fmt=3D, ap= =3D) at /build/gdb-OSO7kB/gdb-10.1/gdb/utils.c:424 #4 0x00000040005d5234 in internal_verror (file=3D, line=3D, fmt=3D, ap=3D) at /build/gdb-OSO7kB/gdb-10.1/gdb/utils.c:439 #5 0x00000040007b3000 in internal_error (file=3D, line=3D, fmt=3D) at /build/gdb-OSO7kB/gdb-10.1/gdbsupport/errors.cc:55 #6 0x0000004000586ebc in inferior_thread () at /build/gdb-OSO7kB/gdb-10.1/gdb/thread.c:93 #7 inferior_thread () at /build/gdb-OSO7kB/gdb-10.1/gdb/thread.c:93 #8 0x000000400039c748 in print_stop_event (uiout=3D0x4000b795f0, displays=3D) at /build/gdb-OSO7kB/gdb-10.1/gdb/infrun.c:8136 #9 0x00000040005b1288 in tui_on_normal_stop (bs=3D, print_frame=3D) at /build/gdb-OSO7kB/gdb-10.1/gdb/tui/tui-interp.c:98 #10 0x00000040003a00f4 in std::function::operator()(bpstats*, int) const (__args#1=3D, __args#= 0=3D0x0, this=3D0x4000bfd530) at /usr/include/c++/10/bits/std_function.h:622 #11 gdb::observers::observable::notify (args#1=3D1, args#0= =3D0x0, this=3D) at /build/gdb-OSO7kB/gdb-10.1/gdb/../gdbsupport/observable.h:106 #12 normal_stop () at /build/gdb-OSO7kB/gdb-10.1/gdb/infrun.c:8407 #13 0x00000040003a9674 in fetch_inferior_event () at /build/gdb-OSO7kB/gdb-10.1/gdb/infrun.c:3967 #14 0x00000040003858ac in inferior_event_handler (event_type=3D) at /build/gdb-OSO7kB/gdb-10.1/gdb/inf-loop.c:42 #15 0x00000040004d0664 in remote_async_serial_handler (scb=3D, context=3D) at /build/gdb-OSO7kB/gdb-10.1/gdb/remote.c:14160 #16 0x0000004000503afc in run_async_handler_and_reschedule (scb=3D0x4025424= 390) at /build/gdb-OSO7kB/gdb-10.1/gdb/ser-base.c:137 #17 0x00000040007b37f8 in gdb_wait_for_event (block=3D) at /build/gdb-OSO7kB/gdb-10.1/gdbsupport/event-loop.cc:673 #18 0x00000040007b3c18 in gdb_wait_for_event (block=3D1) at /build/gdb-OSO7kB/gdb-10.1/gdbsupport/event-loop.cc:569 #19 gdb_do_one_event () at /build/gdb-OSO7kB/gdb-10.1/gdbsupport/event-loop.cc:215 #20 0x00000040003eb1e0 in start_event_loop () at /build/gdb-OSO7kB/gdb-10.1/gdb/main.c:356 #21 captured_command_loop () at /build/gdb-OSO7kB/gdb-10.1/gdb/main.c:416 #22 0x00000040003efa6c in captured_main (data=3D) at /build/gdb-OSO7kB/gdb-10.1/gdb/main.c:1253 #23 gdb_main (args=3D) at /build/gdb-OSO7kB/gdb-10.1/gdb/main.c:1268 #24 0x00000040001b6d10 in main (argc=3D, argv=3D) at /build/gdb-OSO7kB/gdb-10.1/gdb/gdb.c:32 --=20 You are receiving this mail because: You are on the CC list for the bug.=