summaryrefslogtreecommitdiffstats
path: root/grub-core/gmodule.pl.in
diff options
context:
space:
mode:
Diffstat (limited to 'grub-core/gmodule.pl.in')
-rw-r--r--grub-core/gmodule.pl.in30
1 files changed, 30 insertions, 0 deletions
diff --git a/grub-core/gmodule.pl.in b/grub-core/gmodule.pl.in
new file mode 100644
index 0000000..78aa1e6
--- /dev/null
+++ b/grub-core/gmodule.pl.in
@@ -0,0 +1,30 @@
+###
+### Generate GDB commands, that load symbols for specified module,
+### with proper section relocations. See .gdbinit
+###
+### $Id: gmodule.pl,v 1.2 2006/05/14 11:38:42 lkundrak Exp lkundrak $
+### Lubomir Kundrak <lkudrak@skosi.org>
+###
+
+use strict;
+
+while (<>) {
+ my ($name, %sections) = split;
+
+ print "add-symbol-file $name.module";
+
+ open (READELF, "readelf -S $name.mod |") or die;
+ while (<READELF>) {
+ /\[\s*(\d+)\]\s+(\.\S+)/ or next;
+
+ if ($2 eq '.text') {
+ print " $sections{$1}";
+ next;
+ }
+
+ print " -s $2 $sections{$1}"
+ if ($sections{$1} ne '0x0' and $sections{$1} ne '');
+ };
+ close (READELF);
+ print "\n";
+}