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]

[PATCH] Do not pass NULL for the string in catch_errors


I caught a segmentation fault while running gdb.reverse/sigall-reverse.exp,
in a mingw32 GDB, in this code path. It boils down to the code trying to
strlen () a NULL pointer. I tracked things down and it looks like
record_full_message_wrapper_safe is the only occurrence.

We could also change catch_errors to check the char pointer and pass the
empty string automatically if the pointer is NULL. Then again, it seems like
catch_errors is going away at any time now, being potentially replaced
with catch_exceptions.

For now, though, the attach fix seems to accomplish the job.

Does that look reasonable?

gdb/ChangeLog:

2015-09-09  Luis Machado  <lgustavo@codesourcery.com>

	* record-full.c (record_full_message_wrapper_safe): Do not pass
	NULL to string parameter in catch_errors.
---
 gdb/record-full.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/record-full.c b/gdb/record-full.c
index 06bfdb8..15941c6 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -666,7 +666,7 @@ record_full_message_wrapper_safe (struct regcache *regcache,
   args.regcache = regcache;
   args.signal = signal;
 
-  return catch_errors (record_full_message_wrapper, &args, NULL,
+  return catch_errors (record_full_message_wrapper, &args, "",
 		       RETURN_MASK_ALL);
 }
 
-- 
1.9.1


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