[lldb-dev] lldb 340.4.119 unable to attach (El Capitan)

2015-12-26 Thread Andre Vergison via lldb-dev
Hi,
I tried Jason Molenda’s test code on El Capitan, lldb-340.4.119 (Jason Molenda 
via lldb-dev | 3 Oct 02:59 2015).
I’m connected to a remote VM using ssh.

tst$ echo 'int main () { }' > /tmp/a.c
tst$ xcrun clang /tmp/a.c -o /tmp/a.out
tst$ xcrun lldb /tmp/a.out
(lldb) target create "/tmp/a.out"
Current executable set to '/tmp/a.out' (x86_64).
(lldb) r
error: process exited with status -1 (unable to attach)
(lldb) run
error: process exited with status -1 (unable to attach)
(lldb) quit
tst$ ps -ef|grep a.out
  502 33174 1   0 12:20PM ttys0000:00.00 /tmp/a.out
  502 33187 1   0 12:20PM ttys0000:00.00 /tmp/a.out

I can’t even kill those using kill -9.

What’s going on here?

I tried the above because in fact I had a process which a segmentation fault 
11, here’s what lldb makes out of the core dump:

txt$ lldb /cores/core.33158
(lldb) target create "/cores/core.33158"
warning: (x86_64) /cores/core.33158 load command 175 LC_SEGMENT_64 has a fileoff
 + filesize (0x31c57000) that extends beyond the end of the file (0x31c56000), t
he segment will be truncated to match
warning: (x86_64) /cores/core.33158 load command 176 LC_SEGMENT_64 has a fileoff
 (0x31c57000) that extends beyond the end of the file (0x31c56000), ignoring thi
s section
Current executable set to '/cores/core.33158' (x86_64).
(lldb)

Is this related? Compiled with g++ :

tst$ g++ --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-inc
lude-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.0.0
Thread model: posix

Thx,
Andre
___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev


Re: [lldb-dev] lldb 340.4.119 unable to attach (El Capitan)

2015-12-29 Thread Andre Vergison via lldb-dev
ocal admin to tweak 
settings using the Xcode gui, if needed. What would you suggest?

Thanks,
Andre


From: Todd Fiala [mailto:todd.fi...@gmail.com]
Sent: maandag 28 december 2015 19:19
To: Andre Vergison
Cc: lldb-dev@lists.llvm.org
Subject: Re: [lldb-dev] lldb 340.4.119 unable to attach (El Capitan)

Hi Andre,

On Sat, Dec 26, 2015 at 3:53 AM, Andre Vergison via lldb-dev 
mailto:lldb-dev@lists.llvm.org>> wrote:
Hi,
I tried Jason Molenda’s test code on El Capitan, lldb-340.4.119 (Jason Molenda 
via lldb-dev | 3 Oct 02:59 2015).
I’m connected to a remote VM using ssh.

tst$ echo 'int main () { }' > /tmp/a.c
tst$ xcrun clang /tmp/a.c -o /tmp/a.out
tst$ xcrun lldb /tmp/a.out
(lldb) target create "/tmp/a.out"
Current executable set to '/tmp/a.out' (x86_64).
(lldb) r
error: process exited with status -1 (unable to attach)
(lldb) run
error: process exited with status -1 (unable to attach)
(lldb) quit
tst$ ps -ef|grep a.out
  502 33174 1   0 12:20PM ttys0000:00.00 /tmp/a.out
  502 33187 1   0 12:20PM ttys0000:00.00 /tmp/a.out

Just shooting in the dark, but perhaps the a.out is either not in a state where 
it can be touched (yet), could be zombified or something.  Have you tried 'sudo 
kill -9' on them?  Also, if you look for a debugserver or lldb in the process 
list (either of which could be a parent of it), are they hanging around?  If 
so, killing them might allow the a.out processes to die.

Are you using an lldb that you built?  If so, the underlying attach problem 
could be due to some kind signing/permissions with debugserver.  To have lldb 
use the official Xcode version of lldb's debugserver (assuming you have Xcode 
installed and aren't trying to use just the command line tools), you should be 
able to build with a command line like this:

xcodebuild -scheme desktop -configuration Debug DEBUGSERVER_USE_FROM_SYSTEM=1

Or from within Xcode itself, locally adjust your Xcode project to set the 
"DEBUGSERVER_USE_FROM_SYSTEM" user variable to 1.

I'm not sure if you already did this, but you may need to turn on your dev 
tools security via:
sudo DevToolSecurity --enable

Let us know if that gets you any further.

Thanks!

-Todd


___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev


Re: [lldb-dev] lldb 340.4.119 unable to attach (El Capitan)

2016-01-05 Thread Andre Vergison via lldb-dev
Greg, I owe you a Bud (or fruit juice if you prefer) !!

That's all I had to do... Now it works like a charm!

tst$ sudo /usr/sbin/DevToolsSecurity --enable
Developer mode is now enabled.
tst$ lldb testabc
(lldb) target create "testabc"
Current executable set to 'testabc' (x86_64).
(lldb) run
Process 34322 launched: '/Users/tst/testabc' (x86_64)
TESTING on  2016/01/05 09:53:25
...

And all lldb commands work nicely.
Now disabling for a test:

tst$ sudo /usr/sbin/DevToolsSecurity --disable
Developer mode is now disabled.
tst$ lldb testabc
(lldb) target create "testabc"
Current executable set to 'testabc' (x86_64).
(lldb) run
error: process exited with status -1 (unable to attach)
(lldb) quit

So that was definitely the (only) reason.

Perhaps this 'developer mode' is something natural in the eyes of Mac 
developers. I do porting on multiple systems, I'm becoming more and more 
familiar with Mac every day, and I was not fully aware of the switch, the more 
that lldb ran 'almost' normally.

Wouldn't it be an idea to add to lldb a warning against missing developer mode 
rather than exhibiting its odd 'unable to attach' and zombie creation behavior? 
Even as 'developer' I still was not able to kill the zombie I created per the 
above 'developer disabled' lldb session.
So how about:

(lldb) run
error: developer mode not enabled

Thanks again!
Andre

-Original Message-
From: Greg Clayton [mailto:gclay...@apple.com] 
Sent: maandag 4 januari 2016 20:23
To: Andre Vergison
Cc: lldb-dev@lists.llvm.org
Subject: Re: [lldb-dev] lldb 340.4.119 unable to attach (El Capitan)

If you ssh in you must enable developer mode one time per boot:

sudo /usr/sbin/DevToolsSecurity --enable

Then you should be able to debug. If you don't, it will popup a dialog box on 
the remote system that attempts to get authorization, but you will never see 
that in your SSH window...

Let me know if this helps.

Greg

> On Dec 26, 2015, at 3:53 AM, Andre Vergison via lldb-dev 
>  wrote:
> 
> Hi,
> I tried Jason Molenda’s test code on El Capitan, lldb-340.4.119 (Jason 
> Molenda via lldb-dev | 3 Oct 02:59 2015).
> I’m connected to a remote VM using ssh.
>  
> tst$ echo 'int main () { }' > /tmp/a.c
> tst$ xcrun clang /tmp/a.c -o /tmp/a.out
> tst$ xcrun lldb /tmp/a.out
> (lldb) target create "/tmp/a.out"
> Current executable set to '/tmp/a.out' (x86_64).
> (lldb) r
> error: process exited with status -1 (unable to attach)
> (lldb) run
> error: process exited with status -1 (unable to attach)
> (lldb) quit
> tst$ ps -ef|grep a.out
>   502 33174 1   0 12:20PM ttys0000:00.00 /tmp/a.out
>   502 33187 1   0 12:20PM ttys0000:00.00 /tmp/a.out
>  
> I can’t even kill those using kill -9.
>  
> What’s going on here?
>  
> I tried the above because in fact I had a process which a segmentation fault 
> 11, here’s what lldb makes out of the core dump:
>  
> txt$ lldb /cores/core.33158
> (lldb) target create "/cores/core.33158"
> warning: (x86_64) /cores/core.33158 load command 175 LC_SEGMENT_64 has a 
> fileoff
>  + filesize (0x31c57000) that extends beyond the end of the file 
> (0x31c56000), t
> he segment will be truncated to match
> warning: (x86_64) /cores/core.33158 load command 176 LC_SEGMENT_64 has a 
> fileoff
>  (0x31c57000) that extends beyond the end of the file (0x31c56000), ignoring 
> thi
> s section
> Current executable set to '/cores/core.33158' (x86_64).
> (lldb)
>  
> Is this related? Compiled with g++ :
>  
> tst$ g++ --version
> Configured with: --prefix=/Library/Developer/CommandLineTools/usr 
> --with-gxx-inc
> lude-dir=/usr/include/c++/4.2.1
> Apple LLVM version 7.0.2 (clang-700.1.81)
> Target: x86_64-apple-darwin15.0.0
> Thread model: posix
>  
> Thx,
> Andre
> ___
> lldb-dev mailing list
> lldb-dev@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev

___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev