From: Pedro Alves <pedro@codesourcery.com>
To: Paul Pluzhnikov <ppluzhnikov@google.com>
Cc: gdb-patches@sourceware.org, dje@google.com
Subject: Re: [patch] Allow gdbserver to dynamically lookup libthread_db.so.1
Date: Tue, 06 Oct 2009 23:44:00 -0000 [thread overview]
Message-ID: <200910070044.24367.pedro@codesourcery.com> (raw)
In-Reply-To: <8ac60eac0910061608w4d5d2697vbb1b23138f7d95be@mail.gmail.com>
On Wednesday 07 October 2009 00:08:36, Paul Pluzhnikov wrote:
> > I take it you only care for extended-remote? How is the user
> > supposed to tweak the new setting with plain remote?
>
> Note that default search path is initialized from LIBTHREAD_DB_SEARCH_PATH.
>
> The user is expected to set this to appropriate system-specific default if
> the standard loader search path is inappropriate.
Okay. Something like a command line option would be more user
friendly, but if you don't need it, it's fine to leave that out
until someone does.
On Wednesday 07 October 2009 00:08:36, Paul Pluzhnikov wrote:
> If we can find '-lthread_db', '/lib/libthread_db.so.1' or
> '$prefix/lib/libthread_db.so.1', then we switch on using libthread_db and
> use '-ldl' to dynamically load it.
>
> Perhaps a better fix is to skip this check altogether, and always use
> dlopen on Linux?
I guess your patch's already doing that. You mean always use -dl. Yes,
let's do that. That's how a linux gdb is built too.
I can't look at the whole patch right now, but a quick skim
looked good. I noticed this:
+void
+thread_db_handle_monitor_command (char *mon)
+{
+ if (strncmp (mon, "set libthread-db-search-path", 28) == 0)
+ {
+ const char *cp = mon + 28;
+
+ if (libthread_db_search_path != NULL)
+ free (libthread_db_search_path);
+
+ /* Skip leading space (if any). */
+ while (isspace (*cp))
+ ++cp;
+
+ libthread_db_search_path = xstrdup (cp);
+
+ monitor_output ("libthread-db-search-path set to `");
+ monitor_output (libthread_db_search_path);
+ monitor_output ("'\n");
+ }
+ else
+ handle_monitor_command (mon);
+}
Could you tweak the interface a bit, to return a boolean indicating
if the command was handled or not? E.g.,
+int
+thread_db_handle_monitor_command (char *mon)
+{
+ if (strncmp (mon, "set libthread-db-search-path", 28) == 0)
+ {
+ const char *cp = mon + 28;
+
+ if (libthread_db_search_path != NULL)
+ free (libthread_db_search_path);
+
+ /* Skip leading space (if any). */
+ while (isspace (*cp))
+ ++cp;
+
+ libthread_db_search_path = xstrdup (cp);
+
+ monitor_output ("libthread-db-search-path set to `");
+ monitor_output (libthread_db_search_path);
+ monitor_output ("'\n");
+ return 1;
+ }
+
+ return 0;
+}
Then this allows chaining handlers, and, only server.c needs to call
handle_monitor_command if nothing handled the command. Might want to
force a whitespace after "set libthread-db-search-path", so that
"set libthread-db-search-pathfoofoo" isn't accepted while at it.
--
Pedro Alves
next prev parent reply other threads:[~2009-10-06 23:44 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-02 16:34 Paul Pluzhnikov
2009-09-02 16:43 ` Paul Pluzhnikov
2009-09-02 16:47 ` Pedro Alves
2009-09-02 17:16 ` Paul Pluzhnikov
2009-09-02 17:19 ` Doug Evans
2009-10-02 23:51 ` Paul Pluzhnikov
2009-10-04 20:32 ` Pedro Alves
2009-10-05 1:49 ` Paul Pluzhnikov
2009-10-05 3:03 ` Pedro Alves
2009-10-13 13:53 ` Pedro Alves
2009-10-06 23:08 ` Paul Pluzhnikov
2009-10-06 23:44 ` Pedro Alves [this message]
2009-10-07 0:27 ` Paul Pluzhnikov
2009-10-08 18:08 ` Pedro Alves
2009-10-08 19:05 ` Daniel Jacobowitz
2009-10-08 19:21 ` Paul Pluzhnikov
2009-10-08 19:42 ` Daniel Jacobowitz
2009-10-16 0:41 ` Paul Pluzhnikov
2009-10-22 21:03 ` Paul Pluzhnikov
2009-10-29 16:52 ` Paul Pluzhnikov
2009-10-29 17:27 ` Daniel Jacobowitz
2009-10-29 17:45 ` Paul Pluzhnikov
2009-10-08 19:36 ` Paul Pluzhnikov
2009-10-08 22:58 ` Pedro Alves
2009-10-04 20:34 ` Pedro Alves
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=200910070044.24367.pedro@codesourcery.com \
--to=pedro@codesourcery.com \
--cc=dje@google.com \
--cc=gdb-patches@sourceware.org \
--cc=ppluzhnikov@google.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