From patchwork Wed Sep 9 14:45:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Machado X-Patchwork-Id: 8606 Received: (qmail 121966 invoked by alias); 9 Sep 2015 14:45:55 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 121949 invoked by uid 89); 9 Sep 2015 14:45:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 09 Sep 2015 14:45:53 +0000 Received: from svr-orw-fem-04.mgc.mentorg.com ([147.34.97.41]) by relay1.mentorg.com with esmtp id 1ZZgdC-0002Kt-H2 from Luis_Gustavo@mentor.com for gdb-patches@sourceware.org; Wed, 09 Sep 2015 07:45:50 -0700 Received: from opsys.world.mentorg.com (147.34.91.1) by svr-orw-fem-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server id 14.3.224.2; Wed, 9 Sep 2015 07:45:49 -0700 From: Luis Machado To: Subject: [PATCH] Do not pass NULL for the string in catch_errors Date: Wed, 9 Sep 2015 11:45:33 -0300 Message-ID: <1441809933-9612-1-git-send-email-lgustavo@codesourcery.com> MIME-Version: 1.0 X-IsSubscribed: yes 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 * 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); }