Opened 3 years ago

Closed 23 months ago

Last modified 23 months ago

#63412 closed defect (fixed)

lldb-10 @10.0.1_1 update signing instructions to a working version

Reported by: snowflake (Dave Evans) Owned by: kencu (Ken)
Priority: Normal Milestone:
Component: ports Version: 2.7.99
Keywords: Cc: cooljeanius (Eric Gallager), mascguy (Christopher Nielsen)
Port: lldb-10

Description

OS = macOS 10.11.6

Xcode lldb keeps on crashing, so I wanted to give Macports lldb-10 a try.

I followed the instructions in the activation message to generate a certificate and codesign the server.

lldb-10 is not able to run a program.

Here's a very simple hello program whcih it won't run:

Script started on Fri Aug 27 11:48:10 2021
command: lldb-mp-10 -f hello -X
(lldb) target create "hello"
Current executable set to '/Users/davidevans/junk/hello/hello' (x86_64).
(lldb) list
   5   	main(){
   6   	  int x = 0;
   7   	  while(1){
   8   	    printf("hello world %d\n",x);
   9   	    x++;
   10  	    sleep(1);
   11  	  }
   12  	}
(lldb) br set -n main
Breakpoint 1: where = hello`main + 15 at hello.c:6:7, address = 0x0000000100000f3f
(lldb) run
error: process exited with status -1 (Error 1)
(lldb) quit

Script done on Fri Aug 27 11:48:44 2021

Here's the script I used to codesign the server:

#!/bin/sh

# This note is output after install of lldb-10
# Please follow the instructions at
# https://lldb.llvm.org/resources/build.html#code-signing-on-macos
# and then codesign lldb-server with:

# Note: I deleted resource-rules from --preserve-metadata
# Note I deleted more --preserve-metadata options

sudo codesign --verbose=4 --force --deep \
     --preserve-metadata=identifier,entitlements,requirements \
     --sign "lldb_codesign" \
     /opt/local/libexec/llvm-10/bin/lldb-server

I deleted some of the metadata options because codesign was complaining. I used only the options listed in man codesign. codesign --verify -vv gives this:

/opt/local/libexec/llvm-10/bin/lldb-server: valid on disk
/opt/local/libexec/llvm-10/bin/lldb-server: satisfies its Designated Requirement

Change History (11)

comment:1 Changed 3 years ago by kencu (Ken)

hmm. Have you had success with something like lldb-5.0 or lldb-7.0? Those are closer to the system's vintage, and might work better...

There is also an option in the cmake scripts to build lldb to use the system's debug-server instead of an installed one that is worth knowing about...

comment:2 in reply to:  1 Changed 3 years ago by snowflake (Dave Evans)

Replying to kencu:

hmm. Have you had success with something like lldb-5.0 or lldb-7.0? Those are closer to the system's vintage, and might work better...

It must be a silly certificate problem. I deleted the key and certificate and regenerated them using the script in lldb-10 source. I signed lldb-5.0 but the problem still persists.

Needless to say, it all works perfectly on my new Mac with Monterey and lldb-12

comment:3 Changed 3 years ago by snowflake (Dave Evans)

SUCCESS!

I deactivated and activated lldb-5.0 and signed it by following the activate message, and it now works both for running a file and attaching to a PID.

comment:4 Changed 3 years ago by snowflake (Dave Evans)

lldb-10 success!

For lldb-10, I signed it with:

sudo codesign --force --deep --preserve-metadata=identifier,entitlements,resource-rules,requirements,flags,team-identifier \
--sign lldb_codesign /opt/local/libexec/llvm-10/bin/debugserver

lldb-10 now runs files and attaches to PIDs.

The activate message said to sign lldb-server; could this be wrong?

comment:5 Changed 3 years ago by kencu (Ken)

The message might easily be wrong -- I don't think that part of the llvm/clang/lldb infrastructure gets a lot of heavy use :>

Thanks for working it through. I'll see if the port notes need to be updated (to something that actually works :> ).

comment:6 Changed 3 years ago by kencu (Ken)

Summary: lldb-10 @10.0.1_1 debugger will not run programslldb-10 @10.0.1_1 update signing instructions to a working version

comment:7 Changed 3 years ago by snowflake (Dave Evans)

The features matrix in https://lldb.llvm.org/status/status.html seems a bit confused as well. macOS is the only system that uses debugserver for remote debugging.

What is lldb-server used for? I'm confused as well.

comment:8 Changed 3 years ago by cooljeanius (Eric Gallager)

Cc: cooljeanius added

comment:9 Changed 23 months ago by mascguy (Christopher Nielsen)

Resolution: fixed
Status: assignedclosed

It looks like the notes match with what is needed, per comment:4. And they've recently been amended, now that the code-signing script is included for lldb-8.0 through lldb-14.

comment:10 Changed 23 months ago by mascguy (Christopher Nielsen)

Cc: mascguy added

comment:11 Changed 23 months ago by Christopher Nielsen <mascguy@…>

In 9573b9dc85a0f00ac5c31f07d9eeea4caefe8412/macports-ports (master):

lldb-xx: codesign notes: include real identity name
See: #63412

Note: See TracTickets for help on using tickets.