Tuesday, August 21, 2018
Not anyone should be allowed to run a debugger
I'm working on “Project: America-On-Line-Instant-Messenger” (hey, don't judge me—it has nothing to to with AOL, it's more a pun on the project name than anything else). I've got a major portion of it running, but it's exhibiting some odd behavior—it runs fine on Linux, but fails rather quickly on Mac OS-X with “not enough memory.”
Problem one—I'm used to using gdb
,
but Mac OS-X uses lldb
.
Sigh.
I did find a type of Rosetta Stone that shows similar commands in both gdb
and lldb
,
so that issue is solved.
I was then able to track down the message to a source file in LPeg, but when I set a breakpoint on the line in question, it never got triggered. Puzzling, but I was not able to solve the issue by the time I had to leave work.
So now I'm home and I have an idea to scan more than just the .c
files.
It's a simple matter to log into my Mac workstation at work to see if that's the issue.
I start looking,
and lo,
I find the message in two more locations,
hidden behind a #define
in a header file.
I narrow it down to just one location
(the other location pre-loading the string into the Lua VM).
First,
the lldb
commands are bit more verbose than those of gdb
.
Second,
no matter what I do,
all I get is:
[spc]XXXXXXXXXXXXXXXXXXXXXXXXX>lldb XXXXXXXXX (lldb) target create "XXXXXXXXX" Current executable set to 'XXXXXXXXX' (x86_64). (lldb) process launch -- config.lua error: process exited with status -1 (lost connection) (lldb)
Nothing I do works.
Then I remember—when I first ran lldb
at the office,
this modal dialog box popped up asking for my password in order to debug a program I wrote,
running under my account.
My initial reaction is,
Smooth going, Apple!
Way to protect me from myself!
But then I realize this is probably to prevent rogue programs trying to attach to running programs to do nefarious things without my knowledge.
It's bad enough I have to jump through hoops to get the computer to run my own written programs. Now this?
XXXX!
It really does seem at times as if the general purpose computer is a dinosaur looking up at the sky, wondering, “What is that?”