Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Handling corner case in building symbol table when "debug_line" includes  compilation directory
@ 2007-03-15  1:55 Maxim Grigoriev
  2007-03-15  2:27 ` Daniel Jacobowitz
  0 siblings, 1 reply; 8+ messages in thread
From: Maxim Grigoriev @ 2007-03-15  1:55 UTC (permalink / raw)
  To: gdb-patches

Hello All,

Tensilica compiler seems to provide a unique approach in building DWARF
line tables. It confuses GDB algorithms being used to build symbol tables.

First in DW_TAG_compile_unit entry

   DW_AT_name        is a source file name as it was used in a command line;
   DW_AT_comp_dir    is a full path name to a compilation directory;    

Then in the statement program prologue, the directory table includes at
least one entry, which is again the compilation directory. And, there is
a corresponding file table entry referencing to this directory.

Assuming that this combination of the names of the directories and files
does not contradict DWARF standard, I think GDB has to handle this 
situation.

I suggest the following patch to fix this problem:

2007-03-15 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    15 Mar 2007 01:14:14 -0000
@@ -549,7 +549,18 @@
 
   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_name = concat (dirname, SLASH_STRING,
+                 subfile->name, (char *)NULL);
+      make_cleanup (xfree, subfile_name);
+    }
+      else
+    {
+      subfile_name = subfile->name;
+    }
+      if (FILENAME_CMP (subfile_name, name) == 0)
     {
       current_subfile = subfile;
       return;


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-05-14 19:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-15  1:55 Handling corner case in building symbol table when "debug_line" includes compilation directory Maxim Grigoriev
2007-03-15  2:27 ` Daniel Jacobowitz
2007-03-15  4:30   ` Maxim Grigoriev
2007-04-10 21:03     ` Daniel Jacobowitz
2007-04-10 23:34       ` Maxim Grigoriev
2007-04-11  2:06         ` Maxim Grigoriev
2007-05-14 14:11           ` Daniel Jacobowitz
2007-05-14 19:01             ` Maxim Grigoriev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox