Skip to content

Commit

Permalink
Enhance LLDB support and debugging documentation
Browse files Browse the repository at this point in the history
- Enhance development shell by including `lldb` in `flake.nix`
- Update `README.md` with LLDB debugging instructions for `day01`
  • Loading branch information
thekorn committed Dec 2, 2024
1 parent cf13c0b commit 9492f28
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,26 @@ zig build install_all -Doptimize=ReleaseSmall # or

hyperfine -r 50 './zig-out/bin/day01'
```

## debugging

```sh
LLDB_DEBUGSERVER_PATH=/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/Resources/debugserver lldb zig-out/bin/day01  ✔  9.107s   󱄅  20.11.1  16:24:49 
(lldb) target create "zig-out/bin/day01"
Current executable set to '/Users/d438477/devel/github.com/thekorn/aoc-2024-zig/zig-out/bin/day01' (arm64).
(lldb) breakpoint set -f day01.zig -l 76
Breakpoint 1: where = day01`day01.main + 40 at day01.zig:76:5, address = 0x0000000100003ad4
(lldb) r
Process 53435 launched: '/Users/d438477/devel/github.com/thekorn/aoc-2024-zig/zig-out/bin/day01' (arm64)
Process 53435 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x0000000100003ad4 day01`day01.main at day01.zig:76:5
73 }
74
75 pub fn main() !void {
-> 76 const content = @embedFile("./data/day01.txt");
77 const result1 = try part1(content);
78 utils.print("Result day 1 - part 1: {any}\n", .{result1});
79 const result2 = try part2(content);
(lldb) ^D
```
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
zig-overlay.packages.${system}."master-2024-11-30"
zls-master.packages.${system}.default

lldb
hyperfine
];
};
Expand Down

0 comments on commit 9492f28

Please sign in to comment.