From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10olkn2029.outbound.protection.outlook.com [40.92.41.29]) by sourceware.org (Postfix) with ESMTPS id 6CE2B3858D1E for ; Fri, 11 Feb 2022 13:15:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6CE2B3858D1E ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WKUbYKuQ9uAKbsVVW0G7GggRrKilplmDCfyf0zDd4bMSY+vsDSf5EZtyDUhAj9hfy/ooY1we0IKFlONCiRIYrNtHQUEDZCxBysD8bp6wOUZ0VGKRy8S4aSFsLk/aNEzxfwhDtoPlqolVCce1fBtydTw+iMt16NHWCn14PgnVeXKdv/Fr9x3RFvExcIDiXoJXVgobeHNgKFT3ooJceLlnF13iem3GYeyIsTcD5FwGtYTSqTKmSPWrw4urODTkFL/KZvCYKi3M4dJJE7H6CmG4hF4p4ajRa9EW3DOJKWS8DqOG+d4AFuhPAS22xjAH2VvsGBQ4KcheiuSbVehhWDks0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=HuTeGnVVxprH6dpJxospyMyDrV0818H6hmPpk9nO1LQ=; b=WwKi58UWakLhlQlI9reGPPu7U57rnfgwNtaaTto/tbF8xNq9xWduQROI5oHoWv2qtspchSO/+SahcmV6rHF42bZ7VOiys/uypmGhqyhGE7kTkswpxkPObuwPDpjiKqtskKYl4eTNwbYPVB/KtBRqGY17M+mvWkmKO1iXIEnsYlzDgMlOZfzQEA/0KdO1qc+c8bIR7LeF1PmKSOtNQWTbUmAsujwW7NnZ3b/rZ7Njiw0mdKnWymeFoQyl4jo0JiIljvCEuYQ3Iwq2m0oniIdGbT1hTQIetLd6Sqr/74vWEa+TAOY6ADu/YDKGDCCtDbk3SRPGdVtsPbc/soF/5eXEPQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from DM8PR16MB4357.namprd16.prod.outlook.com (2603:10b6:8:30::8) by SN1PR16MB2270.namprd16.prod.outlook.com (2603:10b6:802:30::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.19; Fri, 11 Feb 2022 13:15:35 +0000 Received: from DM8PR16MB4357.namprd16.prod.outlook.com ([fe80::35db:ffe6:afb0:5bdb]) by DM8PR16MB4357.namprd16.prod.outlook.com ([fe80::35db:ffe6:afb0:5bdb%5]) with mapi id 15.20.4975.014; Fri, 11 Feb 2022 13:15:35 +0000 From: Edgar Mobile To: Andrew Burgess , "gdb@sourceware.org" Subject: Re: Have GDB exit on SIGABRT Thread-Topic: Have GDB exit on SIGABRT Thread-Index: AQHYHyQe71VVLTk3uEyhmKxd3helj6yOM3iAgAAhItc= Date: Fri, 11 Feb 2022 13:15:35 +0000 Message-ID: References: <871r09fyag.fsf@redhat.com> In-Reply-To: <871r09fyag.fsf@redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [mJHCmY81DXKRkbEwdKz9y+qHlq/C96cE] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 9bc23396-7838-4986-fafa-08d9ed60973a x-ms-traffictypediagnostic: SN1PR16MB2270:EE_ x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: M4CdgNv6FtEukTNlB7MPUhCsvHp9nsLGAKmmRtsiPdYVqJRM8WOkK8/Z3VYTZvujuHM3pbLdXQQByc6szx0hdR1ekOTFwwN/A2Fi5bPiQVESwbN8LWO6wmCPGUO+6g3BRWaO44a8/oqNu5ihO/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6jU2+HFTqcm3iBpyI6FWR/D5n9hSwMtGsSccMsPMmROFBaZriOcy3EivXhpIKNWH/8oOcvLZfEwEUracFTG9m3U0HzAJBQrYnRap3bE3k90qF8jtNqqVUdKALcdfnENe0kWsFTxDr1ixQDZ0JXJZcxFywPiqc730PGctLjI+q/okSTkxytfeqMh07yGjtVM9zdcR0MhmjfU/zA5AdUGsl0l9wtNhYiWWTBG5qeicigFr40Gdj1pwG3sDu1Sze94yTLC9a3RTVg9JgYmCYc7geWtbxq1HAzEDMZo9mjZzQB2xcSMbIg2PbWS/CW1tnW9jlDUXZYdy/kTsyoTB+s6xbowrOeX3pezqEwkJsPGiRQXhtt9dnP0TVxnkwyoPQHuUp7gLPFWzUwrhbaoicY+kDfjgl2JFwjAxYssgqt0yE28SoZzqc MIME-Version: 1.0 X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-5ce7b.templateTenant X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM8PR16MB4357.namprd16.prod.outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 9bc23396-7838-4986-fafa-08d9ed60973a X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Feb 2022 13:15:35.9035 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR16MB2270 X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Feb 2022 13:15:40 -0000 Will try thanks! ________________________________ From: Andrew Burgess Sent: Friday, February 11, 2022 11:16 AM To: Edgar Mobile ; gdb@sourceware.org Subject: Re: Have GDB exit on SIGABRT Edgar Mobile via Gdb writes: > I want to start a gdb session for a process within a test environment > that executes some commands via script. The test environment is > configured so that it sends a SIGABRT after ten minutes which was > enough to end the original process. With a GDB session however it will > cause gdb to halt there which means the overall process never stops. My assumption here is that the SIGABRT is being sent to the inferior (the thing you're debugging), not GDB. If the SIGABRT is sent direct to GDB then that would kill GDB, which would cause the inferior to exit too (assuming the inferior is started under GDB, and you're not attaching. > Is it possible to configure the setup so that GDB completely quits > when a SIGABRT arrives? I'd consider making use of `handle`[1], something like `handle SIGABRT pass print nostop` will mean that when the SIGABRT arrives GDB will pass the signal to the inferior, killing it. Now you might be able to queue up an exit, something like this worked for me: gdb -ex 'file ~/tmp/loop.x' -ex 'handle SIGABRT pass print nostop' -ex 'r= un' -ex 'quit' Where loop.x just runs forever. Then, when I send SIGABRT to loop.x the 'run' command finishes, and the 'quit' gets run, which quits GDB. You could also replace the 'quit' with the -batch command line flag[2], but that makes less sense if you're running the commands from a script I think. Finally, if your script is more involved, and you want more control for when to quit gdb, you could consider using the Python API. The events mechanism[3] would allow you to handle the inferior exiting, or you could drop the use of 'handle' completely, and catch the stop event, check if the stop is due to SIGABRT, and then quit GDB. Hope some of this helps, Thanks, Andrew [1] https://sourceware.org/gdb/onlinedocs/gdb/Signals.html#Signals [2] https://sourceware.org/gdb/onlinedocs/gdb/Mode-Options.html#Mode-Option= s [3] https://sourceware.org/gdb/onlinedocs/gdb/Events-In-Python.html#Events-= In-Python