summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README39
-rw-r--r--TODO23
2 files changed, 62 insertions, 0 deletions
diff --git a/README b/README
new file mode 100644
index 0000000..6ab58c2
--- /dev/null
+++ b/README
@@ -0,0 +1,39 @@
+dwarf-extract-struct
+====================
+
+Simple utility to extract struct as header file from binary
+debug informations
+
+
+Usage
+=====
+
+There's a trivial Makefile for now, just run `make` and run the program.
+
+Once built, `dwarf-extract-struct` takes for arguments:
+ - path to the binary you want to extract debug informations from
+(must be built with -g and not stripped, alternatively it can be a
+'.debug' file)
+ - the name of the struct you want to mimic
+ - the name of the fields you want to extract
+
+For example, on itself:
+```
+$ ./dwarf-extract-struct dwarf-extract-struct _IO_FILE _markers _IO_buf_base
+struct _IO_FILE {
+ union {
+ char whole_struct[216];
+ struct {
+ char padding0[56];
+ char *_IO_buf_base;
+ };
+ struct {
+ char padding1[96];
+ struct _IO_marker *_markers;
+ };
+ };
+};
+```
+
+
+This is work in progress, interface will likely change.
diff --git a/TODO b/TODO
new file mode 100644
index 0000000..bcabb9c
--- /dev/null
+++ b/TODO
@@ -0,0 +1,23 @@
+Orderless todo:
+
+ - add option to extract all members of given struct
+
+ - add option to recursively dump any struct inside requested struct
+(only fill in padding or resue option to extract all members? figure
+another syntax to specify substruct.field?)
+
+ - add option to list all the structs available in a file
+
+ - add option to list all the fields available for a struct (I guess
+that's close enough to extracting, but might be more human readable)
+
+ - refactor some (in particular add wrappers/helpers around dwarf
+functions so we abort properly checking both error and !ok, with
+clear error messages)
+
+ - log levels ?
+
+ - pack elements into the same union member when sizes are appropriate
+(need to be careful about embedded structs when we're not in recurse
+mode? or have a mode that replaces 'em with char[x]?)
+