summaryrefslogtreecommitdiffstats
path: root/grub-core/gmodule.pl.in
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 16:29:51 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 16:29:51 +0000
commit6e7a315eb67cb6c113cf37e1d66c4f11a51a2b3e (patch)
tree32451fa3cdd9321fb2591fada9891b2cb70a9cd1 /grub-core/gmodule.pl.in
parentInitial commit. (diff)
downloadgrub2-upstream.tar.xz
grub2-upstream.zip
Adding upstream version 2.06.upstream/2.06upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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";
+}