From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from fencepost.gnu.org (fencepost.gnu.org [IPv6:2001:470:142:3::e]) by sourceware.org (Postfix) with ESMTPS id BE6AD3858D1E; Fri, 20 Jan 2023 13:39:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BE6AD3858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gnu.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gnu.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=zbRfH4ti82mPz5LgiIfmBfel9OcS5TqblEcKxeq/H3A=; b=lID8LeyKZRFja6vnR2NQ 4B39H5v9h5v8Q2xrjwIBdK0WW7Ufhi9ac2K3mrZ90Ev6qtT0+hwQiUu0cgR0zhP1u/F/NNEGP20Y7 Ow7rF653pxLW3aubu20QtVsIzV9ujQMrze1zSZl+e8+Y9QsKxSP+EHO1XLEz5BGCmadvHWNmTV7zk qA9aENauP4/bMmaT3xe8WC2Pgdxht7yMYT0Ipyq+1teM6eg9NuVzrjLa8nYa9BBsf2YeEg88+RJSt BpGOhQTrhwgd+FgBR7JOAaUriPeCH8JQYal+wi+6Fko8n0Bh1n7iOnnsNzb+uxsOvSa8VX06hhlZW 9vKO42Zl364fKg==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIrc6-0001Na-2X; Fri, 20 Jan 2023 08:39:26 -0500 Date: Fri, 20 Jan 2023 15:39:26 +0200 Message-Id: <83zgadmik1.fsf@gnu.org> From: Eli Zaretskii To: =?utf-8?Q?Bj=C3=B6rn_Sch=C3=A4pers?= Cc: gcc-patches@gcc.gnu.org, gcc@gcc.gnu.org In-Reply-To: <20230120105409.54949-3-gcc@hazardy.de> (message from =?utf-8?Q?Bj=C3=B6rn=09Sch=C3=A4pers?= on Fri, 20 Jan 2023 11:54:08 +0100) Subject: Re: [PATCH 3/4] libbacktrace: work with aslr on windows References: <20230120105409.54949-1-gcc@hazardy.de> <20230120105409.54949-3-gcc@hazardy.de> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_BARRACUDACENTRAL,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: > From: Björn Schäpers > Date: Fri, 20 Jan 2023 11:54:08 +0100 > > @@ -856,7 +870,12 @@ coff_add (struct backtrace_state *state, int descriptor, > + (sections[i].offset - min_offset)); > } > > - if (!backtrace_dwarf_add (state, /* base_address */ 0, &dwarf_sections, > +#ifdef HAVE_WINDOWS_H > + module_handle = (uintptr_t) GetModuleHandleW (NULL); > + base_address = module_handle - image_base; > +#endif > + > + if (!backtrace_dwarf_add (state, base_address, &dwarf_sections, > 0, /* FIXME: is_bigendian */ > NULL, /* altlink */ > error_callback, data, fileline_fn, Why do you force using the "wide" APIs here? Won't GetModuleHandle do the job, whether it resolves to GetModuleHandleA or GetModuleHandleW?