This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patchv4 4/5] Keep objfile original filename
- From: Yao Qi <yao at codesourcery dot com>
- To: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Cc: <gdb-patches at sourceware dot org>
- Date: Tue, 7 Jan 2014 21:35:45 +0800
- Subject: Re: [patchv4 4/5] Keep objfile original filename
- Authentication-results: sourceware.org; auth=none
- References: <20130919135631 dot GD16978 at host2 dot jankratochvil dot net>
On 09/19/2013 09:56 PM, Jan Kratochvil wrote:
> @@ -1189,11 +1200,12 @@ symbol_file_add_separate (bfd *bfd, int symfile_flags, struct objfile *objfile)
> See symbol_file_add_with_addrs's comments for details. */
>
> struct objfile *
> -symbol_file_add_from_bfd (bfd *abfd, int add_flags,
> +symbol_file_add_from_bfd (bfd *abfd, const char *name, int add_flags,
> struct section_addr_info *addrs,
> int flags, struct objfile *parent)
We add an argument name here, but don't update
spu_symbol_file_add_from_memory in spu-linux-nat.c. We get a build
error below, when we build GDB with --target=spu-elf on powerpc-linux
machine.
../../binutils-gdb/gdb/spu-linux-nat.c:383:5: error: passing argument 2 of âsymbol_file_add_from_bfdâ makes pointer from integer without a cast [-Werror]
In file included from ../../binutils-gdb/gdb/spu-linux-nat.c:29:0:
../../binutils-gdb/gdb/symfile.h:444:24: note: expected âconst char *â but argument is of type âintâ
../../binutils-gdb/gdb/spu-linux-nat.c:383:5: error: passing argument 3 of âsymbol_file_add_from_bfdâ makes integer from pointer without a cast [-Werror]
In file included from ../../binutils-gdb/gdb/spu-linux-nat.c:29:0:
../../binutils-gdb/gdb/symfile.h:444:24: note: expected âintâ but argument is of type âvoid *â
../../binutils-gdb/gdb/spu-linux-nat.c:383:5: error: passing argument 5 of âsymbol_file_add_from_bfdâ makes integer from pointer without a cast [-Werror]
In file included from ../../binutils-gdb/gdb/spu-linux-nat.c:29:0:
../../binutils-gdb/gdb/symfile.h:444:24: note: expected âintâ but argument is of type âvoid *â
../../binutils-gdb/gdb/spu-linux-nat.c:383:5: error: too few arguments to function âsymbol_file_add_from_bfdâ
This patch fixes the build error, but I am not sure NAME we passed to
symbol_file_add_from_bfd is desired. IIUC, the NAME is "<in-memory>".
I didn't run testsuite. Is it OK?
--
Yao (éå)
gdb:
2014-01-07 Yao Qi <yao@codesourcery.com>
* spu-linux-nat.c (spu_symbol_file_add_from_memory): Pass
return value of bfd_get_filename to symbol_file_add_from_bfd.
---
gdb/spu-linux-nat.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/gdb/spu-linux-nat.c b/gdb/spu-linux-nat.c
index 9441e02..cfd5fd9 100644
--- a/gdb/spu-linux-nat.c
+++ b/gdb/spu-linux-nat.c
@@ -379,7 +379,8 @@ spu_symbol_file_add_from_memory (int inferior_fd)
{
struct cleanup *cleanup = make_cleanup_bfd_unref (nbfd);
- symbol_file_add_from_bfd (nbfd, SYMFILE_VERBOSE | SYMFILE_MAINLINE,
+ symbol_file_add_from_bfd (nbfd, bfd_get_filename (nbfd),
+ SYMFILE_VERBOSE | SYMFILE_MAINLINE,
NULL, 0, NULL);
do_cleanups (cleanup);
}
--
1.7.7.6