On Wed, Mar 09, 2022 at 02:25:28PM -0600, Glenn Washburn wrote: > On Wed, 9 Mar 2022 16:49:57 +0100 > Daniel Kiper <dki...@net-space.pl> wrote: > > > On Wed, Mar 02, 2022 at 06:25:12PM -0600, Glenn Washburn wrote: > > > Add linker flags when linking kernel.exec to have malloc and free point to > > > grub_malloc and grub_free respectively. Some gdb functionality depends on > > > gdb locating the symbols "malloc" and "free", such as dynamically creating > > > strings for arguments to injected function calls. A trivial example would > > > the gdb command 'p strlen("astring")'. > > > > > > Signed-off-by: Glenn Washburn <developm...@efficientek.com> > > > --- > > > This should have been included in the gdb patch series I recently sent, > > > although its not required by nor requires any of those patches. > > > > > > Glenn > > > > > > --- > > > conf/Makefile.common | 1 + > > > 1 file changed, 1 insertion(+) > > > > > > diff --git a/conf/Makefile.common b/conf/Makefile.common > > > index f0bb6e160a..069b428c1a 100644 > > > --- a/conf/Makefile.common > > > +++ b/conf/Makefile.common > > > @@ -36,6 +36,7 @@ BUILD_CPPFLAGS += $(CPPFLAGS_DEFAULT) > > > > > > CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding > > > LDFLAGS_KERNEL = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) > > > +LDFLAGS_KERNEL += -Wl,--defsym=malloc=grub_malloc > > > -Wl,--defsym=free=grub_free > > > > Could not we teach gdb somehow to use grub_malloc()/grub_free() instead > > of malloc()/free()? > > Considering the tons of options that GDB has, I was hoping the same > thing. Unfortunately, it appears to be hardcoded[1]. So not without > changing the source.
:-( I expected you checked that but wanted to be sure... :-) Reviewed-by: Daniel Kiper <daniel.ki...@oracle.com> Daniel _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel