This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [rfc / remote protocol] ELF segment based qOffsets


Hi Daniel,

Daniel Jacobowitz wrote:

Index: gdb/elfread.c
===================================================================
--- gdb/elfread.c.orig  2007-05-09 11:30:07.000000000 -0400
+++ gdb/elfread.c       2007-05-09 11:30:13.000000000 -0400
@@ -26,6 +26,8 @@

+/* Locate the segments in ABFD.  */
+
+static struct symfile_segment_data *
+elf_symfile_segments (bfd *abfd)
+{
+  Elf_Internal_Phdr *phdrs, **segments;
+  long phdrs_size;
+  int num_phdrs, num_segments, num_sections, i;
+  asection *sect;
+  struct symfile_segment_data *data;
+
+  phdrs_size = bfd_get_elf_phdr_upper_bound (abfd);
+  if (phdrs_size == -1)
+    return NULL;
+
+  phdrs = alloca (phdrs_size);
+  num_phdrs = bfd_get_elf_phdrs (abfd, phdrs);
+  if (num_phdrs == -1)
+    return NULL;


This introduces a dependency on bfd/elf.o (bfd_get_elf_phdr_upper_bound,
bfd_get_elf_phdrs) for every non elf target.  See below for build log for
arm-wince-mingw32ce.  I don't see where in the bfd configury, but Cygwin
already includes elf.o, I guess for core dump file support only, so we
don't see the problem there.
One way to fix it would be to patch bfd/configure.in to always
include $elf in the target backend files ($tb).  Or
perhaps elf_symfile_segments should be moved elsewhere?

Cheers,
Pedro Alves

--

(cd ../gdb; make)
rm -f gdb.exe
gcc -g3 -O0       \
                -o gdb.exe gdb.o libgdb.a \
                   ../readline/libreadline.a ../opcodes/libopcodes.a ../bfd/libb
fd.a -lintl ../libiberty/libiberty.a     -lncurses -lm -liconv -lexpat ../libibe
rty/libiberty.a -luser32
libgdb.a(elfread.o): In function `elf_symfile_segments':
/cygdrive/d/cegccsf/cegcc/cegcc/src/build-gdb_server/gdb/../../gdb-server_submit
/src/gdb/elfread.c:67: undefined reference to `_bfd_get_elf_phdr_upper_bound'
/cygdrive/d/cegccsf/cegcc/cegcc/src/build-gdb_server/gdb/../../gdb-server_submit
/src/gdb/elfread.c:72: undefined reference to `_bfd_get_elf_phdrs'
Info: resolving _LINES by linking to __imp__LINES (auto-import)
Info: resolving _COLS by linking to __imp__COLS (auto-import)
Info: resolving _stdscr by linking to __imp__stdscr (auto-import)
Info: resolving _curscr by linking to __imp__curscr (auto-import)
collect2: ld returned 1 exit status
make: *** [gdb.exe] Error 1




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]