From: Aleksandar Ristovski <aristovski@qnx.com>
To: Tom Tromey <tromey@redhat.com>
Cc: Doug Evans <dje@google.com>, gdb-patches@sources.redhat.com
Subject: Re: [patch] symfile find_separate_debug_file
Date: Fri, 14 Aug 2009 14:44:00 -0000 [thread overview]
Message-ID: <4A85635D.7060508@qnx.com> (raw)
In-Reply-To: <m3iqgrl459.fsf@fleche.redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1076 bytes --]
Tom Tromey wrote:
>>>>>> "Doug" == Doug Evans <dje@google.com> writes:
>
> Doug> fwiw, I wouldn't mind an elaboration of the comment, e.g. provide an
> Doug> example when "unless there isn't" happens. Otherwise I have to go
> Doug> looking and assume what I find is what the comment is referring to.
>
> Sounds reasonable to me.
My initial idea was to remove that comment altogether since
it describes an assumption that may have been good at the
time, but doesn't stand any longer. But then went with
"minimal change" approach.
The code itself is clear and I don't think it needs
explanation: if file does not contain any directory
separators, use current directory. It happens when gdb opens
a shared library from its current directory (e.g. libc.so.3).
So how about I remove portion of that comment, and leave
only generic part that makes no assumptions about presence
of dir. separators? (new patch attached).
--
Aleksandar Ristovski
QNX Software Systems
* symfile.c (find_separate_debug_file): Fix the case when
objfile has only basename as its name.
[-- Attachment #2: symfile-20090814.diff --]
[-- Type: text/x-patch, Size: 1005 bytes --]
Index: gdb/symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.240
@@ -1377,15 +1371,21 @@ find_separate_debug_file (struct objfile
dir = xstrdup (objfile->name);
/* Strip off the final filename part, leaving the directory name,
- followed by a slash. Objfile names should always be absolute and
- tilde-expanded, so there should always be a slash in there
- somewhere. */
- for (i = strlen(dir) - 1; i >= 0; i--)
+ followed by a slash. */
+ for (i = strlen (dir) - 1; i >= 0; i--)
{
if (IS_DIR_SEPARATOR (dir[i]))
break;
}
- gdb_assert (i >= 0 && IS_DIR_SEPARATOR (dir[i]));
+ if (i < 0)
+ {
+ /* We are dealing with base name only. Make it current dir. */
+ if (strlen (dir) < 2)
+ dir = xrealloc (dir, 3);
+ dir[0] = '.';
+ dir[1] = '/';
+ i = 1;
+ }
dir[i+1] = '\0';
/* Set I to max (strlen (canon_name), strlen (dir)). */
next prev parent reply other threads:[~2009-08-14 13:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-10 18:58 Aleksandar Ristovski
2009-08-13 22:37 ` Tom Tromey
2009-08-13 22:50 ` Doug Evans
2009-08-14 0:40 ` Tom Tromey
2009-08-14 14:44 ` Aleksandar Ristovski [this message]
2009-08-14 15:45 ` Doug Evans
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=4A85635D.7060508@qnx.com \
--to=aristovski@qnx.com \
--cc=dje@google.com \
--cc=gdb-patches@sources.redhat.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