From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 584203858421 for ; Mon, 24 Oct 2022 16:43:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 584203858421 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 7B7FD22042; Mon, 24 Oct 2022 16:43:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1666629809; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ERCIjQFVEBoYNdRiyqbZmIb6EMr+yAujVsCFsDO/cY0=; b=JdvvmucS6wgao816SdzslYZ5Ndt+oaNpZSgEaeQu/HGIyES7U52JElgwSAq/cJl0OLe9W4 gJFL/44mIp7cPgOdNbDHYSZQlWJHU/kbP3MfWcVd7KYbYkiiMUAyp9RGd4N7UPJB0+uD6N OsXKWo4gnlSPz5MgVNtZJ8xPNV9iieU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1666629809; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ERCIjQFVEBoYNdRiyqbZmIb6EMr+yAujVsCFsDO/cY0=; b=2MA0U/LWx3wxWzwuBRYGIjHfak6eVsSeaCIgBq1wjnicxLWyF4TxW/z/hXYxyc67Cl7961 Zx/1lkCqd+easHAg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 64EC313A79; Mon, 24 Oct 2022 16:43:29 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id soFuF7HAVmPXbAAAMHmgww (envelope-from ); Mon, 24 Oct 2022 16:43:29 +0000 Message-ID: <02ad6f69-2a1b-b938-0ab4-ba6288f10fde@suse.de> Date: Mon, 24 Oct 2022 18:43:29 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PATCH 2/2] [gdb] Fix rethrow exception slicing in insert_bp_location Content-Language: en-US To: Pedro Alves , gdb-patches@sourceware.org References: <20221024084913.19429-1-tdevries@suse.de> <20221024084913.19429-3-tdevries@suse.de> From: Tom de Vries In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,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 List-Id: On 10/24/22 18:36, Pedro Alves wrote: > On 2022-10-24 9:49 a.m., Tom de Vries via Gdb-patches wrote: > >> +#define RETHROW_ON_TARGET_CLOSE_ERROR(E) \ >> + do \ >> + { \ >> + if ((E).reason != 0) \ >> + { \ >> + /* Can't set the breakpoint. */ \ >> + \ >> + if ((E).error == TARGET_CLOSE_ERROR) \ >> + /* If the target has closed then it will have deleted any \ >> + breakpoints inserted within the target inferior, as a \ >> + result any further attempts to interact with the \ >> + breakpoint objects is not possible. Just rethrow the \ >> + error. Don't use E to rethrow, to prevent object \ >> + slicing of the exception. */ \ >> + throw; \ >> + } \ >> + } while (0) > > Is there a reason this is a macro instead of a function? yes, the throw without expression. Do you know of a way to do this using a function? Thanks, - Tom