]> git.proxmox.com Git - grub2.git/blame - grub-core/gdb_grub.in
fs/btrfs: Fix more fuzz issues related to chunks
[grub2.git] / grub-core / gdb_grub.in
CommitLineData
2536cf64
LK
1###
2### Load debuging information about GNU GRUB 2 modules into GDB
3### automatically. Needs readelf, Perl and gmodule.pl script
4###
80a71213
VS
5### Has to be launched from the writable and trusted
6### directory containing *.image and *.module
7###
2536cf64
LK
8### $Id: .gdbinit,v 1.1 2006/05/14 11:38:08 lkundrak Exp $
9### Lubomir Kundrak <lkudrak@skosi.org>
10###
11
12# Add section numbers and addresses to .segments.tmp
13define dump_module_sections
14 set $mod = $arg0
15
16 # FIXME: save logging status
17 set logging file .segments.tmp
18 set logging redirect on
19 set logging overwrite off
20 set logging on
21
22 printf "%s", $mod->name
23 set $segment = $mod->segment
24 while ($segment)
dac86b18 25 printf " %i 0x%lx", $segment->section, $segment->addr
2536cf64
LK
26 set $segment = $segment->next
27 end
28 printf "\n"
29
30 set logging off
31 # FIXME: restore logging status
32end
33document dump_module_sections
34 Gather information about module whose mod structure was
35 given for use with match_and_load_symbols
36end
37
38# Generate and execute GDB commands and delete temporary files
39# afterwards
40define match_and_load_symbols
41 shell perl gmodule.pl <.segments.tmp >.loadsym.gdb
42 source .loadsym.gdb
43 shell rm -f .segments.tmp .loadsym.gdb
44end
45document match_and_load_symbols
46 Launch script, that matches section names with information
47 generated by dump_module_sections and load debugging info
48 apropriately
49end
50
51###
52
53define load_module
54 dump_module_sections $arg0
55 match_and_load_symbols
56end
57document load_module
58 Load debugging information for module given as argument.
59end
60
61define load_all_modules
62 set $this = grub_dl_head
63 while ($this != 0)
dac86b18 64 dump_module_sections $this
2536cf64
LK
65 set $this = $this->next
66 end
67 match_and_load_symbols
68end
69document load_all_modules
70 Load debugging information for all loaded modules.
71end
72
73###
74
75set confirm off
76file kernel.exec
77target remote :1234
78
79# inform when module is loaded
80break grub_dl_add
81commands
82 silent
83 load_module mod
84 cont
85end