[HN Gopher] Show HN: I spent 6 months building a C debugger as a...
___________________________________________________________________
Show HN: I spent 6 months building a C debugger as a 17-year-old
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.
Author : D4ckard
Score : 270 points
Date : 2023-11-11 13:59 UTC (9 hours ago)
(HTM) web link (github.com)
(TXT) w3m dump (github.com)
| gumby wrote:
| Debuggers are particularly tricky to write so this is quite good!
| D4ckard wrote:
| Thanks, it's been quite a struggle at times : D
| gumby wrote:
| Yeah, I started working on a pre-existing debugger around the
| same age as you (this was the ITS debugger DDT, so 40+ years
| ago) and boy, it was full of puzzling counterintuitive stuff.
|
| And it was just an assembly debugger so minimal debugging
| symbols. Merely reading some DWARF data is impressive enough.
| DWARF makes sense to me but that's only because I worked with
| other debugging formats and compiler output of same, before
| and during the evolution of DWARF. I can imagine it's hard to
| understand when you start cold with DWARF 5.
| D4ckard wrote:
| DWARF 5 is truly ... special. My mind was blown when I
| understood that half of its data is encoded as instructions
| for full-blown stack-based VM.
| IamDaedalus wrote:
| 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
| D4ckard wrote:
| Wow, this sounds great. Please hit me up at any time if you
| have questions about the code. I left behind comments most
| places, but I don't know if all of them are helpful.
| smithza wrote:
| 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.
| fuzzfactor wrote:
| I'm impressed too, this is an excellent head start.
|
| Years later as a still-young technology enthusiast it would be
| likely that even more impressive projects will be accomplished.
| By then it may be largely unknown how advanced this was at this
| young of an age. Simply because there will be other sharp minds
| that do impressive stuff but only got started in their 20's,
| and reaching the same age they would be considered by most
| observers as peers.
|
| But this head start will be an unfair advantage that can be
| made to last forever anyway.
|
| Even if it does turn out to be kind of like a "secret weapon"
| after a number of years or decades.
| superduty wrote:
| Why is the advantage of early learning and understanding
| "unfair"?
| thelock85 wrote:
| I read it in a "first to market" unfair advantage type of
| way, not ethically unfair. Of course, there are larger
| societal questions around access to early learning
| opportunities but I didn't read into it that way.
| jacknews wrote:
| 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.
| raarts wrote:
| As a (former) employer I definitely think his age is relevant.
| jacknews wrote:
| It's maybe relevant on a CV, not so on HN, which is for 'look
| at this', not 'look at me'.
| InCityDreams wrote:
| ...remembering what i was doing at 17, it's relevant to
| myself, and i reckon future employers and also education
| establishments may find it relevant.
| raarts wrote:
| So you think employers don't look on HN?
| SushiHippie wrote:
| I think it's okay, otherwise this wouldn't have landed on
| the front page (less likely at least). And it's only on HN
| and not on the GitHub repo. If it would be stated on
| GitHub, I'd agree with you.
| ricardobeat wrote:
| It could have easily landed on the home page without the
| age mention. There are 10-20k links on the front page
| every year.
| cinntaile wrote:
| Editorialized headlines are against HN guidelines.
| flykespice wrote:
| Judging your candidate by age than skill is what perpetuates
| the gross ageism on the IT sector.
|
| Gladly you got demoted from the position
| 29athrowaway wrote:
| It is an achievement that requires courage, specialization and
| training... the latter require time and focus.
|
| This guy did it at an early age, showing great promise for the
| years to come.
| brynbryn wrote:
| I disagree about the age. It provides context, and provides
| inspiration to others. I think he has done a fantastic thing
| and we don't need to be negative for the sake of being negative
| ricardobeat wrote:
| You're right about the inspirational aspect, but when
| highlighted by the author themselves it does feel a bit
| unnecessary, and it detracts from the project. Half of the
| comments are on the subject of age.
| schleck8 wrote:
| Please include the 17 yo part, I think it's very interesting.
| white_beach wrote:
| at least it is open source unlike some lame debuggers like
| remedybg
| sneed_chucker wrote:
| Impressive work.
|
| Be careful about leaning on your age/precociousness to get
| approval. It's not a long term solution.
| koolba wrote:
| 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..._
| D4ckard wrote:
| I started off learning Python and C++. At some point I got fed
| up with C++ and switched to C.
|
| Haha, the emoji thing was something I was doing for about a
| week or so. You see emojis used a lot more around Rust I guess.
| I never bothered to remove them. I think the bugs around the
| PID are fun. The ones in the comments might go at some point,
| though I didn't experience any problems with editors (Helix,
| Emacs, and VSCode all work) so far.
|
| Should I maybe disabled printing emojis to standard output in
| the REPL if terminal colors are disabled as well?
| koolba wrote:
| > I started off learning Python and C++. At some point I got
| fed up with C++ and switched to C.
|
| How many years and hours per day?
|
| > Should I maybe disabled printing emojis to standard output
| in the REPL if terminal colors are disabled as well?
|
| I generally avoid anything that's not ASCII if it's possible.
| Tying it to terminal colors or terminal output (e.g. "if [ -t
| 1 ] ...") is common too. Though I'm not a big fan of things
| changing based on the runtime environment as it makes
| debugging annoying.
| trmpakufnfee wrote:
| 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.
| D4ckard wrote:
| Thanks for pointing me to those projects! I didn't know about
| any of them.
| xvilka wrote:
| We (Rizin and Cutter) usually participate in GSoC, so if we
| are accepted next year as an organization, you could apply.
| See our previous programs[1][2][3].
|
| [1] http://rizin.re/gsoc/2023/
|
| [2] https://rizin.re/posts/gsoc-2023-announcement/
|
| [3] https://rizin.re/posts/gsoc-2023-dwarf/
| D4ckard wrote:
| Thanks the links : D
| pjmlp wrote:
| 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.
| D4ckard wrote:
| Thank you for the link. I'm always looking for books on
| compilers, but they can be hard to find. Many of them are every
| _from the ivory tower_ -like unfortunately.
| junior44660 wrote:
| Try "crafting interpreters", it's very practical book.
| bluetomcat wrote:
| 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?
| D4ckard wrote:
| It's mostly books and blogs: I like to read a lot. Also, your
| guess is correct, my dad is a computer scientist.
| manicennui wrote:
| Reading books to increase your understanding puts you ahead
| of 90% of people who graduated from a CS program in the last
| 5-10 years from what I've seen. Several of my coworkers
| admitted to having never read a book on anything related to
| software engineering before and it shows.
| flykespice wrote:
| To be honest these days articles on the web seem to be more
| efficient means to attain knowledge than a book, with less
| condensed words
| up2isomorphism wrote:
| Because there is no software engineering manager who likely
| does not write any useful code for a long time and is telling
| engineers what to do.
| ManuelKiessling wrote:
| Tangential: my gut feeling is that this is a very good use case
| for GPTs; I'm an experienced application developer and
| sysadmin, but wouldn't even know where to start if I'd want to
| tackle this sort of topic. I'm pretty sure ChatGPT would point
| me in the right direction and allow me to tackle the first
| important steps.
| sdwr wrote:
| Yeah this is the dream for ChatGPT. Someone with enthusiasm,
| some knowledge, and tons of free time.
| thibaut_barrere wrote:
| I can reply because I was in the same situation at a younger
| age, at a time with no internet then limited internet.
|
| Raw curiosity & having "just access to the required hardware"
| (a huge "just") and a bit of books & magazines can take you a
| long way.
|
| My parents were not programmers but my father bought computers
| early on (1984), and later brought compilers at home (via his
| work), e.g. TurboPascal, C++, and let me experiment.
|
| I learned mostly via magazines & books, and later a bit of
| exchanges with peers (demomaking), and also via buying disks
| (https://fr.wikipedia.org/wiki/DP_Tool_Club) that contained
| documentation (such as
| https://en.wikipedia.org/wiki/Ralf_Brown%27s_Interrupt_List)
| and arrived via snail mail.
|
| I "just" gradually iterated and coded small stuff, then
| gradually more complicated stuff (Windowing toolkit in CGA, a
| Tetris clone, a Bomberman clone, FFT software, and ultimately
| 3D realtime rendering without any FPU, only in software, with
| Phong rendering and such
| https://github.com/thbar/demomaking#obez-1995).
|
| I was not an isolated case in the sense I ended up stumbling on
| other teenagers (via the demomaking world) who did exactly the
| same thing.
|
| Today a curious kid can go probably much further, as long as
| curiosity is encouraged :-)
| flashgordon wrote:
| Wow this is amazing. My question on top of yours is beyond just
| knowledge (which yes yes I know I am underrating) how does a 17
| year old get this kind of passion. (Not to brag) I was very
| fortunate to have this kind of passion in my early teens (also
| I did not have many friends) but I am really struggling to get
| my kids and their friends this kind of passion!
| forgotpwd16 wrote:
| >how does a 17-year-old attain that level of knowledge?
|
| There's an excellent blog series linked at repo that guides you
| step-by-step.
| spiralx wrote:
| 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 :)
| D4ckard wrote:
| Oh, I just noticed some bugs in the code while using Motes the
| other day. Expect some weirdness with the Emacs plugin. The
| scripts have been working flawlessly for me the past few weeks
| though. I hope you like them :D
| bregma wrote:
| 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.
| brancz wrote:
| I just spent ~1.5 years of my life on various aspects of
| debuginfos and that even just for profiling where I only need
| line/column information. So I feel this comment through and
| through.
| D4ckard wrote:
| Yeah, I don't think so. It's x86_64 only, and C only too. Some
| points from your list make sense now, but most of it is simply
| not part of Spray's scope, and never has been ...
| thibaut_barrere wrote:
| Not commenting on the debugger specifically, but: keep being
| curious & experimenting, it will go a long way :-) (I was in
| your shoes)
| lopkeny12ko wrote:
| The point the parent commenter is trying to make is that
| building a general purpose C debugger is not some kind of
| trivial exercise that can be shipped in 6 months, and
| claiming to have done so is disingenuous and pompous.
| thibaut_barrere wrote:
| > claiming to have done so is disingenuous and pompous.
|
| I don't read anything that might express that?
|
| Especially with:
|
| >> Its feature set is limited at this point, but it's
| already enough to tackle some basic problems.
| roadbuster wrote:
| The parent commenter doesn't need to piss on a 17 year old
| for sharing their work and progress. You could also take a
| moment to step back and reflect on this.
| dang wrote:
| Please don't respond to a bad comment by breaking the
| site guidelines yourself. That only makes things worse.
|
| https://news.ycombinator.com/newsguidelines.html
| dang wrote:
| Please don't cross into name-calling and certainly not
| personal attack.
|
| https://news.ycombinator.com/newsguidelines.html
| owenpalmer wrote:
| > building a general purpose C debugger is not some kind of
| trivial exercise
|
| Yes
|
| > claiming to have done so is disingenuous and pompous
|
| Nobody has claimed to do so in this situation. You are
| inventing conflict. Also I don't think bregma intended to
| be this targeting or accusatory, why are you speaking for
| them?
| lopkeny12ko wrote:
| 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.
| vimy wrote:
| It's the opposite. Computer literacy has gone down for gen Z,
| iOS and Android are too simple and locked down.
|
| So this is very impressive at that age.
| marcus0x62 wrote:
| Did you read the first paragraph after you wrote it? If you
| did, and then posted it anyway, I don't really know what to
| say. But, in any case, "Computing literacy" != "wrote a
| debugger."
|
| Your post comes off more delusional (or just ignorant) than the
| OP ever came off as self-promotional.
| dang wrote:
| Please don't cross into name-calling or personal attack,
| regardless of how wrong another comment is or you feel it is.
|
| https://news.ycombinator.com/newsguidelines.html
| zerr wrote:
| Awesome! It might be boring for you, but accompanying that
| project with a "Let's write a debugger" tutorial would be very
| useful.
| gdcbe wrote:
| Seems 17 year old kids do still know what cd's are. The floppy
| disk save icon might not be deprecated after all :P
| MuffinFlavored wrote:
| 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"?
| codetrotter wrote:
| It's very common for teenagers to do so. I did the same when I
| was their age. No reason to question why they do it, it's just
| a thing teenagers do.
| MuffinFlavored wrote:
| > No reason to question why they do it,
|
| No, then they'll never learn that it is received by "adults"
| as "unnecessarily extra-attention seeking".
|
| Most people who like to share stuff are seeking validation
| one way or another (myself included).
|
| It might be worthwhile for OP to step back and ask "why am I
| seeking validation from strangers online to find what I post
| impressive"?
| thibaut_barrere wrote:
| Maybe he didn't come here to receive a therapy :-)
|
| Maybe it's just cool to connect with people similarly
| minded and share what everyone is doing, not necessarily
| for attention seeking, but because it improves everyone's
| situation by sharing extra knowledge?
|
| Just sharing what I did at a younger age brought me
| extraordinary connections at the time, some who still are
| friends 30 years later.
| skullone wrote:
| Because this is a highly unusual and complex thing for someone
| that young to accomplish? We should applaud them for their
| dedication and results. There's soooop much that can distract
| youth (or anyone of any age) from completing a pursuit like
| this. To the point I find your comment to be pedantic and
| ageist.
| badrabbit wrote:
| Your expectation that age should have prevented OP from doing
| cool things is what is ageist and harmful to the success of
| youth. A 17 year old can revolutionize the world if they
| wanted to, lest you "adults" set such a low bar.
| _Algernon_ wrote:
| This is a highly unusual and complex thing for anyone to
| accomplish. Why not let the achievement stand for itself?
|
| Mentioning one's age screams insecurity (though to be fair,
| that is to be expected from teenagers). And as this comment
| chain illustrates it also partially derails the conversation
| to discussing his age, instead of his actual achievement.
| badrabbit wrote:
| I was about to make a similar comment. The project is
| impressive but a bit annoyed because he attached his age to it.
|
| OP, you'll do cool stuff. Your age, location,sex, etc... has
| nothing to do with it. A 60yr old hobo and a 17yr old kid who
| know nothing about programming are at an equal footing, what
| each accomplishes is the result of how much time and effort
| they put into it (not neccesarily the same).
|
| If you were like a 5 year old that'd be noteworthy but reading,
| writing, knowing how to use a computer and time is all that is
| needed for coding, unless you are out there creating or
| implementing sophisticated algorithms that require background
| mathematical knowledge.
|
| I'd love to be corrected on this but there isn't anything you
| learn in school beyond like the 6th grade that is needed to
| succeed as a coder (not SWE, just programming and creating cool
| stuff).
|
| I hope you let the coolness of your work speak for itself in
| the future OP.
| 2C64 wrote:
| Different strokes, but the context in which something is built
| can be just as interesting as what is built when it is unusual.
| See also the post recently about the open source contributor
| working from a prison in Maine - that's interesting for a ton
| of reasons.
|
| In this case there are two interesting things: that they built
| a debugger and that they are 17. The latter information might
| also lead to more interesting helpful comments for the kid
| versus a "okay, and?" series of responses.
|
| And at the end of the day, every Show HN has a bit of "hey,
| notice me!" in it - whether or not age or other identifying
| information is included. I don't think that's bad.
| pvg wrote:
| If you squint, 'no weird meta nitpickery' is not hard to derive
| from most of https://news.ycombinator.com/showhn.html
| forgotpwd16 wrote:
| 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?
| cyberpunk wrote:
| 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.
| valleyer wrote:
| It's GNU style, which some people prefer.
|
| https://www.gnu.org/prep/standards/standards.html#Syntactic-...
| cyberpunk wrote:
| Damn, I really have been in my cave for too long! Forgot all
| about their weird if {}.
|
| Thanks!
| darkwater wrote:
| Off-topic but I can not avoid a tear of joy reading this:
|
| > In the Unix world, "portability" refers to porting to
| different Unix versions. For a GNU program, this kind of
| portability is desirable, but not paramount.
|
| The primary purpose of GNU software is to run on top of the
| GNU kernel, compiled with the GNU C compiler, on various
| types of CPU. So the kinds of portability that are absolutely
| necessary are quite limited. But it is important to support
| Linux-based GNU systems, since they are the form of GNU that
| is popular.
| eliben wrote:
| Really nice work!
|
| I'm happy you found my articles useful :)
| SillyUsername wrote:
| 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!
| silentsea90 wrote:
| I feel like a code sloth/donkey if you with your achievements
| are a code monkey. I think we need a hierarchy of animals here.
| I'll fit right at the bottom thank you.
___________________________________________________________________
(page generated 2023-11-11 23:00 UTC)