Here is a problem that makes it impossible to debug preprocessed source files.

Take this file:
============================== spvw.d ==============================
#include <stdio.h>
#define GREETING "Hello, world.\n"
int main ()
{
  printf(GREETING);
  return 0;
}
====================================================================

Process it with a preprocessor, such as clisp's "comment5", this gives:

============================== spvw.c ==============================
#line 1 "spvw.d"
#include <stdio.h>
#define GREETING "Hello, world.\n"
int main ()
{
  printf(GREETING);
  return 0;
}
====================================================================

Compile this with gcc-3.2.1 on Linux/x86:

$ gcc -gdwarf-2 -g3 spvw.c

Now debug it:

$ gdb a.out 
GNU gdb 5.3
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...
(gdb) break main
Breakpoint 1 at 0x804834c: file spvw.d, line 5.
(gdb) run
Starting program: /tmp/a.out 

Breakpoint 1, main () at spvw.d:5
5         printf(GREETING);
(gdb) print 0
../../gdb/macroscope.c:48: gdb-internal-error: 
the symtab `spvw.d' refers to a preprocessor macro table which doesn't
have any record of processing a file by that name.

An internal GDB error was detected.  This may make further
debugging unreliable.  Quit this debugging session? (y or n) 

Under the debugger I can see that at macroscope.c:48
*sal.symtab.macro_table.main_source contains the filenames
"/tmp/spvw.c", "/usr/include/stdio.h", etc. but no "spvw.d".

Since spvw.c was generated from spvw.d, and contains the correct #line
statement, one should expect to see spvw.d in this list.

Bruno


_______________________________________________
Bug-gdb mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-gdb

Reply via email to