* [PATCH] Make gdb debugging a bit less painful
@ 2008-04-14 22:30 Lubomir Kundrak
2008-04-15 13:21 ` Robert Millan
` (2 more replies)
0 siblings, 3 replies; 16+ messages in thread
From: Lubomir Kundrak @ 2008-04-14 22:30 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1: Type: text/plain, Size: 532 bytes --]
These are pretty self-explainable. I think I tried to sumbit these
changes with the serial debugging patch year and some months ago and I
was told to sign the copyright assignment. I have already done that
now. :)
2008-04-15 Lubomir Kundrak <lkundrak@redhat.com>
* kern/main.c (grub_main) [!GRUB_UTIL]: Alias grub_main to main,
so that gdb is able to find stack top.
* genmk.rb: replace strip with objcopy, so unstripped files are
left untouched for debugging purposes.
--
Lubomir Kundrak (Red Hat Security Response Team)
[-- Attachment #2: grub-1.95-debuginfo.patch --]
[-- Type: text/x-patch, Size: 1687 bytes --]
diff -rup grub-1.95.orig/kern/main.c grub-1.95/kern/main.c
--- grub-1.95.orig/kern/main.c 2007-01-29 15:31:36.000000000 +0100
+++ grub-1.95/kern/main.c 2007-01-30 18:29:55.000000000 +0100
@@ -106,6 +106,14 @@ grub_load_normal_mode (void)
grub_errno = GRUB_ERR_NONE;
}
+#ifndef GRUB_UTIL
+/*
+ * Let GDB find the stack top
+ */
+void
+main (void) __attribute__ ((alias("grub_main")));
+#endif
+
/* The main routine. */
void
grub_main (void)
--- grub-1.95.cvs20071119.orig/genmk.rb 2007-11-27 10:58:52.000000000 +0100
+++ grub-1.95.cvs20071119/genmk.rb 2007-11-27 11:17:58.000000000 +0100
@@ -101,10 +101,11 @@
mod_obj = mod_src.suffix('o')
defsym = 'def-' + @name.suffix('lst')
undsym = 'und-' + @name.suffix('lst')
+ exec = @name.suffix('exec')
mod_name = File.basename(@name, '.mod')
symbolic_name = mod_name.sub(/\.[^\.]*$/, '')
- "CLEANFILES += #{@name} #{mod_obj} #{mod_src} #{pre_obj} #{objs_str} #{undsym}
+ "CLEANFILES += #{@name} #{mod_obj} #{mod_src} #{pre_obj} #{objs_str} #{undsym} #{exec}
ifneq ($(#{prefix}_EXPORTS),no)
CLEANFILES += #{defsym}
DEFSYMFILES += #{defsym}
@@ -112,10 +113,13 @@
MOSTLYCLEANFILES += #{deps_str}
UNDSYMFILES += #{undsym}
-#{@name}: #{pre_obj} #{mod_obj}
+#{@name}: #{exec}
+ -rm -f $@
+ $(OBJCOPY) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment -R .note.gnu.build-id $^ $@
+
+#{exec}: #{pre_obj} #{mod_obj}
-rm -f $@
$(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ $^
- $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment -R .note.gnu.build-id $@
#{pre_obj}: $(#{prefix}_DEPENDENCIES) #{objs_str}
-rm -f $@
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [PATCH] Make gdb debugging a bit less painful 2008-04-14 22:30 [PATCH] Make gdb debugging a bit less painful Lubomir Kundrak @ 2008-04-15 13:21 ` Robert Millan 2008-04-15 13:38 ` Robert Millan 2008-04-15 19:01 ` Pavel Roskin 2 siblings, 0 replies; 16+ messages in thread From: Robert Millan @ 2008-04-15 13:21 UTC (permalink / raw) To: The development of GRUB 2 On Tue, Apr 15, 2008 at 12:30:40AM +0200, Lubomir Kundrak wrote: > These are pretty self-explainable. I think I tried to sumbit these > changes with the serial debugging patch year and some months ago and I > was told to sign the copyright assignment. I have already done that > now. :) > > 2008-04-15 Lubomir Kundrak <lkundrak@redhat.com> > > * kern/main.c (grub_main) [!GRUB_UTIL]: Alias grub_main to main, > so that gdb is able to find stack top. > * genmk.rb: replace strip with objcopy, so unstripped files are > left untouched for debugging purposes. How do you use gdb with GRUB? QEMU? If you just fixed backtrace dumping with grub/qemu/gdb, that'd make me quite happy :-) -- Robert Millan <GPLv2> I know my rights; I want my phone call! <DRM> What use is a phone call… if you are unable to speak? (as seen on /.) ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Make gdb debugging a bit less painful 2008-04-14 22:30 [PATCH] Make gdb debugging a bit less painful Lubomir Kundrak 2008-04-15 13:21 ` Robert Millan @ 2008-04-15 13:38 ` Robert Millan 2008-04-17 11:53 ` Lubomir Kundrak 2008-04-15 19:01 ` Pavel Roskin 2 siblings, 1 reply; 16+ messages in thread From: Robert Millan @ 2008-04-15 13:38 UTC (permalink / raw) To: The development of GRUB 2 On Tue, Apr 15, 2008 at 12:30:40AM +0200, Lubomir Kundrak wrote: > diff -rup grub-1.95.orig/kern/main.c grub-1.95/kern/main.c > --- grub-1.95.orig/kern/main.c 2007-01-29 15:31:36.000000000 +0100 > +++ grub-1.95/kern/main.c 2007-01-30 18:29:55.000000000 +0100 > @@ -106,6 +106,14 @@ grub_load_normal_mode (void) > grub_errno = GRUB_ERR_NONE; > } > > +#ifndef GRUB_UTIL > +/* > + * Let GDB find the stack top > + */ > +void > +main (void) __attribute__ ((alias("grub_main"))); > +#endif grub_main() isn't always the function we want for top of the stack. For example cmain() in kern/ieee1275/cmain.c does quite a bit of things already. I'm not sure what would be an ellegant way to solve this... :-/ -- Robert Millan <GPLv2> I know my rights; I want my phone call! <DRM> What use is a phone call… if you are unable to speak? (as seen on /.) ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Make gdb debugging a bit less painful 2008-04-15 13:38 ` Robert Millan @ 2008-04-17 11:53 ` Lubomir Kundrak 2008-04-17 20:11 ` Robert Millan 0 siblings, 1 reply; 16+ messages in thread From: Lubomir Kundrak @ 2008-04-17 11:53 UTC (permalink / raw) To: The development of GRUB 2 On Tue, 2008-04-15 at 15:38 +0200, Robert Millan wrote: > On Tue, Apr 15, 2008 at 12:30:40AM +0200, Lubomir Kundrak wrote: > > diff -rup grub-1.95.orig/kern/main.c grub-1.95/kern/main.c > > --- grub-1.95.orig/kern/main.c 2007-01-29 15:31:36.000000000 +0100 > > +++ grub-1.95/kern/main.c 2007-01-30 18:29:55.000000000 +0100 > > @@ -106,6 +106,14 @@ grub_load_normal_mode (void) > > grub_errno = GRUB_ERR_NONE; > > } > > > > +#ifndef GRUB_UTIL > > +/* > > + * Let GDB find the stack top > > + */ > > +void > > +main (void) __attribute__ ((alias("grub_main"))); > > +#endif > > grub_main() isn't always the function we want for top of the stack. For > example cmain() in kern/ieee1275/cmain.c does quite a bit of things already. > > I'm not sure what would be an ellegant way to solve this... :-/ Well, then more preprocessor conditionals come into play. Wold there be any problems with that? -- Lubomir Kundrak (Red Hat Security Response Team) ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Make gdb debugging a bit less painful 2008-04-17 11:53 ` Lubomir Kundrak @ 2008-04-17 20:11 ` Robert Millan 2008-04-18 2:21 ` Pavel Roskin 0 siblings, 1 reply; 16+ messages in thread From: Robert Millan @ 2008-04-17 20:11 UTC (permalink / raw) To: The development of GRUB 2 On Thu, Apr 17, 2008 at 01:53:21PM +0200, Lubomir Kundrak wrote: > > On Tue, 2008-04-15 at 15:38 +0200, Robert Millan wrote: > > On Tue, Apr 15, 2008 at 12:30:40AM +0200, Lubomir Kundrak wrote: > > > diff -rup grub-1.95.orig/kern/main.c grub-1.95/kern/main.c > > > --- grub-1.95.orig/kern/main.c 2007-01-29 15:31:36.000000000 +0100 > > > +++ grub-1.95/kern/main.c 2007-01-30 18:29:55.000000000 +0100 > > > @@ -106,6 +106,14 @@ grub_load_normal_mode (void) > > > grub_errno = GRUB_ERR_NONE; > > > } > > > > > > +#ifndef GRUB_UTIL > > > +/* > > > + * Let GDB find the stack top > > > + */ > > > +void > > > +main (void) __attribute__ ((alias("grub_main"))); > > > +#endif > > > > grub_main() isn't always the function we want for top of the stack. For > > example cmain() in kern/ieee1275/cmain.c does quite a bit of things already. > > > > I'm not sure what would be an ellegant way to solve this... :-/ > > Well, then more preprocessor conditionals come into play. Wold there be > any problems with that? Now that I think of it, is there any reason for doing all the cmain() cruft before grub_main() ? Getting to grub_main() only requires a working stack, which we have, and grub_main() inmediately returns control back to architecture-specific code in grub_machine_init(). So why not move from: _start -> cmain -> grub_main to: _start -> grub_main -> grub_machine_init -> cmain ? -- Robert Millan <GPLv2> I know my rights; I want my phone call! <DRM> What use is a phone call… if you are unable to speak? (as seen on /.) ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Make gdb debugging a bit less painful 2008-04-17 20:11 ` Robert Millan @ 2008-04-18 2:21 ` Pavel Roskin 2008-04-18 11:32 ` Robert Millan 0 siblings, 1 reply; 16+ messages in thread From: Pavel Roskin @ 2008-04-18 2:21 UTC (permalink / raw) To: grub-devel Quoting Robert Millan <rmh@aybabtu.com>: > Now that I think of it, is there any reason for doing all the cmain() > cruft before grub_main() ? Getting to grub_main() only requires a working > stack, which we have, and grub_main() inmediately returns control back to > architecture-specific code in grub_machine_init(). > > So why not move from: > > _start -> cmain -> grub_main > > to: > > _start -> grub_main -> grub_machine_init -> cmain > > ? I think it would be great. We should try to make the code for different architectures more uniform to simplify maintenance. -- Regards, Pavel Roskin ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Make gdb debugging a bit less painful 2008-04-18 2:21 ` Pavel Roskin @ 2008-04-18 11:32 ` Robert Millan 2008-04-18 12:13 ` Robert Millan ` (2 more replies) 0 siblings, 3 replies; 16+ messages in thread From: Robert Millan @ 2008-04-18 11:32 UTC (permalink / raw) To: The development of GRUB 2 [-- Attachment #1: Type: text/plain, Size: 904 bytes --] On Thu, Apr 17, 2008 at 10:21:14PM -0400, Pavel Roskin wrote: > Quoting Robert Millan <rmh@aybabtu.com>: > > >Now that I think of it, is there any reason for doing all the cmain() > >cruft before grub_main() ? Getting to grub_main() only requires a working > >stack, which we have, and grub_main() inmediately returns control back to > >architecture-specific code in grub_machine_init(). > > > >So why not move from: > > > > _start -> cmain -> grub_main > > > >to: > > > > _start -> grub_main -> grub_machine_init -> cmain > > > >? > > I think it would be great. We should try to make the code for > different architectures more uniform to simplify maintenance. Here. Unfortunately I can't test it as I have no ieee1275 at hand currently. Anyone? -- Robert Millan <GPLv2> I know my rights; I want my phone call! <DRM> What use is a phone call… if you are unable to speak? (as seen on /.) [-- Attachment #2: cmain.diff --] [-- Type: text/x-diff, Size: 2580 bytes --] diff -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../grub2/include/grub/ieee1275/ieee1275.h ./include/grub/ieee1275/ieee1275.h --- ../grub2/include/grub/ieee1275/ieee1275.h 2008-01-24 09:21:43.000000000 +0100 +++ ./include/grub/ieee1275/ieee1275.h 2008-04-18 13:31:27.000000000 +0200 @@ -97,6 +97,7 @@ extern void EXPORT_FUNC(grub_ieee1275_se \f +void EXPORT_FUNC(grub_ieee1275_init) (void); int EXPORT_FUNC(grub_ieee1275_finddevice) (char *name, grub_ieee1275_phandle_t *phandlep); int EXPORT_FUNC(grub_ieee1275_get_property) (grub_ieee1275_phandle_t phandle, diff -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../grub2/kern/i386/ieee1275/startup.S ./kern/i386/ieee1275/startup.S --- ../grub2/kern/i386/ieee1275/startup.S 2008-01-23 10:57:26.000000000 +0100 +++ ./kern/i386/ieee1275/startup.S 2008-04-18 13:29:57.000000000 +0200 @@ -39,7 +39,7 @@ start: _start: movl %eax, EXT_C(grub_ieee1275_entry_fn) - jmp EXT_C(cmain) + jmp EXT_C(grub_main) /* * This call is special... it never returns... in fact it should simply diff -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../grub2/kern/ieee1275/cmain.c ./kern/ieee1275/cmain.c --- ../grub2/kern/ieee1275/cmain.c 2008-04-12 23:09:35.000000000 +0200 +++ ./kern/ieee1275/cmain.c 2008-04-18 13:30:43.000000000 +0200 @@ -151,9 +151,8 @@ grub_ieee1275_find_options (void) #undef SF #undef OHW -void cmain (void); void -cmain (void) +grub_ieee1275_init (void) { grub_ieee1275_finddevice ("/chosen", &grub_ieee1275_chosen); @@ -162,9 +161,4 @@ cmain (void) grub_ieee1275_mmu = 0; grub_ieee1275_find_options (); - - /* Now invoke the main function. */ - grub_main (); - - /* Never reached. */ } diff -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../grub2/kern/ieee1275/init.c ./kern/ieee1275/init.c --- ../grub2/kern/ieee1275/init.c 2008-04-12 23:09:36.000000000 +0200 +++ ./kern/ieee1275/init.c 2008-04-18 13:31:51.000000000 +0200 @@ -180,6 +180,8 @@ grub_machine_init (void) char args[256]; int actual; + grub_ieee1275_init (); + grub_console_init (); #ifdef __i386__ grub_keyboard_controller_init (); diff -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../grub2/kern/powerpc/ieee1275/crt0.S ./kern/powerpc/ieee1275/crt0.S --- ../grub2/kern/powerpc/ieee1275/crt0.S 2008-01-19 12:41:00.000000000 +0100 +++ ./kern/powerpc/ieee1275/crt0.S 2008-04-18 13:30:12.000000000 +0200 @@ -42,5 +42,5 @@ _start: lis 9, grub_ieee1275_entry_fn@ha stw 5, grub_ieee1275_entry_fn@l(9) - bl cmain + bl grub_main 1: b 1b ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Make gdb debugging a bit less painful 2008-04-18 11:32 ` Robert Millan @ 2008-04-18 12:13 ` Robert Millan 2008-04-18 15:16 ` Pavel Roskin 2008-04-18 13:58 ` Lubomir Kundrak 2008-04-18 15:54 ` Robert Millan 2 siblings, 1 reply; 16+ messages in thread From: Robert Millan @ 2008-04-18 12:13 UTC (permalink / raw) To: The development of GRUB 2 On Fri, Apr 18, 2008 at 01:32:59PM +0200, Robert Millan wrote: > - jmp EXT_C(cmain) > + jmp EXT_C(grub_main) Or maybe that should be a "call" instead.. -- Robert Millan <GPLv2> I know my rights; I want my phone call! <DRM> What use is a phone call… if you are unable to speak? (as seen on /.) ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Make gdb debugging a bit less painful 2008-04-18 12:13 ` Robert Millan @ 2008-04-18 15:16 ` Pavel Roskin 2008-04-18 15:36 ` Robert Millan 2008-04-18 15:38 ` Bean 0 siblings, 2 replies; 16+ messages in thread From: Pavel Roskin @ 2008-04-18 15:16 UTC (permalink / raw) To: The development of GRUB 2 On Fri, 2008-04-18 at 14:13 +0200, Robert Millan wrote: > On Fri, Apr 18, 2008 at 01:32:59PM +0200, Robert Millan wrote: > > - jmp EXT_C(cmain) > > + jmp EXT_C(grub_main) > > Or maybe that should be a "call" instead.. Only if there is any chance of return, and we can handle it. "exit" in open firmware based systems would probably mean returning control to open firmware. By the way, it would be nice to have "exit" in both grub for PC and grub-emu, and not only in the rescue mode. "exit" on PC means returning control to BIOS so it can try another boot device. "exit" in grub-emu means exit, of course. I have to use "reboot" now (which should not exit, but rather restart grub-emu, if it belongs to grub-emu at all) or "rescue" followed by "exit". -- Regards, Pavel Roskin ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Make gdb debugging a bit less painful 2008-04-18 15:16 ` Pavel Roskin @ 2008-04-18 15:36 ` Robert Millan 2008-04-18 15:38 ` Bean 1 sibling, 0 replies; 16+ messages in thread From: Robert Millan @ 2008-04-18 15:36 UTC (permalink / raw) To: The development of GRUB 2 On Fri, Apr 18, 2008 at 11:16:43AM -0400, Pavel Roskin wrote: > > On Fri, 2008-04-18 at 14:13 +0200, Robert Millan wrote: > > On Fri, Apr 18, 2008 at 01:32:59PM +0200, Robert Millan wrote: > > > - jmp EXT_C(cmain) > > > + jmp EXT_C(grub_main) > > > > Or maybe that should be a "call" instead.. > > Only if there is any chance of return, and we can handle it. Well, Lubomir suggested that you need that return address for gdb. Is that correct? > "exit" in open firmware based systems would probably mean returning > control to open firmware. Note that our ieee1275 exit is implemented via interrupt, which I believe has equivalent effect. We don't need the return address for that, in this case. > By the way, it would be nice to have "exit" in both grub for PC and > grub-emu, and not only in the rescue mode. "exit" on PC means returning > control to BIOS so it can try another boot device. "exit" in grub-emu > means exit, of course. I have to use "reboot" now (which should not > exit, but rather restart grub-emu, if it belongs to grub-emu at all) or > "rescue" followed by "exit". Agreed. -- Robert Millan <GPLv2> I know my rights; I want my phone call! <DRM> What use is a phone call… if you are unable to speak? (as seen on /.) ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Make gdb debugging a bit less painful 2008-04-18 15:16 ` Pavel Roskin 2008-04-18 15:36 ` Robert Millan @ 2008-04-18 15:38 ` Bean 2008-04-18 15:45 ` Robert Millan 1 sibling, 1 reply; 16+ messages in thread From: Bean @ 2008-04-18 15:38 UTC (permalink / raw) To: The development of GRUB 2 On Fri, Apr 18, 2008 at 11:16 PM, Pavel Roskin <proski@gnu.org> wrote: > > On Fri, 2008-04-18 at 14:13 +0200, Robert Millan wrote: > > > On Fri, Apr 18, 2008 at 01:32:59PM +0200, Robert Millan wrote: > > > - jmp EXT_C(cmain) > > > + jmp EXT_C(grub_main) > > > > Or maybe that should be a "call" instead.. > > Only if there is any chance of return, and we can handle it. > > "exit" in open firmware based systems would probably mean returning > control to open firmware. > > By the way, it would be nice to have "exit" in both grub for PC and > grub-emu, and not only in the rescue mode. "exit" on PC means returning > control to BIOS so it can try another boot device. "exit" in grub-emu > means exit, of course. I have to use "reboot" now (which should not > exit, but rather restart grub-emu, if it belongs to grub-emu at all) or > "rescue" followed by "exit". Hi, The would be nice, but we don't know if grub has overwritten the memory occupied by the original boot environment, so exit might have unexpected result. -- Bean ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Make gdb debugging a bit less painful 2008-04-18 15:38 ` Bean @ 2008-04-18 15:45 ` Robert Millan 0 siblings, 0 replies; 16+ messages in thread From: Robert Millan @ 2008-04-18 15:45 UTC (permalink / raw) To: The development of GRUB 2 On Fri, Apr 18, 2008 at 11:38:48PM +0800, Bean wrote: > > > > "exit" in open firmware based systems would probably mean returning > > control to open firmware. > > > > By the way, it would be nice to have "exit" in both grub for PC and > > grub-emu, and not only in the rescue mode. "exit" on PC means returning > > control to BIOS so it can try another boot device. "exit" in grub-emu > > means exit, of course. I have to use "reboot" now (which should not > > exit, but rather restart grub-emu, if it belongs to grub-emu at all) or > > "rescue" followed by "exit". > > Hi, > > The would be nice, but we don't know if grub has overwritten the > memory occupied by the original boot environment, so exit might have > unexpected result. In which case is this not granted? On pc/bios we use the memory map, on ieee1275 we use /memory/available, etc. -- Robert Millan <GPLv2> I know my rights; I want my phone call! <DRM> What use is a phone call… if you are unable to speak? (as seen on /.) ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Make gdb debugging a bit less painful 2008-04-18 11:32 ` Robert Millan 2008-04-18 12:13 ` Robert Millan @ 2008-04-18 13:58 ` Lubomir Kundrak 2008-04-18 15:54 ` Robert Millan 2 siblings, 0 replies; 16+ messages in thread From: Lubomir Kundrak @ 2008-04-18 13:58 UTC (permalink / raw) To: The development of GRUB 2 On Fri, 2008-04-18 at 13:32 +0200, Robert Millan wrote: > On Thu, Apr 17, 2008 at 10:21:14PM -0400, Pavel Roskin wrote: > > Quoting Robert Millan <rmh@aybabtu.com>: > > > > >Now that I think of it, is there any reason for doing all the cmain() > > >cruft before grub_main() ? Getting to grub_main() only requires a working > > >stack, which we have, and grub_main() inmediately returns control back to > > >architecture-specific code in grub_machine_init(). > > > > > >So why not move from: > > > > > > _start -> cmain -> grub_main > > > > > >to: > > > > > > _start -> grub_main -> grub_machine_init -> cmain > > > > > >? > > > > I think it would be great. We should try to make the code for > > different architectures more uniform to simplify maintenance. > > Here. Unfortunately I can't test it as I have no ieee1275 at hand currently. > > Anyone? I have an OLPC XO machine borrowed now. I will test that this evening. -- Lubomir Kundrak (Red Hat Security Response Team) ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Make gdb debugging a bit less painful 2008-04-18 11:32 ` Robert Millan 2008-04-18 12:13 ` Robert Millan 2008-04-18 13:58 ` Lubomir Kundrak @ 2008-04-18 15:54 ` Robert Millan 2 siblings, 0 replies; 16+ messages in thread From: Robert Millan @ 2008-04-18 15:54 UTC (permalink / raw) To: The development of GRUB 2 Bean confirmed it works. Committed without changing jmp to call, since it wasn't clear whether we want it or not. On Fri, Apr 18, 2008 at 01:32:59PM +0200, Robert Millan wrote: > On Thu, Apr 17, 2008 at 10:21:14PM -0400, Pavel Roskin wrote: > > Quoting Robert Millan <rmh@aybabtu.com>: > > > > >Now that I think of it, is there any reason for doing all the cmain() > > >cruft before grub_main() ? Getting to grub_main() only requires a working > > >stack, which we have, and grub_main() inmediately returns control back to > > >architecture-specific code in grub_machine_init(). > > > > > >So why not move from: > > > > > > _start -> cmain -> grub_main > > > > > >to: > > > > > > _start -> grub_main -> grub_machine_init -> cmain > > > > > >? > > > > I think it would be great. We should try to make the code for > > different architectures more uniform to simplify maintenance. > > Here. Unfortunately I can't test it as I have no ieee1275 at hand currently. > > Anyone? > > -- > Robert Millan > > <GPLv2> I know my rights; I want my phone call! > <DRM> What use is a phone call… if you are unable to speak? > (as seen on /.) > diff -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../grub2/include/grub/ieee1275/ieee1275.h ./include/grub/ieee1275/ieee1275.h > --- ../grub2/include/grub/ieee1275/ieee1275.h 2008-01-24 09:21:43.000000000 +0100 > +++ ./include/grub/ieee1275/ieee1275.h 2008-04-18 13:31:27.000000000 +0200 > @@ -97,6 +97,7 @@ extern void EXPORT_FUNC(grub_ieee1275_se > \f > > > +void EXPORT_FUNC(grub_ieee1275_init) (void); > int EXPORT_FUNC(grub_ieee1275_finddevice) (char *name, > grub_ieee1275_phandle_t *phandlep); > int EXPORT_FUNC(grub_ieee1275_get_property) (grub_ieee1275_phandle_t phandle, > diff -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../grub2/kern/i386/ieee1275/startup.S ./kern/i386/ieee1275/startup.S > --- ../grub2/kern/i386/ieee1275/startup.S 2008-01-23 10:57:26.000000000 +0100 > +++ ./kern/i386/ieee1275/startup.S 2008-04-18 13:29:57.000000000 +0200 > @@ -39,7 +39,7 @@ > start: > _start: > movl %eax, EXT_C(grub_ieee1275_entry_fn) > - jmp EXT_C(cmain) > + jmp EXT_C(grub_main) > > /* > * This call is special... it never returns... in fact it should simply > diff -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../grub2/kern/ieee1275/cmain.c ./kern/ieee1275/cmain.c > --- ../grub2/kern/ieee1275/cmain.c 2008-04-12 23:09:35.000000000 +0200 > +++ ./kern/ieee1275/cmain.c 2008-04-18 13:30:43.000000000 +0200 > @@ -151,9 +151,8 @@ grub_ieee1275_find_options (void) > #undef SF > #undef OHW > > -void cmain (void); > void > -cmain (void) > +grub_ieee1275_init (void) > { > grub_ieee1275_finddevice ("/chosen", &grub_ieee1275_chosen); > > @@ -162,9 +161,4 @@ cmain (void) > grub_ieee1275_mmu = 0; > > grub_ieee1275_find_options (); > - > - /* Now invoke the main function. */ > - grub_main (); > - > - /* Never reached. */ > } > diff -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../grub2/kern/ieee1275/init.c ./kern/ieee1275/init.c > --- ../grub2/kern/ieee1275/init.c 2008-04-12 23:09:36.000000000 +0200 > +++ ./kern/ieee1275/init.c 2008-04-18 13:31:51.000000000 +0200 > @@ -180,6 +180,8 @@ grub_machine_init (void) > char args[256]; > int actual; > > + grub_ieee1275_init (); > + > grub_console_init (); > #ifdef __i386__ > grub_keyboard_controller_init (); > diff -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../grub2/kern/powerpc/ieee1275/crt0.S ./kern/powerpc/ieee1275/crt0.S > --- ../grub2/kern/powerpc/ieee1275/crt0.S 2008-01-19 12:41:00.000000000 +0100 > +++ ./kern/powerpc/ieee1275/crt0.S 2008-04-18 13:30:12.000000000 +0200 > @@ -42,5 +42,5 @@ _start: > lis 9, grub_ieee1275_entry_fn@ha > stw 5, grub_ieee1275_entry_fn@l(9) > > - bl cmain > + bl grub_main > 1: b 1b > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > http://lists.gnu.org/mailman/listinfo/grub-devel -- Robert Millan <GPLv2> I know my rights; I want my phone call! <DRM> What use is a phone call… if you are unable to speak? (as seen on /.) ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Make gdb debugging a bit less painful 2008-04-14 22:30 [PATCH] Make gdb debugging a bit less painful Lubomir Kundrak 2008-04-15 13:21 ` Robert Millan 2008-04-15 13:38 ` Robert Millan @ 2008-04-15 19:01 ` Pavel Roskin 2008-04-17 11:54 ` Lubomir Kundrak 2 siblings, 1 reply; 16+ messages in thread From: Pavel Roskin @ 2008-04-15 19:01 UTC (permalink / raw) To: The development of GRUB 2 On Tue, 2008-04-15 at 00:30 +0200, Lubomir Kundrak wrote: > These are pretty self-explainable. I think I tried to sumbit these > changes with the serial debugging patch year and some months ago and I > was told to sign the copyright assignment. I have already done that > now. :) > > 2008-04-15 Lubomir Kundrak <lkundrak@redhat.com> > > * kern/main.c (grub_main) [!GRUB_UTIL]: Alias grub_main to main, > so that gdb is able to find stack top. > * genmk.rb: replace strip with objcopy, so unstripped files are > left untouched for debugging purposes. I'll appreciate if you don't mix two completely different changes together. -- Regards, Pavel Roskin ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Make gdb debugging a bit less painful 2008-04-15 19:01 ` Pavel Roskin @ 2008-04-17 11:54 ` Lubomir Kundrak 0 siblings, 0 replies; 16+ messages in thread From: Lubomir Kundrak @ 2008-04-17 11:54 UTC (permalink / raw) To: The development of GRUB 2 On Tue, 2008-04-15 at 15:01 -0400, Pavel Roskin wrote: > On Tue, 2008-04-15 at 00:30 +0200, Lubomir Kundrak wrote: > > These are pretty self-explainable. I think I tried to sumbit these > > changes with the serial debugging patch year and some months ago and I > > was told to sign the copyright assignment. I have already done that > > now. :) > > > > 2008-04-15 Lubomir Kundrak <lkundrak@redhat.com> > > > > * kern/main.c (grub_main) [!GRUB_UTIL]: Alias grub_main to main, > > so that gdb is able to find stack top. > > * genmk.rb: replace strip with objcopy, so unstripped files are > > left untouched for debugging purposes. > > I'll appreciate if you don't mix two completely different changes > together. Yup, sorry for that. The first change was discussed below. How about the second one, does it look sane? -- Lubomir Kundrak (Red Hat Security Response Team) ^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2008-04-18 15:54 UTC | newest] Thread overview: 16+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-04-14 22:30 [PATCH] Make gdb debugging a bit less painful Lubomir Kundrak 2008-04-15 13:21 ` Robert Millan 2008-04-15 13:38 ` Robert Millan 2008-04-17 11:53 ` Lubomir Kundrak 2008-04-17 20:11 ` Robert Millan 2008-04-18 2:21 ` Pavel Roskin 2008-04-18 11:32 ` Robert Millan 2008-04-18 12:13 ` Robert Millan 2008-04-18 15:16 ` Pavel Roskin 2008-04-18 15:36 ` Robert Millan 2008-04-18 15:38 ` Bean 2008-04-18 15:45 ` Robert Millan 2008-04-18 13:58 ` Lubomir Kundrak 2008-04-18 15:54 ` Robert Millan 2008-04-15 19:01 ` Pavel Roskin 2008-04-17 11:54 ` Lubomir Kundrak
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.