dwarf_read_uleb128(9)
π dwarf_read_uleb128 β ok bestie, let's talk
Heyyy so real quick, we're in the Kernel API Manual today and the star of the show is dwarf_read_uleb128(9). Yes it's a mouthful, yes it's iconic, no you don't have to say it out loud. π
β¨ NAME β¨
dwarf_read_uleb128 β read unsigned LEB128 data. That's it, that's the whole vibe. π¦
πΈ SYNOPSIS πΈ
unsigned long dwarf_read_uleb128 (char *addr , unsigned int *ret );
π«Ά ARGUMENTS π«Ά
addrβ the address where the ULEB128 data is stored. Like, the actual spot in memory where the good stuff lives. πretβ address to store the result. You hand it a pointer, it fills it in. Giving "you do the homework, I'll take the credit" energy but make it C. π
π₯ DESCRIPTION π₯
Okay so what this thing actually does: it decodes an unsigned LEB128 encoded datum. Little variable-length number, very compact, very demure. π
The algorithm is taken from Appendix C of the DWARF 3 spec β not my rules, that's just where it comes from. And if you're curious about the encodings themselves, the spec says go look at the section called "7.6 - Variable Length Data". iykyk. π
Then it returns the number of bytes read. So you always know exactly how far you traveled through memory. Slay. β¨
π SEE ALSO π
Literally the whole squad, all from the kernel file ./arch/sh/kernel/dwarf.c:
dwarf_frame_alloc_reg(9)dwarf_frame_reg(9)dwarf_read_addr(9)dwarf_read_leb128(9)dwarf_read_encoded_value(9)dwarf_entry_len(9)dwarf_lookup_cie(9)dwarf_lookup_fde(9)dwarf_cfa_execute_insns(9)dwarf_free_frame(9)dwarf_unwind_stack(9)dwarf_parse_section(9)module_dwarf_cleanup(9)dwarf_unwinder_init(9)
Go say hi to all of them, they're all main characters in their own way. π«Ά
Not me getting emotional over a variable-length integer decoder π anyway go read the spec, it's giving required reading.
That's the whole page bestie! Sourced straight from ./arch/sh/kernel, dated October 2026, and yes the title is still dwarf_read_uleb128(9) in case you forgot already π mwah, go decode something. π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms