public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "mariappan.balraj at gmail dot com" <sourceware-bugzilla@sourceware.org> To: gdb-prs@sourceware.org Subject: [Bug go/30038] New: 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: Tue, 24 Jan 2023 06:54:25 +0000 [thread overview] Message-ID: <bug-30038-4717@http.sourceware.org/bugzilla/> (raw) https://sourceware.org/bugzilla/show_bug.cgi?id=30038 Bug ID: 30038 Summary: 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. Product: gdb Version: 12.1 Status: UNCONFIRMED Severity: critical Priority: P2 Component: go Assignee: unassigned at sourceware dot org Reporter: mariappan.balraj at gmail dot com Target Milestone: --- Following is the source code: //test.go package main /* #include <stdio.h> extern void Test4(void); void test1(void) { Test4(); } void test2(void) { int val = 2; test1(); } void test3(void) { int val = 3; test2(); } */ import "C" func main() { C.test3() } //export.go import "C" //export Test4 func Test4() { panic("Panic inside Test4") } Process crashed because of PANIC from Test4(). test3() is called from GO code. test3() is calling test2() and which is calling test1() and which is calling Test4() Go function. Not seeing test3(), test2() and test1() in the back trace of core dump. This is very important for debugging when CGO is used. #gdb ./test core.242083 //Back trace (gdb) bt #0 runtime.raise () at /usr/local/go/src/runtime/sys_linux_amd64.s:159 #1 0x0000000000443385 in runtime.dieFromSignal (sig=6) at /usr/local/go/src/runtime/signal_unix.go:871 #2 0x000000000044391e in runtime.sigfwdgo (sig=6, info=<optimized out>, ctx=<optimized out>, ~r0=<optimized out>) at /usr/local/go/src/runtime/signal_unix.go:1087 #3 0x0000000000442027 in runtime.sigtrampgo (sig=0, info=0x0, ctx=0x458401 <runtime.raise+33>) at /usr/local/go/src/runtime/signal_unix.go:432 #4 0x00000000004586e6 in runtime.sigtramp () at /usr/local/go/src/runtime/sys_linux_amd64.s:359 #5 <signal handler called> #6 runtime.raise () at /usr/local/go/src/runtime/sys_linux_amd64.s:159 #7 0x0000000000443385 in runtime.dieFromSignal (sig=6) at /usr/local/go/src/runtime/signal_unix.go:871 #8 0x000000000042f9a9 in runtime.crash () at /usr/local/go/src/runtime/signal_unix.go:963 #9 runtime.fatalpanic (msgs=<optimized out>) at /usr/local/go/src/runtime/panic.go:1170 #10 0x000000000042f07a in runtime.gopanic (e=...) at /usr/local/go/src/runtime/panic.go:987 #11 0x000000000045ac07 in main.Test4 () at /home/ubuntu/mbalraj/GO/TEST/TEST4/export.go:7 #12 _cgoexp_040b784f82f8_Test4 (a=<optimized out>) at _cgo_gotypes.go:51 #13 0x0000000000404a82 in runtime.cgocallbackg1 (fn=0x45abe0 <_cgoexp_040b784f82f8_Test4>, frame=0x7fff8d239d27, ctxt=0) at /usr/local/go/src/runtime/cgocall.go:316 #14 0x0000000000404709 in runtime.cgocallbackg (fn=0x45abe0 <_cgoexp_040b784f82f8_Test4>, frame=0x7fff8d239d27, ctxt=0) at /usr/local/go/src/runtime/cgocall.go:235 #15 0x0000000000458d8f in runtime.cgocallbackg (fn=0x45abe0 <_cgoexp_040b784f82f8_Test4>, frame=0x7fff8d239d27, ctxt=0) at <autogenerated>:1 #16 0x0000000000456934 in runtime.cgocallback () at /usr/local/go/src/runtime/asm_amd64.s:994 #17 0x0000000000456600 in ?? () #18 0x0000000000404585 in runtime.cgocall (fn=0x45acb0 <_cgo_040b784f82f8_Cfunc_test3>, arg=0xc000058f70, ~r0=<optimized out>) at /usr/local/go/src/runtime/cgocall.go:168 #19 0x000000000045ab85 in main._Cfunc_test3 (r1=...) at _cgo_gotypes.go:41 #20 0x000000000045abb7 in main.main () at /home/ubuntu/mbalraj/GO/TEST/TEST4/test.go:25 -- You are receiving this mail because: You are on the CC list for the bug.
next reply other threads:[~2023-01-24 6:54 UTC|newest] Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-01-24 6:54 mariappan.balraj at gmail dot com [this message] 2023-01-24 6:55 ` [Bug go/30038] " mariappan.balraj at gmail dot com 2023-01-24 13:09 ` tromey at sourceware dot org 2023-01-25 5:22 ` mariappan.balraj at gmail dot com 2023-02-06 5:51 ` mariappan.balraj at gmail dot com 2023-02-13 9:41 ` mariappan.balraj at gmail dot com 2023-02-14 6:12 ` tromey at sourceware dot org 2023-02-14 6:28 ` mariappan.balraj at gmail dot com 2023-02-14 7:54 ` tromey at sourceware dot org 2023-02-14 10:29 ` mariappan.balraj at gmail dot com 2023-02-14 17:39 ` tromey at sourceware dot org 2023-02-15 5:54 ` mariappan.balraj at gmail dot com 2023-02-15 11:24 ` mariappan.balraj at gmail dot com 2023-02-15 18:17 ` tromey at sourceware dot org 2023-02-16 23:38 ` ian at airs dot com 2023-02-17 1:21 ` tromey at sourceware dot org 2023-02-22 5:10 ` mariappan.balraj at gmail dot com 2023-02-28 1:40 ` tromey at sourceware dot org 2023-04-03 11:59 ` mariappan.balraj 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-30038-4717@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: linkBe 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).