1## Command pie ##
2
3The `pie` command is handy when working with position-independent executables.
4At runtime, it can automatically resolve addresses for breakpoints that are not
5static.
6
7Note that you need to use the **entire `pie` command series** to support PIE
8breakpoints, especially the "`pie` run commands", like `pie attach`, `pie run`,
9etc.
10
11### `pie breakpoint` command ###
12
13This command sets a new PIE breakpoint. It can be used like the normal
14`breakpoint` command in gdb. The argument for the command is the offset from
15the base address or a symbol. The breakpoints will not be set immediately after
16this command. Instead, it will be set when you use `pie attach`, `pie run` or
17`pie remote` to actually attach to a process, so it can resolve the right base
18address.
19
20Usage:
21
22```
23gef➤ pie breakpoint OFFSET
24```
25
26### `pie info` command ###
27
28Since a PIE breakpoint is not a real breakpoint, this command provides a way to
29observe the state of all PIE breakpoints.
30
31This works just like `info breakpoint` in gdb.
32
33```
34gef➤  pie info
35VNum    Num     Addr
361       N/A     0xdeadbeef
37```
38
39VNum stands for virtual number and is used to enumerate the PIE breakpoints.
40Num is the number of the associated real breakpoints at runtime in GDB.
41
42You can omit the VNum argument to get info on all PIE breakpoints.
43
44Usage:
45
46```
47gef➤  pie info [VNum]
48
49```
50
51### `pie delete` command ###
52
53This command deletes a PIE breakpoint given its VNum.
54
55Usage:
56
57```
58gef➤  pie delete [VNum]
59```
60
61### `pie attach` command ###
62
63This command behaves like GDB's `attach` command. Always use this command
64instead of `attach` if you have PIE breakpoints. This will convert the PIE
65breakpoints to real breakpoints at runtime.
66
67The usage is just the same as `attach`.
68
69### `pie remote` command ###
70
71This command behaves like GDB's `remote` command. Always use this command
72instead of `remote` if you have PIE breakpoints. Behind the scenes this will
73connect to the remote target using `gef remote` and then convert the PIE
74breakpoints to real breakpoints at runtime.
75
76The usage is just the same as `remote`.
77
78### `pie run` command ###
79
80This command behaves like GDB's `run` command. Always use this command instead
81of `run` if you have PIE breakpoints. This will convert the PIE breakpoints to
82real breakpoints at runtime.
83
84The usage is just the same as `run`.
85