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

exception handling cause EXC_BAD_ACCESS when linking against shared libraries using vibe #19343

Open
dlangBugzillaToGithub opened this issue Dec 10, 2017 · 0 comments
Labels

Comments

@dlangBugzillaToGithub
Copy link

Timothee Cour (@timotheecour) reported this on 2017-12-10T20:31:39Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=18055

CC List

Description

I understand shared libraries are not 100% supported on OSX but they work to some extent and fullfill a use case; could we make sure this particular case works?
It's sad that such a fundamental feature (shared libraries) still don't work in 2017.

dmd --version
DMD64 D Compiler v2.077.0

dub build
mv libtest1.so libtest1.dylib # cf another dub bug which creates .so instead of .dylib
dmd -g -of=app libtest1.dylib main2.d

lldb ./app

(lldb) r
Process 85211 launched: './app' (x86_64)
Shared libraries are not yet supported on OSX.
ok1
Process 85211 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x90)
    frame #0: 0x00000001002fcfd1 libtest1.so`thread_stackBottom + 21
libtest1.so`thread_stackBottom:
->  0x1002fcfd1 <+21>: movq   0x90(%rcx), %rdx
    0x1002fcfd8 <+28>: movq   (%rdx), %rax
    0x1002fcfdb <+31>: popq   %rbp
    0x1002fcfdc <+32>: retq
Target 0: (app) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x90)
  * frame #0: 0x00000001002fcfd1 libtest1.so`thread_stackBottom + 21
    frame #1: 0x00000001002fa8e6 libtest1.so`D4core7runtime19defaultTraceHandlerFPvZ16DefaultTraceInfo6__ctorMFZCQCpQCnQCiFQBqZQBr + 46
    frame #2: 0x00000001002fa8a0 libtest1.so`D4core7runtime19defaultTraceHandlerFPvZC6object9Throwable9TraceInfo + 64
    frame #3: 0x000000010001470f app`_d_traceContext + 31
    frame #4: 0x00000001000143ae app`_d_createTrace + 70
    frame #5: 0x0000000100014cf7 app`_d_throwdwarf + 167
    frame #6: 0x00000001000016cf app`D3std9exception__T7bailOutHTC9ExceptionZQwFNaNfAyamxAaZv at exception.d:420
    frame #7: 0x000000010000164a app`D3std9exception__T7enforceHTC9ExceptionTiZQyFNaNfiLAxaAyamZi at exception.d:388
    frame #8: 0x0000000100000ee4 app`D5main211test_throw2FZv at main2.d:6
    frame #9: 0x0000000100000e75 app`_Dmain at main2.d:14
    frame #10: 0x0000000100014a4c app`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv + 40
    frame #11: 0x0000000100014974 app`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ7tryExecMFMDFZvZv + 32
    frame #12: 0x00000001000149f1 app`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZv + 45
    frame #13: 0x0000000100014974 app`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ7tryExecMFMDFZvZv + 32
    frame #14: 0x00000001000148df app`_d_run_main + 459
    frame #15: 0x0000000100000e9e app`main + 34
    frame #16: 0x00007fff664c8145 libdyld.dylib`start + 1
    frame #17: 0x00007fff664c8145 libdyld.dylib`start + 1


dub.json:
{
         "name": "test1",
         "targetType": "dynamicLibrary",
         "dependencies": {
                 "vibe-d": "==0.7.32",
         },
         "sourcePaths": [
                 "source/"
         ]
 }

source/app.d:
 module app;

 void fun(){
// uncomment to remove bug
         import vibe.vibe;
 }

main2.d:
 void test_throw2(){
         import std.exception;
         import std.stdio;
         writeln("ok1");
         try{
                 enforce(0);
         } catch(Exception t){
                 writeln("thrown");
         }
         writeln("ok2");
 }

 void main(){
         test_throw2;
 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant