How to get lldb to work on M1 Big Sur?
Here's the relevant answer from Apple on the entitlements needed to attach the llvm debugger to a process:

https://developer.apple.com/forums/thread/132797

The entitlement needed on macOS is com.apple.security.get-task-allow and I know how to add that in Xcode, but not yet from the command line compiler. You can verify the same on your Mac using console app to show the logs and then reproduce the error. Then search for debugserver in console and you will see the debugger starting and then failing to attach.
Here's a different error if you try to start Calculator.app in the debugger - it's hardened and doesn't have the entitlement so that fails just like your app - it's not about notarization or code signing, but about the debugging entitlement on the binary.
default 19:30:23.088087-0600    debugserver debugserver will use os_log for internal logging.
default 19:30:23.088429-0600    debugserver debugserver-@(#)PROGRAM:LLDB  PROJECT:lldb-1200.0.44
 for arm64.
default 19:30:23.088489-0600    debugserver Got a connection, waiting for process information for launching or attaching.
error   19:30:23.090348-0600    debugserver error: MachTask::TaskPortForProcessID task_for_pid failed: ::task_for_pid ( target_tport = 0x0103, pid = 17889, &amp;task ) =&gt; err = 0x00000005 ((os/kern) failure)
default 19:30:23.090378-0600    debugserver 1 +0.000000 sec [45e2/0303]: error: ::task_for_pid ( target_tport = 0x0103, pid = 17889, &amp;task ) =&gt; err = 0x00000005 ((os/kern) failure) err = ::task_for_pid ( target_tport = 0x0103, pid = 17889, &amp;task ) =&gt; err = 0x00000005 ((os/kern) failure) (0x00000005
default 19:30:23.090329-0600    kernel  macOSTaskPolicy: (com.apple.debugserver) may not get the taskport of (Calculator) (pid: 17889): (Calculator) is hardened, (Calculator) doesn't have get-task-allow, (com.apple.debugserver) is a declared debugger