back to index

Claude Runs LLDB in Screen


Whisper Transcript | Transcript Only Page

00:00:00.000 | I wanted to briefly show how I'm using screen for debug sessions and that was a little bit
00:00:09.800 | motivated because Mario showed that he wrote this MCP server that can manage processes behind the
00:00:15.640 | scenes and for what it's worth I think it's a good use of MCP. But I also kind of wanted to just show
00:00:21.480 | how much Claude can do out of the box if you just give it the right tools. So I have a program here
00:00:29.000 | with segfaults and it's a program that Claude wrote where I made afterwards a bug into it.
00:00:33.920 | I added an off by one somewhere. And really the only thing that I have here is I added into my
00:00:43.940 | Claude MD file that when debugging use LLDB in a well-known screen it should call the screen like
00:00:49.760 | this and when it's done debugging it should close the screen again and then to send strings into the
00:00:58.000 | it should use the $string syntax. That is kind of I think the main thing that it needs to be successful.
00:01:07.880 | Anyways that's the idea. So what I first want to do is I wanted to tell it to run the program. So
00:01:16.820 | in this folder we have a program which segfaults when you run it. You can run it with make run.
00:01:23.840 | Please reproduce the crash. And I'm not sure what's going on. I think I might have turned on something here.
00:01:36.680 | I'm not sure why it took so long. Oh yeah because it's the first time I've run it. Okay. So let's do that.
00:01:44.240 | And then it should basically just run this program and see a segfault call. So far so good.
00:02:00.380 | Now I want you to debug this with LLDB.
00:02:02.400 | And afterwards I want you to fix the bug and run it again.
00:02:08.260 | Okay. So if you're not familiar with what screen is, it's a new program. There's another one called
00:02:18.960 | Tmux. But I think screen might be installed on all machines. I'm not sure. Anyways, I just happen to use screen.
00:02:25.420 | I think it might also have a little bit more of a training data for screen. So I will just attach to
00:02:31.600 | the screen here just to watch it so we can see what it's doing. So it has already started screen here.
00:02:40.800 | Now I tried to run, I had to run, run straight away, but didn't actually start LLDB.
00:02:46.200 | So it terminated my screen. Oh, that's not good.
00:02:51.840 | So now I have a new one.
00:02:55.920 | Let's reconnect. Okay. So now we have a screen that just runs LLDB. Seemingly that's what it wanted to do.
00:03:02.680 | and it has created the target, which means it's going to run this program.
00:03:07.760 | But it didn't, didn't actually run it.
00:03:13.560 | It's eventually going to figure out how it's going to run it.
00:03:20.360 | So in this case, it needs my password because I've done this yet. I don't know.
00:03:27.540 | Okay. But we have reached the point where
00:03:33.480 | it is now looking at the backtrace.
00:03:44.040 | no variables here seemingly.
00:03:46.040 | We might actually have compiled this without debug.
00:03:49.240 | So afterwards I will, I will compile it with a debug flag.
00:04:00.520 | I think it will make it a little bit more useful.
00:04:02.280 | But it has identified the bug.
00:04:05.800 | Now it's going to recompile it.
00:04:10.920 | And run make it worked.
00:04:22.520 | And it's done.
00:04:25.000 | And that's going to kill the screen.
00:04:26.920 | So this is just to show it can do that. Right.
00:04:31.080 | And I, in general, I think like it's, it's just kind of fun to,
00:04:37.640 | to give it access to these tools, which are,
00:04:39.800 | what it has a lot of training data on.
00:04:44.120 | I think it has learned a ton about screen over the years,
00:04:46.760 | that it's able to remote control a program like this.
00:04:49.640 | And yeah, that's, that's basically all I wanted to show,
00:04:54.280 | which is it can run screen to remote control text debugger and can do quite well.