aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2009-04-03 14:37:57 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2009-04-03 14:37:57 +0000
commit9592c5d01114002e806d444f9a574903e7d0a957 (patch)
tree41fb39cdca6df8bf3d81ad4a0100fc8a771c3420
parent5ecd5cbe983b2ba6f5f05f3e94926e4d841024fb (diff)
downloadgdb-9592c5d01114002e806d444f9a574903e7d0a957.zip
gdb-9592c5d01114002e806d444f9a574903e7d0a957.tar.gz
gdb-9592c5d01114002e806d444f9a574903e7d0a957.tar.bz2
* spu-linux-nat.c (spu_bfd_open): Set filename of in-memory
BFD to contents of SPU name note. (spu_symbol_file_add_from_memory): Call symbol_file_add_from_bfd with "from_tty" argument 1 instead of 0.
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/spu-linux-nat.c19
2 files changed, 25 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 94373ab..ca80247 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2009-04-93 Ulrich Weigand <uweigand@de.ibm.com>
+
+ * spu-linux-nat.c (spu_bfd_open): Set filename of in-memory
+ BFD to contents of SPU name note.
+ (spu_symbol_file_add_from_memory): Call symbol_file_add_from_bfd
+ with "from_tty" argument 1 instead of 0.
+
2009-04-02 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf2read.c
diff --git a/gdb/spu-linux-nat.c b/gdb/spu-linux-nat.c
index 372bbee..3b1e337 100644
--- a/gdb/spu-linux-nat.c
+++ b/gdb/spu-linux-nat.c
@@ -308,6 +308,7 @@ static bfd *
spu_bfd_open (ULONGEST addr)
{
struct bfd *nbfd;
+ asection *spu_name;
ULONGEST *open_closure = xmalloc (sizeof (ULONGEST));
*open_closure = addr;
@@ -325,6 +326,22 @@ spu_bfd_open (ULONGEST addr)
return NULL;
}
+ /* Retrieve SPU name note and update BFD name. */
+ spu_name = bfd_get_section_by_name (nbfd, ".note.spu_name");
+ if (spu_name)
+ {
+ int sect_size = bfd_section_size (nbfd, spu_name);
+ if (sect_size > 20)
+ {
+ char *buf = alloca (sect_size - 20 + 1);
+ bfd_get_section_contents (nbfd, spu_name, buf, 20, sect_size - 20);
+ buf[sect_size - 20] = '\0';
+
+ xfree ((char *)nbfd->filename);
+ nbfd->filename = xstrdup (buf);
+ }
+ }
+
return nbfd;
}
@@ -355,7 +372,7 @@ spu_symbol_file_add_from_memory (int inferior_fd)
/* Open BFD representing SPE executable and read its symbols. */
nbfd = spu_bfd_open (addr);
if (nbfd)
- symbol_file_add_from_bfd (nbfd, 0, NULL, 1, 0);
+ symbol_file_add_from_bfd (nbfd, 1, NULL, 1, 0);
}