from Hacker News

Show HN: I spent 6 months building a C debugger as a 17-year-old

by D4ckard on 11/11/23, 1:59 PM with 129 comments

Hey HN my name is Thassilo, I'm a student and passionate programmer from Germany.

I want to showcase Spray, a small C debugger I've been working on for a few months now. Spray has a very simple and approachable interface. Its feature set is limited at this point, but it's already enough to tackle some basic problems. I stared to work on Spray because I was curious about how debuggers work. I am also trying to design Spray in such a way that it's easy to grasp and has a small mental overhead.

I'd love to get your feedback on Spray.

Email: d4kd (at) proton (dot) me

PS: I'm generally interested compilers and language tool chains, and I'm looking for similar-minded people to work and collaborate with. I have a few similar projects on my GitHub: https://github.com/d4ckard?tab=repositories. If you find Spray interesting, you might enjoy playing around with them too.

  • by bluetomcat on 11/11/23, 3:50 PM

    Looks especially clean, consistent and well-modularised, tackling a problem that requires non-trivial knowledge about binary formats and kernel APIs. Many "senior" programmers would struggle to build something like this even at a conceptual level. The antithesis of "kids these days" :-)

    Out of curiosity, how does a 17-year-old attain that level of knowledge? Books, peers, programming clubs, parents who are programmers probably?

  • by trmpakufnfee on 11/11/23, 3:38 PM

    Awesome. I wish I had this level of dedication when I was young.

    I recommend you to participate in programs like Google Summer of Code, KDE Season of Code, Linux Foundation LFX, and X.org EVoC. There are some very interesting problems to solve. I wish I had known about them when I was student. Now I am working in Full time job, therefore have no time to contribute to open source.

    Keep up the good work.

  • by koolba on 11/11/23, 3:37 PM

    First glance through the project and it seem well organized. Kudos!

    How long have you been programming and what languages did you start off with? I know quite a few developers decades older than you that still don't know how to write a Makefile [1].

    What's the deal with the inline emojis in the source? Is that what all the cool kids are doing these days or does it just force you to be mindful of non-ASCII input?

    [1]: And even more that cannot write or understand dynamically generated targets...

  • by pjmlp on 11/11/23, 3:40 PM

    Congratulations, good luck with your projects.

    Compilers was one of the first rabbit holes that drove my interest into computing.

    One of the books that I endless read multiple times, is nowadays available for free, and eventually interesting for your reading collection, even though it is about the compiler part not debugging.

    "Compiler Design in C"

    https://holub.com/compiler/

    It is a bit oldie, but maybe interesting.

  • by smithza on 11/11/23, 2:51 PM

    I want to only comment that your level of knowledge and maturity at the age of 17 is very impressive. The topics being investigated and exploited are expected at an undergraduate level and even then, this project would be in the Graduate level course. My hat is off to you and wish you a successful career.
  • by HybridCurve on 11/12/23, 2:10 AM

    I like reading young programmers' code: It's interesting to see how they design everything with a decently high level of knowledge, but not the years of experience. The author seems to be a fast learner, and this is a great result for 6 months of work.
  • by gdcbe on 11/11/23, 7:07 PM

    Seems 17 year old kids do still know what cd’s are. The floppy disk save icon might not be deprecated after all :P
  • by spiralx on 11/11/23, 4:47 PM

    Nice one, I remember writing a 2D graphics library in Turbo Pascal using embedded hand-optimised assembly for the actual drawing code when I was your age, but that was back before I discovered the internet so it ended up being something I'd enjoyed writing but never did anything with, so well done on taking the next step turning it from a personal project to one that other people can see and maybe use themselves - it all looks very tidy, well-commented and the README is clear.

    Putting things out there for the world to see can be a scary thing, but remember that what people say is often as much about them than it is about your work, especially so when what they say is about you.

    PS I'm actually more interested in Motes than this myself, going to experiment with it now :)

  • by IamDaedalus on 11/11/23, 2:40 PM

    GGs dude I'm cloning the code and looking through tonight We share similar interests and I will try to make contributions to your project
  • by gumby on 11/11/23, 2:33 PM

    Debuggers are particularly tricky to write so this is quite good!
  • by zerr on 11/11/23, 6:27 PM

    Awesome! It might be boring for you, but accompanying that project with a "Let's write a debugger" tutorial would be very useful.
  • by eliben on 11/11/23, 9:55 PM

    Really nice work!

    I'm happy you found my articles useful :)

  • by cyberpunk on 11/11/23, 9:13 PM

    Why do you put spaces between your function names and their arguments?

    I find it quite jarring, as someone who's spent a good 18 years reading C code :}

        return lookup_breakpoint (dbg->breakpoints, get_pc (dbg->pid)); 
    
    
    vs

        return lookup_breakpoint(dbg->breakpoints, get_pc(dbg->pid));
    
    
    Edit: I tend to lean towards the 'bsd' style, if you have an open or freebsd system, try 'man style' and try their rules on for size.
  • by WalterBright on 11/12/23, 4:16 AM

    > I stared to work on Spray because I was curious about how debuggers work.

    Awesome. That's the way it's done!

  • by forgotpwd16 on 11/11/23, 8:22 PM

    Cool job. Grats!

    >Parts of the Spray frontend are written in Scheme

    Why you decided it do it that way rather fully in C or fully in Scheme?

  • by demyinn on 11/12/23, 12:50 AM

    Super awesome project!
  • by jacknews on 11/11/23, 2:51 PM

    Very well done, and I hope you build this out further, but please leave out the 'as a 17 yo'. I really don't think it's relevant and risks coming across as cloying - your work should (and does) stand on it's own.
  • by sneed_chucker on 11/11/23, 3:35 PM

    Impressive work.

    Be careful about leaning on your age/precociousness to get approval. It's not a long term solution.

  • by MuffinFlavored on 11/11/23, 8:20 PM

    I always found this a bit weird. Why do you want everybody to know how old you are? It's kind of like... hey, I did this impressive thing, please give me credit, but also, just to give it some flare and kick it up a notch, I'm also super young making it that much more impressive!

    Why couldn't the title be

    > Show HN: I spent 6 months building a C debugger

    Why is your age relevant other than "wow factor"?

  • by SillyUsername on 11/11/23, 10:25 PM

    Well done.

    Achieving this at 17 is a rare feat even most supposed senior developers don't achieve and it ranks up there with writing an emulator.

    It was only in my late 20s I understood low level architecture enough to be able to do similar work, like you through passion, which I never had in my teens (I did start programming Pong like games at 8 years old and Tetris clones around 12/13 but that's hardly the same ;) ).

    Keep up the great work, it restores my faith that their are less code monkeys out their like me!

  • by w4yai on 11/12/23, 3:14 AM

    This is a very nice job. Please don't mind the jealous commenters telling you condescendingly that it's barely "good enough", if you wouldn't told them your age they wouldn't have told you that.

    It's actually an impressive piece of software and you can be proud about it. I love your coding style and I wish everybody could code with the same amount of dedication than you do, I can see your efforts through each line of your source code.

    If you like low level stuff, I encourage you to follow the path I did at your age, that is learning computer security. Specially reverse engineering. There are computer security challenges called "CTF" or "hacking skills challenges" [1].

    If you weren't aware about them, they're filled with brilliant and very curious young people as you are. You could meet some and start wonderful projects you'd be proud of all your life. Generally speaking, I'd encourage you to find peers and start doing bigger things together, even though that being said, this is only an advice from a 32 years old dude that recognize himself through you, and what is the most important thing is to do what you prefer the most. Trust yourself you'll go far !

    PS : if that is relevant, don't be worried about school. Focus on yourself and learn about your mental health. Many people developing an uncommon skill at young age may feel isolated, misunderstood, secluded, etc. Please make sure to be conscious about it and if that is relevant to you and if you need it, please seek help from a therapist, there's no shame about it at all. I'm purely speaking from experience without knowing anything about you, I'm just telling you what I wish someone could told me earlier.

    [1] https://www.root-me.org/?lang=de

  • by lopkeny12ko on 11/11/23, 6:12 PM

    What others need to understand is that, unlike the older generation, kids today have grown up in the era of easily accessible computing. Someone who is 17 today was born in the year the original iPhone was introduced. Computing literacy is not only required, it is expected from a very young age. What might have been impressive to us 20-30 years ago is not really the same as it is now.

    Cool project, but as other commenters have pointed out, the self-promotion of off-putting. Don't hold on to using your age as a qualifier to make you stand out in job applications or otherwise.

  • by white_beach on 11/11/23, 2:56 PM

    at least it is open source unlike some lame debuggers like remedybg
  • by bregma on 11/11/23, 6:03 PM

    So, only self-hosted debugging on x86_64 Linux. A good start.

    Now make it work for other common CPUs (aarch64, RISC-V).

    Make it work for other OSes (FreeBSD has ptrace, for example).

    Make sure it handles signal and thread trampolines, calls through the VDSO, and handwritten assembler that does not have function prologues. Handle C++ constructors and destructors of objects in static storage running before/after main().

    Have it intercept signals. Have it follow the child or the parent after forking. Have it handle multiple threads.

    Make it work with coredumps.

    Make it work on core dumps from a foreign CPU architecture (big-endian PowerPC, for example).

    Make it work with debug symbols in separate files from the executable.

    Make it work with binaries compiled from languages other than C.

    You're going to be busy for the next 20 years or so.