Master the fundamental concepts of binary formats through this focused micro-challenge.
DWARF is the standard debugging data format used by GCC and Clang on Unix-like systems. It stores information about types, variables, functions, and source line numbers inside sections like .debug_info and .debug_line.
DWARF organizes debug data as a tree of Debugging Information Entries (DIEs):
DW_TAG_compile_unit: Root of a compilation unitDW_TAG_subprogram: A function or subroutineDW_TAG_variable: A variableDW_AT_name: Name of the entityDW_AT_low_pc / DW_AT_high_pc: Function address rangeFor example, scanning .debug_info for DW_TAG_subprogram entries with DW_AT_name reveals every function name even when the symbol table has been stripped.
You will implement a simplified DWARF scanner that extracts function names from a .debug_info section. Full DWARF parsing is complex, but this exercise teaches you what GDB uses to map instruction addresses back to source lines.
Beyond function names, .debug_line maps instruction addresses to source file and line number. GDB uses this mapping when you break main.c:42. The abbreviation table in each compilation unit compresses repeated DIE patterns, which is why raw .debug_info bytes look opaque until you decode the abbrev entries. Even a simplified scanner teaches you what debuggers rely on under the hood.
Implement a simplified DWARF function extractor in C.
Requirements:
Test:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
Every task includes starter code, theory, and hidden tests so you can implement and verify locally in the browser.
How it works