<div dir="ltr">Yep, it looks like LC_VERSION_MIN_MACOSX is missing.<div>target list shows:</div><div><div>  target #0: /private/tmp/gopath/bin/wikilinktester ( arch=x86_64-apple-, platform=host )</div></div><div>specifying --arch doesn't seem to work. It still has the modules loaded starting at 0, and target list says:</div><div><div>* target #1: /tmp/gopath/bin/wikilinktester ( arch=x86_64h-apple-macosx, platform=host, pid=48597, state=stopped )</div></div><div><br></div><div>If you link a go program with c code it uses the system linker, which does add LC_VERSION_MIN_MACOSX. That explains why I've never seen this before. Here's what that sort of binary looks like:</div><div><div>(lldb) target list</div><div>Current targets:</div><div>* target #0: /private/tmp/gopath/bin/wikilinktester ( arch=x86_64-apple-macosx, platform=host, pid=49564, state=stopped )</div><div>(lldb) image list</div><div>[  0] DC92B610-E1DD-3CB2-AD7E-4EEF21E19D20 0x0000000004000000 /private/tmp/gopath/bin/wikilinktester</div><div>[  1] B1B370A5-479F-3533-8AD7-97B687D4F989 0x00007fff5fc00000 /usr/lib/dyld</div><div>[  2] 1866C519-C5F3-3D09-8C17-A8F703664521 0x00007fff86ce6000 /usr/lib/libSystem.B.dylib</div><div>[  3] 5C0892B8-9691-341F-9279-CA3A74D59AA0 0x00007fff8631a000 /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation</div><div>...</div></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Oct 14, 2015 at 11:49 AM Greg Clayton <<a href="mailto:gclayton@apple.com">gclayton@apple.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I am guessing that your binary is missing a LC_VERSION_MIN_XXX load command and so it is being loaded with "<arch>-unknown-unknown" as the architecture. This is probably causing LLDB to load the DynamicLoaderStatic as the dynamic loader which just loads all shared libraries as the address that is contained within the file itself, which is zero for most shared libraries.<br>
<br>
If you have a linker that is generating mach-o files, you will need to add a LC_VERSION_MIN_MACOSX load command to your executable so we know it is MacOSX.<br>
<br>
What does the output of "target list" show as the triple? It is probably "x86_64-unknown-unknown". We are often able to extract the correct triple for an executable from the executable itself. When no architecture if specified, it will default to the architecture that we detect in the main executable and this architecture will be used when a process asks for plug-ins to be created, line a DynamicLoader plug-in. If the triple is wrong, then we might select the wrong plug-ins for what you are trying to debug.<br>
<br>
You might be able to get around this for now by specifying this when you create your target:<br>
<br>
(lldb) target create --arch=x86_64-apple-macosx /tmp/gopath/bin/wikilinktester<br>
<br>
> On Oct 13, 2015, at 4:25 PM, Ryan Brown via lldb-dev <<a href="mailto:lldb-dev@lists.llvm.org" target="_blank">lldb-dev@lists.llvm.org</a>> wrote:<br>
><br>
> I'm having a strange issue debugging a go program.<br>
><br>
> I set a breakpoint, and lldb stops at it. However, lldb thinks it's in a different function:<br>
> (lldb) b wikilinktester.go:35<br>
> Breakpoint 1: where = wikilinktester`main.main + 805 at wikilinktester.go:35, address = 0x0000000000002365<br>
> (lldb) r<br>
> Process 43141 launched: '/tmp/gopath/bin/wikilinktester' (x86_64)<br>
> Process 43141 stopped<br>
> * thread #5: tid = 0x0001, 0x0000000000002365 libOpenScriptingUtil.dylib, stop reason = breakpoint 1.1<br>
>     frame #0: 0x0000000000002365 libOpenScriptingUtil.dylib<br>
> ->  0x2365: movq   %rax, 0x48(%rsp)<br>
>     0x236a: movq   %rax, (%rsp)<br>
>     0x236e: callq  0xb23d0<br>
>     0x2373: movq   0x8(%rsp), %rbx<br>
><br>
> For some reason lldb seems to think all the shared libraries are loaded at address 0:<br>
> (lldb) image list<br>
> [  0]                                      0x0000000000001000 /tmp/gopath/bin/wikilinktester<br>
> [  1] B1B370A5-479F-3533-8AD7-97B687D4F989 0x00007fff5fc00000 /usr/lib/dyld<br>
> [  2] 1866C519-C5F3-3D09-8C17-A8F703664521 0x0000000000000000 /usr/lib/libSystem.B.dylib<br>
> [  3] 5C0892B8-9691-341F-9279-CA3A74D59AA0 0x0000000000000000 /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation<br>
> [  4] FCCCC4FD-043A-30CA-9997-4211CA0E9297 0x0000000000000000 /System/Library/Frameworks/Security.framework/Versions/A/Security<br>
> [  5] 45E9A2E7-99C4-36B2-BEE3-0C4E11614AD1 0x0000000000000000 /usr/lib/system/libcache.dylib<br>
> [  6] E789748D-F9A7-3CFF-B317-90DF348B1E95 0x0000000000000000 /usr/lib/system/libcommonCrypto.dylib<br>
> [  7] BF8FC133-EE10-3DA6-9B90-92039E28678F 0x0000000000000000 /usr/lib/system/libcompiler_rt.dylib<br>
> [  8] 0C68D3A6-ACDD-3EF3-991A-CC82C32AB836 0x0000000000000000 /usr/lib/system/libcopyfile.dylib<br>
> [  9] 5779FFA0-4D9A-3AD4-B7F2-618227621DC8 0x0000000000000000 /usr/lib/system/libcorecrypto.dylib<br>
> [ 10] 502CF32B-669B-3709-8862-08188225E4F0 0x0000000000000000 /usr/lib/system/libdispatch.dylib<br>
> [ 11] CFBBE540-D503-3AFC-B5D6-644F1E69949B 0x0000000000000000 /usr/lib/system/libdyld.dylib<br>
> [ 12] 77845842-DE70-3CC5-BD01-C3D14227CED5 0x0000000000000000 /usr/lib/system/libkeymgr.dylib<br>
> [ 13] 4F81CA3A-D2CE-3030-A89D-42F3DAD7BA8F 0x0000000000000000 /usr/lib/system/liblaunch.dylib<br>
> [ 14] 126CA2ED-DE91-308F-8881-B9DAEC3C63B6 0x0000000000000000 /usr/lib/system/libmacho.dylib<br>
> [ 15] 7AF90041-2768-378A-925A-D83161863642 0x0000000000000000 /usr/lib/system/libquarantine.dylib<br>
> [ 16] 3485B5F4-6CE8-3C62-8DFD-8736ED6E8531 0x0000000000000000 /usr/lib/system/libremovefile.dylib<br>
> [ 17] F153AC5B-0542-356E-88C8-20A62CA704E2 0x0000000000000000 /usr/lib/system/libsystem_asl.dylib<br>
> [ 18] 9615D10A-FCA7-3BE4-AA1A-1B195DACE1A1 0x0000000000000000 /usr/lib/system/libsystem_blocks.dylib<br>
> [ 19] F0635E0F-FE4B-34DB-ACF9-A58C1E9070E9 0x0000000000000000 /usr/lib/system/libsystem_c.dylib<br>
> [ 20] 56F94DCE-DBDE-3615-8F07-DE6270D9F8BE 0x0000000000000000 /usr/lib/system/libsystem_configuration.dylib<br>
> [ 21] 41B7C578-5A53-31C8-A96F-C73E030B0938 0x0000000000000000 /usr/lib/system/libsystem_coreservices.dylib<br>
> [ 22] 155DA0A9-2046-332E-BFA3-D7974A51F731 0x0000000000000000 /usr/lib/system/libsystem_coretls.dylib<br>
> [ 23] 0CEB5910-843F-315C-A1DE-5D955A48A045 0x0000000000000000 /usr/lib/system/libsystem_dnssd.dylib<br>
> [ 24] 2E16C4B3-A327-3957-9C41-143911979A1E 0x0000000000000000 /usr/lib/system/libsystem_info.dylib<br>
> [ 25] 16AD15EF-3DAE-3F63-9D26-26CCE1920762 0x0000000000000000 /usr/lib/system/libsystem_kernel.dylib<br>
> [ 26] 1E12AB45-6D96-36D0-A226-F24D9FB0D9D6 0x0000000000000000 /usr/lib/system/libsystem_m.dylib<br>
> [ 27] DDA8928B-CC0D-3255-BD8A-3FEA0982B890 0x0000000000000000 /usr/lib/system/libsystem_malloc.dylib<br>
> [ 28] 6105C134-6722-3C0A-A4CE-5E1261E2E1CC 0x0000000000000000 /usr/lib/system/libsystem_network.dylib<br>
> [ 29] BA58B30B-8377-3B0A-8AE3-4F84021D9D4E 0x0000000000000000 /usr/lib/system/libsystem_networkextension.dylib<br>
> [ 30] 61147800-F320-3DAA-850C-BADF33855F29 0x0000000000000000 /usr/lib/system/libsystem_notify.dylib<br>
> [ 31] 64E34079-D712-3D66-9CE2-418624A5C040 0x0000000000000000 /usr/lib/system/libsystem_platform.dylib<br>
> [ 32] ACE90967-ECD0-3251-AEEB-461E3C6414F7 0x0000000000000000 /usr/lib/system/libsystem_pthread.dylib<br>
> [ 33] 3F5E973F-C702-31AC-97BC-05F5C195683C 0x0000000000000000 /usr/lib/system/libsystem_sandbox.dylib<br>
> [ 34] 581DAD0F-6B63-3A48-B63B-917AF799ABAA 0x0000000000000000 /usr/lib/system/libsystem_secinit.dylib<br>
> [ 35] D0E96837-3CF6-323D-B711-6DF6F660E530 0x0000000000000000 /usr/lib/system/libsystem_stats.dylib<br>
> [ 36] 840F5301-B55A-3078-90B9-FEFFD6CD741A 0x0000000000000000 /usr/lib/system/libsystem_trace.dylib<br>
> [ 37] 5676F7EA-C1DF-329F-B006-D2C3022B7D70 0x0000000000000000 /usr/lib/system/libunc.dylib<br>
> [ 38] BE7E51A0-B6EA-3A54-9CCA-9D88F683A6D6 0x0000000000000000 /usr/lib/system/libunwind.dylib<br>
> [ 39] 5C829202-962E-3744-8B50-00D38CC88E84 0x0000000000000000 /usr/lib/system/libxpc.dylib<br>
> [ 40] A260789B-D4D8-316A-9490-254767B8A5F1 0x0000000000000000 /usr/lib/libauto.dylib<br>
> [ 41] 2EE8E436-5CDC-34C5-9959-5BA218D507FB 0x0000000000000000 /usr/lib/libDiagnosticMessagesClient.dylib<br>
> [ 42] 3CD34752-B1F9-31D2-865D-B5B0F0BE3111 0x0000000000000000 /usr/lib/libicucore.A.dylib<br>
> [ 43] 759E155D-BC42-3D4E-869B-6F57D477177C 0x0000000000000000 /usr/lib/libobjc.A.dylib<br>
> [ 44] 88C7C7DE-04B8-316F-8B74-ACD9F3DE1AA1 0x0000000000000000 /usr/lib/libz.1.dylib<br>
> [ 45] A3A2E56C-2B65-37C7-B43A-A1F926E1A0BB 0x0000000000000000 /usr/lib/libbsm.0.dylib<br>
> [ 46] 7CD69BB5-97BA-3858-8A8B-2F33F129E6E7 0x0000000000000000 /usr/lib/libxar.1.dylib<br>
> [ 47] BCB1F77E-2484-3EC4-A1D5-1AE90A407A23 0x0000000000000000 /usr/lib/libsqlite3.dylib<br>
> [ 48] E805398D-9A92-31F8-8005-8DC188BD8B6E 0x0000000000000000 /usr/lib/libpam.2.dylib<br>
> [ 49] 09C0518C-90DF-3FC3-96D6-34D35F72C8EF 0x0000000000000000 /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit<br>
> [ 50] D6A2216D-ADB2-3F24-AD30-F6D00829F545 0x0000000000000000 /usr/lib/libOpenScriptingUtil.dylib<br>
> [ 51] 1B9530FD-989B-3174-BB1C-BDC159501710 0x0000000000000000 /usr/lib/libc++.1.dylib<br>
> [ 52] 88A22A0F-87C6-3002-BFBA-AC0F2808B8B9 0x0000000000000000 /usr/lib/libc++abi.dylib<br>
> [ 53] 2DF83FBC-5C08-39E1-94F5-C28653791B5F 0x0000000000000000 /usr/lib/libbz2.1.0.dylib<br>
> [ 54] 3FBA890F-2850-3A45-87EA-DB6892BDEB60 0x0000000000000000 /usr/lib/libxml2.2.dylib<br>
> [ 55] 2ADAE067-78A0-371E-A5A8-1E7C892D193C 0x0000000000000000 /usr/lib/system/libkxld.dylib<br>
><br>
> Any idea what's going on here?<br>
><br>
> _______________________________________________<br>
> lldb-dev mailing list<br>
> <a href="mailto:lldb-dev@lists.llvm.org" target="_blank">lldb-dev@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev</a><br>
<br>
</blockquote></div>