From patchwork Sun Nov 20 17:30:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Waroquiers X-Patchwork-Id: 60894 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 653EE3858409 for ; Sun, 20 Nov 2022 17:31:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 653EE3858409 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1668965461; bh=IUC+ZEB7LoemUTK8Hp20msAbZqkIlF/prFuojdfLXGg=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=y3bdY0JP2eo6ciDm88sNMgg0Z6GApcp2HU6pccsloZyfyYFKqIsVI72CVN9xw8D69 j4CQVOOXLxrApN7ksebSgDz1iJ2SDK1woJ8Gbq+BkdsYmZnSXBfk/610Vo3dkAyges N6XtmKf6ORwt/jfSutJAuJAjNNDixvl0HHO2M1is= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mailsec113.isp.belgacom.be (mailsec113.isp.belgacom.be [195.238.20.109]) by sourceware.org (Postfix) with ESMTPS id 9E6C33858D20 for ; Sun, 20 Nov 2022 17:30:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9E6C33858D20 X-ExtLoop: 1 X-IPAS-Result: A2DWBAC6Ynpj/1uGgG1agRKcN58yDwEBAQEBAQEBAQlEBAEBhQWFBCY4EwECBAEBAQEDAgMBAQEBAQEDAQEGAQEBAQEBBgQBgRuFL0aCNSKDfysLAUaEToMjsz4zgQGEcJpmgWeBQItOhXmBVUSED4R5gQaFcQSYMAMJAwcFSUADCxgNFjIKEzcbWA4JHxwlDQUGEgMgbAUHOg8oL2crHB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cJi9AuurkDUVXpKqnbJn7MMyXT4xxMywpHuFvOAL7RmQu0QxC50v Fnu8GjzRwkTKNefxCGt6XWxnOTCgirhVcQVDrLQ3uZqgVmS3nQeTgIfT1yivPi0kFWWQNFOL UEIvCAjxZXe72T6F5+kBEH9+STU+0dECpxZH/Y+rQ2czOzV+B7fDGUAQTdKb9lgvsJeqSEW6 2JlVujBXVRH2IB5g1rEnltIhVte8hT54YPPieHogOfFDxTeTFkPsy/y IronPort-HdrOrdr: A9a23:Vupy3Khl2Ug3+omb2GbXcCEqlHBQXi0ji2hC6mlwRA09TyX4rb HMoB1/73TJYVkqN03I9ergBED4ewK7yXct2/h3AV7AZmnbUQmTQL2KhLGKq1eMJ8SUzIBgPM lbAtNDIey1IV9mjdvrpCmUeuxQuuWvweSNrcf65VFEZyACUdAE0y5JTj++Vml7WQFKDYcwUI CR4ccCuyahdB0sH6aG76A+LpH+Tgvw5erbSBoPBxss7gGFjHez5Ln2VwSF3hp2aUIq/Ysf X-IronPort-Anti-Spam-Filtered: true X-ProximusIPWarmup: true Received: from 91.134-128-109.adsl-dyn.isp.belgacom.be (HELO md.home) ([109.128.134.91]) by relay.proximus.be with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2022 18:30:34 +0100 To: gdb-patches@sourceware.org Cc: Philippe Waroquiers Subject: [RFA] When getting the locno of a bpstat, handle the case of bp with null locations. Date: Sun, 20 Nov 2022 18:30:24 +0100 Message-Id: <20221120173024.3647464-1-philippe.waroquiers@skynet.be> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Philippe Waroquiers via Gdb-patches From: Philippe Waroquiers Reply-To: Philippe Waroquiers Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" The test py-objfile.exp unloads the current file while debugging the process. This results in bpstat bs->b->loc to become nullptr. Handle this case in breakpoint.c:bpstat_locno. Note: GDB crashes on this problem with an internal error, but the end of gdb summary shows: ... === gdb Summary === # of expected passes 36 The output also does not contain a 'FAIL:'. After the dix, the nr of expeted passes increased. In the gdb.log output, one can see: ... Fatal signal: Segmentation fault ----- Backtrace ----- 0x55698905c5b9 gdb_internal_backtrace_1 ../../binutils-gdb/gdb/bt-utils.c:122 0x55698905c5b9 _Z22gdb_internal_backtracev ... ERROR: Couldn't send python print(objfile.filename) to GDB. ERROR: : spawn id exp9 not open while executing "expect { -i exp9 -timeout 10 -re ".*A problem internal to GDB has been detected" { fail "$message (GDB internal error)" gdb_internal_error..." ("uplevel" body line 1) invoked from within .... Wondering if it might be possible to improve gdb_test to have gdb_test "python print(objfile.filename)" "None" \ "objfile.filename after objfile is unloaded" reporting a failed result instead of just producing the internal error. --- gdb/breakpoint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 5b691673a0e..a161b78a8aa 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -4486,7 +4486,7 @@ bpstat_locno (const bpstat *bs) int locno = 0; - if (b != nullptr && b->loc->next != nullptr) + if (b != nullptr && b->loc != nullptr && b->loc->next != nullptr) { const bp_location *bl_i;