From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 23320 invoked from network); 10 Mar 2023 17:42:27 -0000 Received: from minnie.tuhs.org (50.116.15.146) by inbox.vuxu.org with ESMTPUTF8; 10 Mar 2023 17:42:27 -0000 Received: from minnie.tuhs.org (localhost [IPv6:::1]) by minnie.tuhs.org (Postfix) with ESMTP id 68A5941585; Sat, 11 Mar 2023 03:42:25 +1000 (AEST) Received: from mcvoy.com (mcvoy.com [192.169.23.250]) by minnie.tuhs.org (Postfix) with ESMTPS id 0252841581 for ; Sat, 11 Mar 2023 03:42:23 +1000 (AEST) Received: by mcvoy.com (Postfix, from userid 3546) id 9139B35E93A; Fri, 10 Mar 2023 09:42:22 -0800 (PST) Date: Fri, 10 Mar 2023 09:42:22 -0800 From: Larry McVoy To: Bakul Shah Message-ID: <20230310174222.GB9225@mcvoy.com> References: <69248852-1701-4938-8A4D-3B27F3018E83@iitbombay.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <69248852-1701-4938-8A4D-3B27F3018E83@iitbombay.org> User-Agent: Mutt/1.5.24 (2015-08-30) Message-ID-Hash: FCC5527D2NL2MRUXRA2NGMRB7NMLZWEI X-Message-ID-Hash: FCC5527D2NL2MRUXRA2NGMRB7NMLZWEI X-MailFrom: lm@mcvoy.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: segaloco , coff@tuhs.org X-Mailman-Version: 3.3.6b1 Precedence: list Subject: [COFF] Re: [TUHS] Re: Conditions, AKA exceptions. (Was: I can't drive 55: "GOTO considered harmful" 55th anniversary) List-Id: Computer Old Farts Forum Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Fri, Mar 10, 2023 at 09:35:44AM -0800, Bakul Shah wrote: > During development the runtime should simply invoke a debugger in this case. This should be perfectly doable but for some reason it is considered acceptable to crash a program! I don???t want to run a program *under a debugger* but want it invoked at the right time! Indeed. void gdb_backtrace(void) { FILE *f; char *cmd; unless (getenv("_BK_BACKTRACE")) return; unless ((f = efopen("BK_TTYPRINTF")) || (f = fopen(DEV_TTY, "w"))) { f = stderr; } cmd = aprintf("gdb -batch -ex backtrace '%s/bk' %u 1>&%d 2>&%d", bin, getpid(), fileno(f), fileno(f)); system(cmd); free(cmd); if (f != stderr) fclose(f); }