This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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]

new plugin bfd_target breaks gdb with --enable-targets=all


Hi,

 When running gdb's dump.exp test:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7f019a46d6e0 (LWP 12429)]
load_plugin () at ../../src/bfd/plugin.c:183
183       if (!program_name)
(top-gdb)  
(top-gdb) bt
#0  load_plugin () at ../../src/bfd/plugin.c:183
#1  0x0000000000bf490a in bfd_plugin_object_p (abfd=0x1b8e7c0) at ../../src/bfd/plugin.c:223
#2  0x00000000008286b2 in bfd_check_format_matches (abfd=0x1b8e7c0, format=bfd_object, matching=0x0)
    at ../../src/bfd/format.c:211
#3  0x0000000000828498 in bfd_check_format (abfd=0x1b8e7c0, format=bfd_object) at ../../src/bfd/format.c:95
#4  0x0000000000483065 in exec_file_attach (filename=0x7fff9f37169c "./testsuite/intarr1.srec", from_tty=1)
    at ../../src/gdb/exec.c:232
#5  0x00000000006280e9 in catch_command_errors (command=0x482f17 <exec_file_attach>,
    arg=0x7fff9f37169c "./testsuite/intarr1.srec", from_tty=1, mask=6) at ../../src/gdb/exceptions.c:525
#6  0x00000000004826df in captured_main (data=0x7fff9f370650) at ../../src/gdb/main.c:803
#7  0x0000000000628057 in catch_errors (func=0x481b49 <captured_main>, func_args=0x7fff9f370650,
    errstring=0xc928bf "", mask=6) at ../../src/gdb/exceptions.c:510
#8  0x0000000000482afd in gdb_main (args=0x7fff9f370650) at ../../src/gdb/main.c:911
#9  0x0000000000481860 in main (argc=2, argv=0x7fff9f370758) at ../../src/gdb/gdb.c:33

The below fixes the issue here, since program_name is declared as:

  extern char *program_name __attribute__ ((weak));

... and gdb doesn't define `program_name' since 1990.  Seems
wrong to require all libbfd clients to do so now.

(using weak in libbfd cries out hack to me, but well)

It looks like something else is still wrong, because otherwise,
should gdb be building plugin.c at all if the user doesn't
specify --enable-plugins?

Maybe the check for empty string should be removed too, dunno
if that was intended.

---
 plugin.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: bfd/plugin.c
===================================================================
--- bfd.orig/plugin.c	2009-05-27 01:39:32.000000000 +0100
+++ bfd/plugin.c	2009-05-27 01:51:45.000000000 +0100
@@ -180,7 +180,7 @@ load_plugin (void)
   if (plugin_name)
     return try_load_plugin (plugin_name);
 
-  if (!program_name)
+  if (!&program_name || !program_name)
     return 0;
 
   plugin_dir = concat (BINDIR, "/../lib/bfd-plugins", NULL);


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