mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: Yehuda Yitchak <yehuda80@gmail.com>
Cc: musl@lists.openwall.com
Subject: Re: [musl] Accessing Thread-Local-Storage in GDB
Date: Wed, 9 Feb 2022 13:33:26 -0500	[thread overview]
Message-ID: <20220209183326.GB7074@brightrain.aerifal.cx> (raw)
In-Reply-To: <CAN2=dsxXRyn60ueWTZa9drikbyxJ+Zs+X103hU3MuP-iPpspmw@mail.gmail.com>

On Wed, Feb 09, 2022 at 09:32:10AM +0200, Yehuda Yitchak wrote:
> Hello
> 
> one of the applications i am debugging is compiled using MUSL libc
> (aarch64) Version 1.1.19
> when i inspect a core-dump and try to view TLS variables with "print
> __percpu_dev" gdb (v8.3) complains:
> 
> Cannot find thread-local storage for LWP 22873, executable file
> <core-dump-file>
> Cannot find thread-local variables on this target
> 
> Any idea how I can overcome this?
> Appreciate if you could CC me since i'm not subscribed.

I think this is a consequence of gdb wanting to have a libthread_db (a
GNU- and Solaris-ism) to tell it how to interact with the threads
implementation of the process being debugged rather than just doing
things in a libpthread-agnostic way like musl wants it to do. I think
it should be fixable on the gdb side without too much headache, but I
don't know how.

As a workaround, if the program is dynamic-linked, you can do
something like print *(int *)dlsym(0, "foo") from the relevant thread
context and it should work.

Rich

  reply	other threads:[~2022-02-09 18:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-09  7:32 Yehuda Yitchak
2022-02-09 18:33 ` Rich Felker [this message]
2022-02-09 20:44   ` Florian Weimer
2022-02-09 22:31     ` Rich Felker
2022-02-10 11:23       ` Florian Weimer
2022-02-10 18:05         ` Yehuda Yitchak
2022-02-10 21:32           ` Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220209183326.GB7074@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    --cc=yehuda80@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).