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=-3.3 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 5713 invoked from network); 10 Feb 2022 21:32:34 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 10 Feb 2022 21:32:34 -0000 Received: (qmail 12080 invoked by uid 550); 10 Feb 2022 21:32:32 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 12056 invoked from network); 10 Feb 2022 21:32:31 -0000 Date: Thu, 10 Feb 2022 16:32:19 -0500 From: Rich Felker To: Yehuda Yitchak Cc: Florian Weimer , musl@lists.openwall.com Message-ID: <20220210213219.GF7074@brightrain.aerifal.cx> References: <20220209183326.GB7074@brightrain.aerifal.cx> <87h797zs6a.fsf@oldenburg.str.redhat.com> <20220209223155.GD7074@brightrain.aerifal.cx> <87a6ezx8wc.fsf@oldenburg.str.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [musl] Accessing Thread-Local-Storage in GDB On Thu, Feb 10, 2022 at 08:05:15PM +0200, Yehuda Yitchak wrote: > I forgot to mention I work on arm64 > I guess there isn't much I can do at the moment, right ? If you're debugging live processes not core files, the dlsym approach may work for you. > On Thu, Feb 10, 2022, 13:23 Florian Weimer wrote: > > > * Rich Felker: > > > > > Indeed, I was just offering a quick workaround that might help, not > > > suggesting gdb should do that. __tls_get_addr can be used for > > > non-dynamic symbols with information already available to the > > > debugger. For core files you could probably simulate execution and > > > abort if anything is reached that would need to change process state > > > (lazy allocation) although that doesn't happen with musl anyway. But I > > > wonder if the core file even records the x86 segment information > > > needed to preserve thread pointer and simulate the %fs/%gs based > > > loads on x86[_64]..? > > > > The register is available as $fs_base on x86-64: > > > > (gdb) print (void *)$fs_base > > $1 = (void *) 0x7f2d12981740 > > (gdb) print *(void **)$fs_base > > $2 = (void *) 0x7f2d12981740 > > > > It probably does not work on i386 (even as $gs_base). I do not think it > > depends on FSGSBASE support in the kernel, but maybe I'm mistaken. I > > think I looked at this three years ago and couldn't make it work. > > > > Thanks, > > Florian > > > >