This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Handling corner case in building symbol table when "debug_line" includes compilation directory
- From: Maxim Grigoriev <maxim at tensilica dot com>
- To: Maxim Grigoriev <maxim at tensilica dot com>, gdb-patches at sources dot redhat dot com, Daniel Jacobowitz <drow at false dot org>
- Date: Tue, 10 Apr 2007 16:34:00 -0700
- Subject: Re: Handling corner case in building symbol table when "debug_line" includes compilation directory
- References: <45F8A771.2060008@hq.tensilica.com> <20070315022735.GA9613@caradoc.them.org> <45F8CBDF.9090501@hq.tensilica.com> <20070410210346.GD2056@caradoc.them.org>
Daniel Jacobowitz wrote:
. . . . . .
+ char *subfile_name;
+ if (IS_ABSOLUTE_PATH(name) && !IS_ABSOLUTE_PATH (subfile->name))
+ {
+ subfile_name = concat (dirname, SLASH_STRING,
+ subfile->name, (char *)NULL);
Isn't that the wrong DIRNAME? That's supposed to be a prefix to NAME,
but SUBFILE might be in a different directory. You need
subfile->dirname (if it's not NULL).
As for the patch, watch out for your formatting. Spaces around
parentheses and you don't need braces around a single statement.
Also, creating a cleanup in a function that doesn't call do_cleanups
is bad. It would be better to free it immediately when we're done
with it
I didn't manage to create a test case when "subfile->dirname"
is different from "dirname". But, I think your comment is
correct. I followed all your suggestions and attached new
patch. Thanks for looking into this.
2007-04-10 Maxim Grigoriev <maxim2405@gmail.com>
* buildsym.c (start_subfile): Add handling missing case while
building symbol table for a compilation unit.
Index: gdb/buildsym.c
===================================================================
RCS file: /cvs/src/src/gdb/buildsym.c,v
retrieving revision 1.47
diff -u -r1.47 buildsym.c
--- gdb/buildsym.c 27 Feb 2007 22:57:42 -0000 1.47
+++ gdb/buildsym.c 10 Apr 2007 23:22:49 -0000
@@ -549,9 +549,19 @@
for (subfile = subfiles; subfile; subfile = subfile->next)
{
- if (FILENAME_CMP (subfile->name, name) == 0)
+ char *subfile_name;
+ if (IS_ABSOLUTE_PATH(name) &&
+ !IS_ABSOLUTE_PATH (subfile->name) &&
+ (subfile->dirname != NULL))
+ subfile_name = concat (subfile->dirname, SLASH_STRING,
+ subfile->name, NULL);
+ else
+ subfile_name = subfile->name;
+ if (FILENAME_CMP (subfile_name, name) == 0)
{
current_subfile = subfile;
+ if (subfile_name != subfile->name)
+ xfree (subfile_name);
return;
}
}