Skip to contentSkip to conversation

gdb script merged

PATCH Vladimir 'φ-coder/phcoder' Serbinenko 1 participant 2 messages Nov 13, 2011 – Nov 14, 2011 Kbuild

lore
Share & tools
lore
#0 lore raw

Hello, all. Looking though archives I found old script by Lubomir Rintel for gdb. I integrated it into our build system and committed, now you just have to run gdb -x gdb_grub from grub-core directory. It's limited to platforms with predefined load address, so *-efi is excluded but all others platforms should work, didn't test it with anything else than i386-pc though.
At first I wanted to install it as well but then I noticed that it has an important problem:
- It uses insecure temporary files. While fine if you own current directory (like grub-core), it has to use mktemp if to be installed globally.
- I don't know how to implement the logic "check if kernel.exec is in ., if so use it, otherwise use @platformdir@/kernel.exec" in gdb scripts.
Note: @platformdir@ is expanded by automake.
Also I would prefer script to be less chatty and use python but it's not very important.
I attach a simple patch to install those scripts if needed. Also there is a serial-gdb patch in same series, while also interesting it would need more work (and can be integrated with my another work for backtracing on grub_fatal and exceptions)

Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko

=== modified file 'conf/Makefile.common'

Makefile.common +2 -0
@@ -152,6 +152,8 @@
 grubconf_SCRIPTS =
 noinst_LIBRARIES =
 dist_noinst_DATA =
+platform_SCRIPTS =
+platform_PROGRAMS =
 
 TESTS =
 EXTRA_DIST =

=== modified file 'gentpl.py'

gentpl.py +3 -3
@@ -356,7 +356,7 @@
 def module(platform):
     r = set_canonical_name_suffix(".module")
 
-    r += gvar_add("noinst_PROGRAMS", "[+ name +].module")
+    r += gvar_add("platform_PROGRAMS", "[+ name +].module")
     r += gvar_add("MODULE_FILES", "[+ name +].module$(EXEEXT)")
 
     r += var_set(cname() + "_SOURCES", platform_sources(platform) + " ## platform sources")
@@ -384,7 +384,7 @@
 
 def kernel(platform):
     r = set_canonical_name_suffix(".exec")
-    r += gvar_add("noinst_PROGRAMS", "[+ name +].exec")
+    r += gvar_add("platform_PROGRAMS", "[+ name +].exec")
     r += var_set(cname() + "_SOURCES", platform_startup(platform))
     r += var_add(cname() + "_SOURCES", platform_sources(platform))
     r += var_set("nodist_" + cname() + "_SOURCES", platform_nodist_sources(platform) + " ## platform nodist sources")
@@ -409,7 +409,7 @@
 
 def image(platform):
     r = set_canonical_name_suffix(".image")
-    r += gvar_add("noinst_PROGRAMS", "[+ name +].image")
+    r += gvar_add("platform_PROGRAMS", "[+ name +].image")
     r += var_set(cname() + "_SOURCES", platform_sources(platform))
     r += var_set("nodist_" + cname() + "_SOURCES", platform_nodist_sources(platform) + "## platform nodist sources")
     r += var_set(cname() + "_LDADD", platform_ldadd(platform))

=== modified file 'grub-core/Makefile.core.def'

Makefile.core.def +2 -2
@@ -19,13 +19,13 @@
 };
 
 script = {
-  installdir = noinst;
+  installdir = platform;
   name = gmodule.pl;
   common = gmodule.pl.in;
 };
 
 script = {
-  installdir = noinst;
+  installdir = platform;
   name = gdb_grub;
   common = gdb_grub.in;
 };
#1 lore raw

I've created a branch "gdb" for gdb-serial stub. It doesn't all work nice and round (especially if you connect debugger before launching stub) but is useful

Quoted 21 lines · Vladimir 'φ-coder/phcoder' Serbinenko

Hello, all. Looking though archives I found old script by Lubomir Rintel for gdb. I integrated it into our build system and committed, now you just have to run gdb -x gdb_grub from grub-core directory. It's limited to platforms with predefined load address, so *-efi is excluded but all others platforms should work, didn't test it with anything else than i386-pc though.
At first I wanted to install it as well but then I noticed that it has an important problem:
- It uses insecure temporary files. While fine if you own current directory (like grub-core), it has to use mktemp if to be installed globally.
- I don't know how to implement the logic "check if kernel.exec is in ., if so use it, otherwise use @platformdir@/kernel.exec" in gdb scripts.
Note: @platformdir@ is expanded by automake.
Also I would prefer script to be less chatty and use python but it's not very important.
I attach a simple patch to install those scripts if needed. Also there is a serial-gdb patch in same series, while also interesting it would need more work (and can be integrated with my another work for backtracing on grub_fatal and exceptions)

Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko