From: Hui Zhu <teawater@gmail.com>
To: Paul Pluzhnikov <ppluzhnikov@google.com>
Cc: Pedro Alves <pedro@codesourcery.com>,
gdb-patches@sourceware.org,
Joel Brobecker <brobecker@adacore.com>,
tromey@redhat.com, Thiago Jung Bauermann <bauerman@br.ibm.com>,
Eli Zaretskii <eliz@gnu.org>, Daniel Jacobowitz <drow@false.org>
Subject: Re: [patch][rfc] Allow GDB to search for the right libthread_db.so.1
Date: Tue, 12 May 2009 07:16:00 -0000 [thread overview]
Message-ID: <daef60380905120016s75ff5ef6q3892ca8ff3cf4b8b@mail.gmail.com> (raw)
In-Reply-To: <8ac60eac0905111108g26096302lb902cd414b5a6790@mail.gmail.com>
1. Could you please add a debug interface like "set debug
linux-thread 1" to let linux-thread-db.c output some debug message?
I met a lot of people have trouble with linux-multi-thread debug. I
think it will help us a lot. :)
2. I still peddle my idea: let libthread-db-search-path can support
single file. And a make a patch follow your patch. Wish you like it.
:)
---
linux-thread-db.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
--- a/linux-thread-db.c
+++ b/linux-thread-db.c
@@ -642,6 +642,7 @@ thread_db_load_search (void)
while (*search_path)
{
+ struct stat buf;
const char *end = strchr (search_path, ':');
if (end)
{
@@ -674,8 +675,16 @@ thread_db_load_search (void)
memcpy (path, search_path, len + 1);
search_path += len;
}
- strcat (path, "/");
- strcat (path, LIBTHREAD_DB_SO);
+ if (stat (path, &buf))
+ {
+ warning (_("Stats the file %s failied."), path);
+ continue;
+ }
+ if (S_ISDIR (buf.st_mode))
+ {
+ strcat (path, "/");
+ strcat (path, LIBTHREAD_DB_SO);
+ }
if (try_thread_db_load (path))
{
rc = 1;
And thanks for you work. Your patch is very cool.
Thanks,
Hui
On Tue, May 12, 2009 at 02:08, Paul Pluzhnikov <ppluzhnikov@google.com> wrote:
> On Mon, May 11, 2009 at 6:12 AM, Pedro Alves <pedro@codesourcery.com> wrote:
>
>>> handle = dlopen (library, RTLD_NOW);
>>
>> I wonder if making this RTLD_LAZY until you found the correct one
>> wouldn't make sense?
>
> I don't believe so.
>
> AFAICT, the reason for RTLD_NOW is to make sure that this
> libthread_db is really compatible with this GDB (doesn't require
> any symbols GDB doesn't provide); and also to prevent GDB from
> dying half way through with "unable to resolve symbol ...".
>
> Both of these still apply to whatever the "final" libthread_db is
> going to be.
>
> Why would we want to dlopen(... RTLD_LAZY) and try to initialize
> libthread_db if we are going to reject it as unusable in the end?
>
>>> +static int
>>> +thread_db_load_search ()
>>
>> ^ (void)
>
> Fixed, thanks.
>
>> (this function could be made to use `openat' at some point, but
>> gdb is already assumes PATH_MAX is largest path possible elsewhere
>> anyway)
>>
>> I also wonder if `set sysroot' should affect this search path: I think
>> not, but I'm not 100% sure.
>
> I don't believe it makes sense for 'set sysroot' to affect this
> search path.
>
>>> +int libpthread_name_p (const char *name)
>>> +{
>>
>> ^ function name at column 0, please.
>
> Fixed, thanks.
>
> Anxiously waiting for Daniel's verdict now ...
>
> --
> Paul Pluzhnikov
>
next prev parent reply other threads:[~2009-05-12 7:16 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-06 20:39 Paul Pluzhnikov
2009-04-08 21:23 ` Thiago Jung Bauermann
2009-04-10 19:06 ` Paul Pluzhnikov
2009-04-16 17:56 ` Tom Tromey
2009-04-16 18:22 ` Eli Zaretskii
2009-04-17 19:13 ` Paul Pluzhnikov
2009-04-18 17:01 ` Eli Zaretskii
2009-04-19 14:59 ` Thiago Jung Bauermann
2009-04-19 18:03 ` Paul Pluzhnikov
2009-04-20 13:18 ` Daniel Jacobowitz
2009-04-20 16:47 ` Paul Pluzhnikov
2009-04-20 17:02 ` Daniel Jacobowitz
2009-04-20 17:20 ` Paul Pluzhnikov
2009-04-20 18:04 ` Daniel Jacobowitz
2009-04-20 19:09 ` Paul Pluzhnikov
2009-04-22 17:25 ` Daniel Jacobowitz
2009-04-23 1:10 ` Paul Pluzhnikov
2009-04-23 1:34 ` Tom Tromey
2009-04-23 6:28 ` Hui Zhu
2009-04-23 6:21 ` Hui Zhu
2009-04-23 7:01 ` Paul Pluzhnikov
2009-04-23 8:06 ` Hui Zhu
2009-04-23 11:32 ` Hui Zhu
2009-04-29 20:30 ` Paul Pluzhnikov
2009-04-30 5:38 ` Hui Zhu
2009-04-30 18:56 ` Joel Brobecker
2009-04-30 19:11 ` Paul Pluzhnikov
2009-04-30 22:12 ` Doug Evans
2009-04-30 23:18 ` Paul Pluzhnikov
2009-05-01 0:20 ` Paul Pluzhnikov
2009-05-11 13:13 ` Pedro Alves
2009-05-11 18:09 ` Paul Pluzhnikov
2009-05-11 21:09 ` Pedro Alves
2009-05-12 7:16 ` Hui Zhu [this message]
2009-05-12 16:42 ` Paul Pluzhnikov
2009-05-13 2:56 ` Hui Zhu
2009-05-13 3:29 ` Paul Pluzhnikov
2009-05-13 4:39 ` Hui Zhu
2009-05-15 14:37 ` Daniel Jacobowitz
2009-05-15 16:56 ` Paul Pluzhnikov
2009-05-01 7:21 ` Eli Zaretskii
2009-05-01 15:49 ` Paul Pluzhnikov
2009-05-01 16:49 ` Daniel Jacobowitz
2009-05-01 17:02 ` Paul Pluzhnikov
2009-05-01 17:11 ` Daniel Jacobowitz
2009-05-01 17:17 ` Pedro Alves
2009-05-01 18:53 ` Doug Evans
2009-05-04 0:07 ` Hui Zhu
2009-05-04 3:31 ` Paul Pluzhnikov
2009-05-05 2:54 ` Hui Zhu
2009-05-05 3:38 ` Joel Brobecker
2009-05-05 11:42 ` Hui Zhu
2009-05-11 11:34 ` Pedro Alves
2009-05-11 12:24 ` Joel Brobecker
2009-04-20 17:37 ` Paul Pluzhnikov
2009-04-20 18:46 ` Eli Zaretskii
2015-08-25 18:01 ` Jan Kratochvil
2015-08-25 18:14 ` Paul Pluzhnikov
2015-08-25 18:22 ` Jan Kratochvil
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=daef60380905120016s75ff5ef6q3892ca8ff3cf4b8b@mail.gmail.com \
--to=teawater@gmail.com \
--cc=bauerman@br.ibm.com \
--cc=brobecker@adacore.com \
--cc=drow@false.org \
--cc=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
--cc=pedro@codesourcery.com \
--cc=ppluzhnikov@google.com \
--cc=tromey@redhat.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox