<div dir="ltr">Ok, I've done that, here are the logs which happen before the first debugserver error:<div><br></div><div>error 18:33:20.236506 +0200 taskgated cannot open file at line 42270 of [95fbac39ba]<br>error 18:33:20.236526 +0200 taskgated os_unix.c:42270: (2) open(/var/db/DetachedSignatures) - No such file or directory<br>default 18:33:20.236586 +0200 taskgated MacOS error: -67062<br>error 18:33:20.246771 +0200 taskgated cannot open file at line 42270 of [95fbac39ba]<br>error 18:33:20.246787 +0200 taskgated os_unix.c:42270: (2) open(/var/db/DetachedSignatures) - No such file or directory<br>default 18:33:20.246841 +0200 taskgated MacOS error: -67062<br>default 18:33:20.260319 +0200 debugserver debugserver will use os_log for internal logging.<br>default 18:33:20.260491 +0200 debugserver debugserver-@(#)PROGRAM:LLDB PROJECT:lldb-360.99.0<br> for x86_64.<br>default 18:33:20.260615 +0200 debugserver Got a connection, waiting for process information for launching or attaching.<br>default 18:33:20.264541 +0200 trustd cert[0]: AnchorTrusted =(leaf)[force]> 0<br>default 18:33:20.272256 +0200 trustd cert[2]: AnchorTrusted =(leaf)[force]> 0<br>default 18:33:20.276567 +0200 trustd cert[2]: AnchorTrusted =(leaf)[force]> 0<br>default 18:33:20.278680 +0200 authd UNIX error exception: 3<br>error 18:33:20.279462 +0200 authd process: PID 27648 failed to create code ref 100003<br>error 18:33:20.280017 +0200 authd Fatal: interaction not allowed (session has no ui access) (engine 3727)<br>default 18:33:20.280031 +0200 authd Failed to authorize right 'system.privilege.taskport' by client '/usr/libexec/taskgated' [254] for authorization created by '/usr/libexec/taskgated' [27648] (3,1) (-60007) (engine 3727)<br>error 18:33:20.280092 +0200 authd copy_rights: authorization failed<br>error 18:33:20.280442 +0200 debugserver error: MachTask::TaskPortForProcessID task_for_pid failed: ::task_for_pid ( target_tport = 0x0103, pid = 27646, &task ) => err = 0x00000005 ((os/kern) failure)<br><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jul 22, 2019 at 6:10 PM Frédéric Riss <<a href="mailto:friss@apple.com">friss@apple.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;">I think the system logs (in Console.app) would tell us more. Search for debugserver and you should find attach failures. Then remove the filter and look at what happens right before that. There should be a log from taskgated or authd that is a little more explicit about what’s failing.<div><br></div><div>Fred <br><div><br><blockquote type="cite"><div>On Jul 22, 2019, at 8:55 AM, Gábor Márton via lldb-dev <<a href="mailto:lldb-dev@lists.llvm.org" target="_blank">lldb-dev@lists.llvm.org</a>> wrote:</div><br class="gmail-m_2348790345714622167Apple-interchange-newline"><div><div dir="ltr">Some more info: I've stopped lldb (with the system lldb) when " Process::SetExitStatus (status=-1 (0xffffffff), description="Error 1")" is logged and gathered some more information.<div>Is it possible that some packet types are not implemented?</div><div><br></div><div> * frame #0: 0x00007fff599452c6 libsystem_kernel.dylib`__pthread_kill + 10<br> frame #1: 0x00007fff59a00bf1 libsystem_pthread.dylib`pthread_kill + 284<br> frame #2: 0x00007fff598af6a6 libsystem_c.dylib`abort + 127<br> frame #3: 0x00007fff5987820d libsystem_c.dylib`__assert_rtn + 324<br> frame #4: 0x000000010b393539 liblldb.10.0.99svn.dylib`lldb_private::Process::SetExitStatus(this=0x00007fcfaa470218, status=-1, cstr="Error 1") at Process.cpp:1149:3<br> frame #5: 0x000000010bbd1792 liblldb.10.0.99svn.dylib`lldb_private::process_gdb_remote::ProcessGDBRemote::AsyncThread(arg=0x00007fcfaa470218) at ProcessGDBRemote.cpp:3877:28<br> frame #6: 0x000000010b08f87b liblldb.10.0.99svn.dylib`lldb_private::HostNativeThreadBase::ThreadCreateTrampoline(arg=0x00007fcfab218740) at HostNativeThreadBase.cpp:69:10<br> frame #7: 0x0000000112be72fd liblldb.10.0.99svn.dylib`lldb_private::HostThreadMacOSX::ThreadCreateTrampoline(arg=0x00007fcfab218740) at HostThreadMacOSX.mm:68:10<br> frame #8: 0x00007fff599fe2eb libsystem_pthread.dylib`_pthread_body + 126<br> frame #9: 0x00007fff59a01249 libsystem_pthread.dylib`_pthread_start + 66<br> frame #10: 0x00007fff599fd40d libsystem_pthread.dylib`thread_start + 13<br>(lldb) frame select 5<br>frame #5: 0x000000010bbd1792 liblldb.10.0.99svn.dylib`lldb_private::process_gdb_remote::ProcessGDBRemote::AsyncThread(arg=0x00007fcfaa470218) at ProcessGDBRemote.cpp:3877:28<br> 3874 "System Integrity Protection");<br> 3875 } else if (::strstr(continue_cstr, "vAttach") != nullptr &&<br> 3876 response.GetStatus().Fail()) {<br>-> 3877 process->SetExitStatus(-1, response.GetStatus().AsCString());<br> 3878 } else {<br> 3879 process->SetExitStatus(-1, "lost connection");<br> 3880 }<br>(lldb) p response.GetError()<br>(uint8_t) $0 = '\x01'<br>(lldb) p response.GetServerPacketType()<br>(StringExtractorGDBRemote::ServerPacketType) $1 = <b>eServerPacketType_unimplemented</b><br>(lldb) p response.GetResponseType()<br>(StringExtractorGDBRemote::ResponseType) $2 = eError<br>(lldb) p response.IsUnsupportedResponse()<br>(bool) $3 = false<br>(lldb) p response.GetStatus()<br>(lldb_private::Status) $4 = (m_code = 1, m_type = eErrorTypeGeneric, m_string = "Error 1")<br></div><div><br></div><div><br></div><div>Thanks,</div><div>Gabor</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jul 22, 2019 at 4:59 PM Gábor Márton <<a href="mailto:martongabesz@gmail.com" target="_blank">martongabesz@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Yes, here it is.<div><br></div><div>egbomrt@msmarple ~/llvm2/build/release_assert $ ./bin/lldb ~/a.out<br>(lldb) target create "/Users/egbomrt/a.out"<br>Current executable set to '/Users/egbomrt/a.out' (x86_64).<br>(lldb) log enable lldb default<br>(lldb) r<br> Processing command: r<br> HandleCommand, cmd_obj : 'process launch'<br> HandleCommand, (revised) command_string: 'process launch -X true --'<br> HandleCommand, wants_raw_input:'False'<br> HandleCommand, command line after removing command name(s): '-X true --'<br> Target::Launch() called for /Users/egbomrt/a.out<br> Target::Launch the process instance doesn't currently exist.<br> have platform=true, platform_sp->IsHost()=true, default_to_use_pty=true<br> at least one of stdin/stdout/stderr was not set, evaluating default handling<br> target stdin='(empty)', target stdout='(empty)', stderr='(empty)'<br> Generating a pty to use for stdin/out/err<br> Target::Launch asking the platform to debug the process<br> Host::StartMonitoringChildProcess (callback, pid=94887, monitor_signals=0) source = 0x7f9bb923ec10<br><br> ::waitpid (pid = 94887, &status, 0) => pid = 94887, status = 0x00000000 (EXITED), signal = 0, exit_status = 0<br> Host::StartMonitoringChildProcess (callback, pid=94888, monitor_signals=0) source = 0x7f9bb9218180<br><br> Went to stop the private state thread, but it was already invalid.<br> Process::SetPublicState (state = attaching, restarted = 0)<br> Host::StartMonitoringChildProcess (callback, pid=94889, monitor_signals=0) source = 0x7f9bb9243bd0<br><br> thread created<br> Process::AttachCompletionHandler::AttachCompletionHandler process=0x7f9bb8803c18, exec_count=0<br> Process::ControlPrivateStateThread (signal = 4)<br> Sending control event of type: 4.<br> thread created<br> Process::RunPrivateStateThread (arg = 0x7f9bb8803c18, pid = 94888) thread starting...<br> timeout = <infinite>, event_sp)...<br> Process::RunPrivateStateThread (arg = 0x7f9bb8803c18, pid = 94888) got a control event: 4<br> timeout = <infinite>, event_sp)...<br> timeout = <infinite><br> timeout = <infinite>, event_sp)...<br> thread created<br> Process::SetExitStatus (status=-1 (0xffffffff), description="Error 1")<br> Process::SetPrivateState (exited)<br> Process::SetPrivateState (exited) stop_id = 1<br> Process::AttachCompletionHandler::PerformAction called with state exited (10)<br> Ran next event action, result was 2.<br> Process::ShouldBroadcastEvent (0x7f9bb92423b0) => new state: exited, last broadcast state: exited - YES<br> Process::HandlePrivateEvent (pid = 94888) broadcasting new state exited (old state attaching) to hijacked<br> Process::RunPrivateStateThread (arg = 0x7f9bb8803c18, pid = 94888) about to exit with internal state exited...<br> Process::RunPrivateStateThread (arg = 0x7f9bb8803c18, pid = 94888) thread exiting...<br> Process::SetPublicState (state = exited, restarted = 0)<br> timeout = <infinite>, event_sp) => exited<br> HandleCommand, command did not succeed<br>error: process exited with status -1 (Error 1)<br>(lldb) ::waitpid (pid = 94889, &status, 0) => pid = 94889, status = 0x00000000 (EXITED), signal = 0, exit_status = 0<br>(lldb)<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jul 22, 2019 at 4:44 PM Stefan Gränitz <<a href="mailto:stefan.graenitz@gmail.com" target="_blank">stefan.graenitz@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF">
Interesting. Is there any extra info dumped to the log (e.g. `log
enable lldb default`)<br>
<br>
<div class="gmail-m_2348790345714622167gmail-m_6493066739990619720gmail-m_-5130856992912908301moz-cite-prefix">On 22/07/2019 16:34, Gábor Márton
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Well, SIP is turned off and I experience the same
with a binary I just built:
<div>```</div>
<div>egbomrt@msmarple ~/llvm2/build/release_assert $ csrutil
status<br>
System Integrity Protection status: disabled.<br>
egbomrt@msmarple ~/llvm2/build/release_assert $ ./bin/lldb
~/a.out<br>
(lldb) target create "/Users/egbomrt/a.out"<br>
Current executable set to '/Users/egbomrt/a.out' (x86_64).<br>
(lldb) r<br>
error: process exited with status -1 (Error 1)<br>
(lldb) ^D<br>
egbomrt@msmarple ~/llvm2/build/release_assert $ ls -la ~/a.out<br>
-rwxr-xr-x 1 egbomrt admin 8736 Júl 22 16:16
/Users/egbomrt/a.out<br>
egbomrt@msmarple ~/llvm2/build/release_assert $<br>
</div>
<div>```</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Mon, Jul 22, 2019 at 4:29
PM Stefan Gränitz <<a href="mailto:stefan.graenitz@gmail.com" target="_blank">stefan.graenitz@gmail.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF">
<blockquote type="cite">egbomrt@msmarple
~/llvm2/build/release_assert $ ./bin/lldb /bin/ls<br>
(lldb) target create "/bin/ls"<br>
Current executable set to '/bin/ls' (x86_64).<br>
(lldb) r<br>
<b>error: process exited with status -1 (Error 1)</b></blockquote>
I don't think this is related to debugserver codesigning. If
you really need to debug system binaries, you may need to
disable SIP.<br>
<br>
<div class="gmail-m_2348790345714622167gmail-m_6493066739990619720gmail-m_-5130856992912908301gmail-m_1946239005957847031moz-cite-prefix">On
22/07/2019 16:14, Gábor Márton wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">I am still struggling with this issue. Now
I decided to work with the codesigned version of the
debugserver, becasue I had an error when I tried to use
the system debugserver.
<div>So I've run <span>scripts/macos-setup-codesign.sh</span><br>
<div>After a reboot and fresh build (I have removed
the CMakeCache.txt and the whole build dir) I have
the debugserver signed:</div>
<div>```</div>
<div>$ codesign -dvvvv
~/llvm2/build/release_assert/bin/debugserver<br>
Executable=/Users/egbomrt/llvm2/build/release_assert/bin/debugserver<br>
Identifier=com.apple.debugserver<br>
Format=Mach-O thin (x86_64)<br>
CodeDirectory v=20100 size=38534 flags=0x0(none)
hashes=1197+5 location=embedded<br>
VersionPlatform=1<br>
VersionMin=658944<br>
VersionSDK=658944<br>
Hash type=sha256 size=32<br>
CandidateCDHash
sha256=7b475cfa7127c84281ceb206093d13dd464dad74<br>
Hash choices=sha256<br>
Page size=4096<br>
CDHash=7b475cfa7127c84281ceb206093d13dd464dad74<br>
Signature size=1611<br>
Authority=lldb_codesign<br>
Signed Time=2019. Jul 22. 15:26:29<br>
Info.plist entries=6<br>
TeamIdentifier=not set<br>
Sealed Resources=none<br>
Internal requirements count=1 size=100<br>
$<br>
</div>
<div>```</div>
</div>
<div><br>
</div>
<div>So far so good.</div>
<div>But then when I try to use lldb I have permission
problems:</div>
<div>```</div>
<div>egbomrt@msmarple ~/llvm2/build/release_assert $
./bin/lldb /bin/ls<br>
(lldb) target create "/bin/ls"<br>
Current executable set to '/bin/ls' (x86_64).<br>
(lldb) r<br>
<b>error: process exited with status -1 (Error 1)</b><br>
(lldb) ^D<br>
egbomrt@msmarple ~/llvm2/build/release_assert $<br>
</div>
<div>```<br>
</div>
<div><br>
</div>
<div>However, as root I can use lldb:</div>
<div>```</div>
<div>egbomrt@msmarple ~/llvm2/build/release_assert $
sudo ./bin/lldb /bin/ls<br>
(lldb) target create "/bin/ls"<br>
Current executable set to '/bin/ls' (x86_64).<br>
(lldb) r<br>
Process 28052 launched: '/bin/ls' (x86_64)<br>
.ninja_deps compile_commands.json<br>
.ninja_log docs<br>
CMakeCache.txt examples<br>
CMakeDoxyfile.in include<br>
...<br>
Process 28052 exited with status = 0 (0x00000000)<br>
(lldb) ^D<br>
egbomrt@msmarple ~/llvm2/build/release_assert $<br>
</div>
<div>```</div>
<div><br>
</div>
<div>Is it possible to codesign in a way that a regular
user can run the built debugserver? Or what else could
be the reason behind this permission problem?</div>
<div><br>
</div>
<div>Thanks,</div>
<div>Gabor</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Fri, Jul 19, 2019
at 11:47 PM Stefan Gränitz <<a href="mailto:stefan.graenitz@gmail.com" target="_blank">stefan.graenitz@gmail.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF"><p>Hi Gábor, I am sorry this caused an issue for
you. Good that apparently it's resolved now.<br>
<br>
Did you reconfigure an existing build-tree? Your
observations would make sense in this context,
because the change affects CMake cached variables.
This is unfortunate, but can not always be
avoided. If this happens again (or to anyone
else), a clean build seems to be a good first
step.<br>
<br>
Best,<br>
Stefan<br>
<br>
On 19/07/2019 19:36, Gábor Márton wrote:<br>
</p>
<blockquote type="cite">
<div dir="ltr">Actually, it is embarrassing
(perhaps for macOS and not for me) that after a
reboot the problem is gone.
<div>Perhaps after "sudo
/usr/sbin/DevToolsSecurity --enable" a reboot
is required, but could not find anything
official about that.</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Fri, Jul
19, 2019 at 7:20 PM Gábor Márton <<a href="mailto:martongabesz@gmail.com" target="_blank">martongabesz@gmail.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">This might not be related to
the debugserver, I just realized that I get
<div>"error: <span class="gmail-m_2348790345714622167gmail-m_6493066739990619720gmail-m_-5130856992912908301gmail-m_1946239005957847031gmail-m_8428160405396733394gmail-m_-2133299894781877036gmail-il">process</span> <span class="gmail-m_2348790345714622167gmail-m_6493066739990619720gmail-m_-5130856992912908301gmail-m_1946239005957847031gmail-m_8428160405396733394gmail-m_-2133299894781877036gmail-il">exited</span> with
status -1 (Error 1)"<br>
</div>
<div>even with the simplest main.c.</div>
<div>This may be some kind of security issue
on mac OS...</div>
<div>Though I've checked and I have SIP
disabled and I have executed "sudo
/usr/sbin/DevToolsSecurity --enable".</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Fri,
Jul 19, 2019 at 4:46 PM Gábor Márton <<a href="mailto:martongabesz@gmail.com" target="_blank">martongabesz@gmail.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">Hi Stefan,
<div><br>
</div>
<div>Since the commit</div>
<div>"[CMake] Always build debugserver
on Darwin and allow tests to use the
system's one"</div>
<div>I cannot use the system debugserver
for testing.</div>
<div>I receive the following
error message from lldb when I execute
"ninja check-lldb":<br>
</div>
<div>```</div>
<div>runCmd: run<br>
runCmd failed!<br>
error: process exited with status -1
(Error 1)<br>
</div>
<div>```</div>
<div><br>
</div>
<div>
<div>I do set
up "-DLLDB_USE_SYSTEM_DEBUGSERVER=ON"
with cmake so I see</div>
</div>
<div>```</div>
<div>-- LLDB tests use out-of-tree
debugserver:
/Library/Developer/CommandLineTools/Library/PrivateFrameworks/LLDB.framework/Resources/debugserver<br>
</div>
<div>```</div>
<div><br>
</div>
<div>Also, I have inspected the
following test output</div>
<div>```</div>
<div>Command invoked: /usr/bin/python
/Users/egbomrt/llvm2/git/llvm/tools/lldb/test/dotest.py
-q --arch=x86_64 -s
/Users/egbomrt/llvm2/build/release_assert/lldb-test-traces
--build-dir
/Users/egbomrt/llvm2/build/release_assert/lldb-test-build.noindex
-S nm -u CXXFLAGS -u CFLAGS
--executable
/Users/egbomrt/llvm2/build/release_assert/./bin/lldb
--dsymutil
/Users/egbomrt/llvm2/build/release_assert/./bin/dsymutil
--filecheck
/Users/egbomrt/llvm2/build/release_assert/./bin/FileCheck
-C
/Users/egbomrt/llvm2/build/release_assert/bin/clang
--codesign-identity -
--out-of-tree-debugserver --arch
x86_64 -t --env TERM=vt100 -p
TestCModules.py --results-port 49931
-S nm --inferior -p TestCModules.py
/Users/egbomrt/llvm2/git/llvm/tools/lldb/packages/Python/lldbsuite/test/lang/c/modules
--event-add-entries worker_index=0:int<br>
1 out of 736 test suites processed -
TestCModules.py<br>
</div>
<div>```</div>
<div>so it seems like the argument for
--out-of-tree-debugserver is
missing...</div>
<div><br>
</div>
Could you please advise?
<div><br>
</div>
<div>Thank you,</div>
<div>Gabor</div>
</div>
</blockquote>
</div>
</blockquote>
</div>
</blockquote>
<pre class="gmail-m_2348790345714622167gmail-m_6493066739990619720gmail-m_-5130856992912908301gmail-m_1946239005957847031gmail-m_8428160405396733394moz-signature" cols="72">--
<a class="gmail-m_2348790345714622167gmail-m_6493066739990619720gmail-m_-5130856992912908301gmail-m_1946239005957847031gmail-m_8428160405396733394moz-txt-link-freetext" href="https://flowcrypt.com/pub/stefan.graenitz@gmail.com" target="_blank">https://flowcrypt.com/pub/stefan.graenitz@gmail.com</a></pre>
</div>
</blockquote>
</div>
</blockquote>
<pre class="gmail-m_2348790345714622167gmail-m_6493066739990619720gmail-m_-5130856992912908301gmail-m_1946239005957847031moz-signature" cols="72">--
<a class="gmail-m_2348790345714622167gmail-m_6493066739990619720gmail-m_-5130856992912908301gmail-m_1946239005957847031moz-txt-link-freetext" href="https://flowcrypt.com/pub/stefan.graenitz@gmail.com" target="_blank">https://flowcrypt.com/pub/stefan.graenitz@gmail.com</a></pre>
</div>
</blockquote>
</div>
</blockquote>
<pre class="gmail-m_2348790345714622167gmail-m_6493066739990619720gmail-m_-5130856992912908301moz-signature" cols="72">--
<a class="gmail-m_2348790345714622167gmail-m_6493066739990619720gmail-m_-5130856992912908301moz-txt-link-freetext" href="https://flowcrypt.com/pub/stefan.graenitz@gmail.com" target="_blank">https://flowcrypt.com/pub/stefan.graenitz@gmail.com</a></pre>
</div>
</blockquote></div>
</blockquote></div>
_______________________________________________<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="https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev</a><br></div></blockquote></div><br></div></div></blockquote></div>