This is the mail archive of the gdb-patches@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]

[gdb patch+7.6] Fix bfd close regression wrt PR binutils/14813


Hi,

there were BFD patches:
	PATCH: PR binutils/14813: Wrong return type for opncls_bclose
	http://sourceware.org/ml/binutils/2012-11/msg00074.html
	Message-ID: <20121107003007.GA8682@gmail.com>
+
	pr14813 revisted
	http://sourceware.org/ml/binutils/2013-01/msg00194.html
	Message-ID: <20130114131458.GK3244@bubble.grove.modra.org>

where bfd_iovec->bclose return value has been fixed across bfd/ .  But GDB in
some cases expected the incorrect behavior which regressed it.

The effect was random:
	-PASS: gdb.base/jit.exp: PIE: one_jit_test-1: continue to breakpoint: break here 1
	-PASS: gdb.base/jit.exp: PIE: one_jit_test-1: info function jit_function
	+FAIL: gdb.base/jit.exp: PIE: one_jit_test-1: continue to breakpoint: break here 1
	+FAIL: gdb.base/jit.exp: PIE: one_jit_test-1: info function jit_function

due to:
(gdb) PASS: gdb.base/jit.exp: one_jit_test-2: info function jit_function
break 219
Breakpoint 4 at 0x400eef: file ./gdb.base/jit-main.c, line 219.
(gdb) continue
Continuing.
warning: cannot close "<binary garbage>": Invalid operation

  char *name = bfd_get_filename (abfd);
  if (!bfd_close (abfd))
    warning (_("cannot close \"%s\": %s"), name, bfd_errmsg (bfd_get_error ()));

which may be correct when bfd_close really fails, not sure.

No regressions on {x86_64,x86_64-m32,i686}-fedora20pre-linux-gnu.

I will check it in.


Jan


gdb/
2013-04-09  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Fix GDB regression related to PR binutils/14813.
	* jit.c (mem_bfd_iovec_close): Return 0 for success.
	* minidebug.c (lzma_close): Add return value comment.
	* remote.c (remote_bfd_iovec_close): Return 0 for success.
	* solib-spu.c (spu_bfd_iovec_close): Likewise.
	* spu-linux-nat.c (spu_bfd_iovec_close): Likewise.

diff --git a/gdb/jit.c b/gdb/jit.c
index 33d3d61..6fc8524 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -90,7 +90,9 @@ static int
 mem_bfd_iovec_close (struct bfd *abfd, void *stream)
 {
   xfree (stream);
-  return 1;
+
+  /* Zero means success.  */
+  return 0;
 }
 
 /* For reading the file, we just need to pass through to target_read_memory and
diff --git a/gdb/minidebug.c b/gdb/minidebug.c
index 7b1463b..a33628a 100644
--- a/gdb/minidebug.c
+++ b/gdb/minidebug.c
@@ -226,6 +226,8 @@ lzma_close (struct bfd *nbfd,
   lzma_index_end (lstream->index, &gdb_lzma_allocator);
   xfree (lstream->data);
   xfree (lstream);
+
+  /* Zero means success.  */
   return 0;
 }
 
diff --git a/gdb/remote.c b/gdb/remote.c
index 740324b..6fa078e 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -9925,7 +9925,8 @@ remote_bfd_iovec_close (struct bfd *abfd, void *stream)
      connection was already torn down.  */
   remote_hostio_close (fd, &remote_errno);
 
-  return 1;
+  /* Zero means success.  */
+  return 0;
 }
 
 static file_ptr
diff --git a/gdb/solib-spu.c b/gdb/solib-spu.c
index 7be5232..fc9dcda 100644
--- a/gdb/solib-spu.c
+++ b/gdb/solib-spu.c
@@ -286,7 +286,9 @@ static int
 spu_bfd_iovec_close (bfd *nbfd, void *stream)
 {
   xfree (stream);
-  return 1;
+
+  /* Zero means success.  */
+  return 0;
 }
 
 static file_ptr
diff --git a/gdb/spu-linux-nat.c b/gdb/spu-linux-nat.c
index ca8d92d..1fab9da 100644
--- a/gdb/spu-linux-nat.c
+++ b/gdb/spu-linux-nat.c
@@ -277,7 +277,9 @@ static int
 spu_bfd_iovec_close (struct bfd *nbfd, void *stream)
 {
   xfree (stream);
-  return 1;
+
+  /* Zero means success.  */
+  return 0;
 }
 
 static file_ptr


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