Skip to content

Commit 6b89731

Browse files
AndrewQuijanolacraig2
authored andcommitted
Dwarf2 now supports ARM and dwarfdump.py fixes
1 parent 497f017 commit 6b89731

4 files changed

Lines changed: 285 additions & 257 deletions

File tree

panda/plugins/dwarf2/README.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,28 @@ Plugin: dwarf2
44
Summary
55
-------
66

7-
The `dwarf2` plugin is to be a replacement of `pri_dwarf` plugin. The workflow is to run
8-
`dwarfdump -dil ${TARGET_PROG} | python -c "import sys;from pandare.extras import dwarfdump;dwarfdump.parse_dwarfdump(sys.stdin.read(), '${TARGET_PROG}')"`.
9-
This is going to generate 4 json DWARF symbol files including: Line Info, Global Variables, Function Info, and Type Info. Place these json files under debug path for this plugin to read.
7+
The `dwarf2` plugin is to be a replacement of `pri_dwarf` plugin.
8+
9+
Before running the plugin, you need to extract DWARF debug information from the target binary into json files using the `pandare.extras.dwarfdump` module. You can do this by running the following commands:
10+
11+
This plug-in/script is used for [LAVA](https://github.com/panda-re/lava), so it assumes that the binary has the following CFLAGS `-O0 -g -gdwarf-2 -fno-stack-protector`.
12+
This is because these flags ensure all the input needed for Python to parse the dwarf dump is available to plant vulnerabilities.
13+
14+
```bash
15+
# Assume TARGET_PROG is the path to the target program with DWARF debug info
16+
dwarfdump -dil ${TARGET_PROG} > tmp.dump
17+
python3 -m pandare.extras.dwarfdump tmp.dump temp
18+
19+
# Alternatively, you can use the following one-liner to achieve the same result:
20+
dwarfdump -dil <binary> | python3 -m pandare.extras.dwarfdump <binary-prefix>
21+
```
22+
This is going to generate 4 JSON DWARF symbol files including:
23+
* Line Info
24+
* Global Variables
25+
* Function Info
26+
* Type Info
27+
28+
Place these JSON files under debug path for this plugin to read.
1029

1130
Arguments
1231
---------

0 commit comments

Comments
 (0)