Skip to content

Commit 9a35e4c

Browse files
committed
Document failed gdb call, rename file to gdb.md
1 parent 1f79ad5 commit 9a35e4c

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Run one command, get a QEMU Buildroot BusyBox virtual machine built from source
55
1. [**Getting started**](getting-started.md)
66
1. Action
77
1. Step debugging
8-
1. [GDB step debugging](gdb-step-debugging.md)
8+
1. [GDB step debugging](gdb.md)
99
1. [KGDB](kgdb.md)
1010
1. [gdbserver](gdbserver.md)
1111
1. [Other architectures](other-architectures.md)

gdb-step-debugging.md renamed to gdb.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,33 @@ TODO: why can't we break at early startup stuff such as:
102102
./rungdb main
103103

104104
See also: <https://stackoverflow.com/questions/2589845/what-are-the-first-operations-that-the-linux-kernel-executes-on-boot>
105+
106+
## call
107+
108+
GDB can call functions as explained at: <https://stackoverflow.com/questions/1354731/how-to-evaluate-functions-in-gdb>
109+
110+
However this is failing for us:
111+
112+
- some symbols are not visible to `call` even though `b` sees them
113+
- for those that are, `call` fails with an E14 error
114+
115+
E.g.: if we break on `sys_write` on `/count.sh`:
116+
117+
>>> call printk(0, "asdf")
118+
Could not fetch register "orig_rax"; remote failure reply 'E14'
119+
>>> b printk
120+
Breakpoint 2 at 0xffffffff81091bca: file kernel/printk/printk.c, line 1824.
121+
>>> call fdget_pos(fd)
122+
No symbol "fdget_pos" in current context.
123+
>>> b fdget_pos
124+
Breakpoint 3 at 0xffffffff811615e3: fdget_pos. (9 locations)
125+
>>>
126+
127+
even though `fdget_pos` is the first thing `sys_write` does:
128+
129+
581 SYSCALL_DEFINE3(write, unsigned int, fd, const char __user *, buf,
130+
582 size_t, count)
131+
583 {
132+
584 struct fd f = fdget_pos(fd);
133+
134+
See also: <https://github.com/cirosantilli/linux-kernel-module-cheat/issues/19>

0 commit comments

Comments
 (0)