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

[rfc] Do not read from the executable if ptrace fails

The old memory read methods used to have a target_has_all_memory
check.  It was broken at some point, probably around the introduction
of target_xfer_partial, and when I redid all the memory interfaces
last year I didn't try to fix it.  But there's a bug report about
this, which I've been meaning to come back to.

The attached fixes it.  If we try to read from a ptrace target, and
it fails, we do not continue down the target stack.  This won't affect
core debugging.

Any comments, or shall I apply this?

Daniel Jacobowitz

2007-06-24  Daniel Jacobowitz  <>

	PR symtab/2161
	* target.c (memory_xfer_partial): Do not continue past targets with
	all memory.

Index: target.c
RCS file: /cvs/src/src/gdb/target.c,v
retrieving revision 1.143
diff -u -p -r1.143 target.c
--- target.c	9 Jun 2007 13:42:16 -0000	1.143
+++ target.c	25 Jun 2007 00:29:17 -0000
@@ -1084,6 +1084,11 @@ memory_xfer_partial (struct target_ops *
       if (res > 0)
 	return res;
+      /* We want to continue past core files to executables, but not
+	 past a running target's memory.  */
+      if (ops->to_has_all_memory)
+	return res;
       ops = ops->beneath;
   while (ops != NULL);

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