Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime: program with -buildmode=c-archive hangs when c side crashes. (darwin/amd64) #10783

Closed
hyangah opened this issue May 11, 2015 · 3 comments

Comments

@hyangah
Copy link
Contributor

hyangah commented May 11, 2015

Expectation: the program would crash.

Observation: When c-side crashes, the program hangs indefinitely.

Reproduction:

Ran misc/cgo/testcarchive/test.bash with the following modified main.c

diff --git a/misc/cgo/testcarchive/main.c b/misc/cgo/testcarchive/main.c
index cc3170d..2dfdbae 100644
--- a/misc/cgo/testcarchive/main.c
+++ b/misc/cgo/testcarchive/main.c
@@ -8,6 +8,11 @@
 #include "p.h"
 #include "libgo.h"
 
+void causeCrash() {
+       int *i = NULL;
+       printf("%d", *i + 10);
+}
+
 int main(void) {
        int32_t res;
 
@@ -27,6 +32,8 @@ int main(void) {
                return 2;
        }
 
+       causeCrash();
+
        CheckArgs();
 
        fprintf(stderr, "PASS\n");
$ lldb ./testp arg1 arg2
(lldb) target create "./testp"
Current executable set to './testp' (x86_64).
(lldb) settings set -- target.run-args  "arg1" "arg2"
(lldb) run
Process 29934 launched: './testp' (x86_64)
Process 29934 stopped
* thread #1: tid = 0x29bb8e, 0x000000010000111b testp`causeCrash + 27, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x000000010000111b testp`causeCrash + 27
testp`causeCrash + 27:
-> 0x10000111b:  movl   (%rax), %ecx
   0x10000111d:  addl   $0xa, %ecx
   0x100001123:  movl   %ecx, %esi
   0x100001125:  movb   $0x0, %al
(lldb)  
@ianlancetaylor ianlancetaylor added this to the Go1.5Maybe milestone Jun 3, 2015
@ianlancetaylor
Copy link
Member

CC @mwhudson

@mwhudson
Copy link
Contributor

mwhudson commented Jun 3, 2015

I'm happy to look at this but I think it's more to do with the runtime initialization stuff @spetrovic77 did?

@rsc rsc modified the milestones: Go1.6Early, Go1.5Maybe Jul 21, 2015
@rsc
Copy link
Contributor

rsc commented Jul 21, 2015

Dup of #10139 I believe.

@rsc rsc closed this as completed Jul 21, 2015
@golang golang locked and limited conversation to collaborators Jul 20, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants