From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 087533858C54; Wed, 22 Feb 2023 05:10:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 087533858C54 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1677042639; bh=vAYV7cGKyY0f6b81wzq1e0mIojjdASLiJbFA2HWyvoI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=PXI3OgMZ4y6CwD/O+Cd4ncsrxYOqwmOmdaeK1Y9ONiQ+PnUd7+hm5A1F7GzmzjvsJ D6rpmDn0nJK20ZRUGN6foil+dKeKzLOWsAv7xcHqF+bZ/AI+FwJVtTSaA05ivk/qqA Mb7lvmzl+P/qvKAySJxRsrDcrk7GnmA3AZxAkJJQ= From: "mariappan.balraj at gmail dot com" 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: Wed, 22 Feb 2023 05:10:38 +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: mariappan.balraj at gmail dot com 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 #15 from mariappan balraj -= -- Hi Tromey, Ian mentioned that "gccgo is not as well supported as the gc compiler". https://github.com/golang/go/issues/57698 Is it possible to provide support from GDB to decode BT when the Go compiler is used? If you can give guidance and direction then it may be possible for me to contribute? Eagerly waiting for your strong support to resolve this issue. Go compiler(GC) can be invoked by using build option -compiler gc. Optimization and inlining can be disabled by using the following command. CGO_CFLAGS=3D"-g" go build -compiler gc -gcflags=3Dall=3D"-N -l" . Best Regards Mariappan On Fri, Feb 17, 2023 at 6:51 AM tromey at sourceware dot org < sourceware-bugzilla@sourceware.org> wrote: > 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 > #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. > > -- > You are receiving this mail because: > You are on the CC list for the bug. > You reported the bug. --=20 You are receiving this mail because: You are on the CC list for the bug.=