From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 194573858412; Fri, 17 Feb 2023 01:21:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 194573858412 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1676596870; bh=4XFjsVDPiQnk29sc7umZB5Lr3fohtAD2nroCGxDFCAg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=j6OpAyct9TLkUKTMPyOZrMl2kANwsqjU+KTg8aA48lrL4s9TSKVZ1aAM+e3H45Fcz Sh+jE4gdo3PZB1rst4VH6NE18u1m6bSeKLIUhA3B2I9dp4s5rlf+BBYJkRwr3xlHi/ lcCWL+6Gg+dCJj4DH7rrVXgq44IqydHWu9cmSW2M= From: "tromey at sourceware dot org" To: gdb-prs@sourceware.org Subject: [Bug go/30038] When using CGO and C code is calling GO function, not getting call stack of C from core dump. Only getting call stack of GO. Date: Fri, 17 Feb 2023 01:21:09 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: go X-Bugzilla-Version: 12.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: critical X-Bugzilla-Who: tromey at sourceware dot org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 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 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D30038 --- Comment #14 from Tom Tromey --- Thanks Ian. Looking into it a little bit, I think these functions are just being optimized out: (gdb) down=20 #19 0x00000000004041a5 in runtime.cgocall (fn=3D0x4582e0 <_cgo_5bc4e3e20e89_Cfunc_test3>, arg=3D0xc00005af70, ~r0=3D) at /usr/lib/golang/src/runtime/cgocall.go:167 167 errno :=3D asmcgocall(fn, arg) (gdb) p fn $1 =3D (void *) 0x4582e0 <_cgo_5bc4e3e20e89_Cfunc_test3> Let's look at that: (gdb) disassemble 0x4582e0 Dump of assembler code for function _cgo_5bc4e3e20e89_Cfunc_test3: 0x00000000004582e0 <+0>: jmp 0x4582d0 End of assembler dump. That jumps to: (gdb) disassemble 0x4582d0 Dump of assembler code for function test3: 0x00000000004582d0 <+0>: jmp 0x4582c0 End of assembler dump. So, looks like tail calls to me. I do see this frame: #20 0x00000000004581e5 in main._Cfunc_test3 (r1=3D...) at _cgo_gotypes.go:41 which I feel proves that C functions can show up in the bt. Just to be really clear here, I know nothing about go and even less about non-gcc go. This code in gdb is essentially unmaintained. I don't even know if it was written to assume gccgo or golang-go. --=20 You are receiving this mail because: You are on the CC list for the bug.=