Summary: | Add support for __FILE__, __LINE__. | ||
---|---|---|---|
Product: | gdb | Reporter: | dje |
Component: | macros | Assignee: | Tom Tromey <tromey> |
Status: | RESOLVED FIXED | ||
Severity: | enhancement | CC: | tromey |
Priority: | P2 | ||
Version: | HEAD | ||
Target Milestone: | 7.5 | ||
Host: | Target: | ||
Build: | Last reconfirmed: |
Description
dje
2011-09-20 17:49:40 UTC
I have a patch for the reported issue, but gcc actually has many special defines... /* Different flavors of builtin macro. _Pragma is an operator, but we handle it with the builtin code for efficiency reasons. */ enum cpp_builtin_type { BT_SPECLINE = 0, /* `__LINE__' */ BT_DATE, /* `__DATE__' */ BT_FILE, /* `__FILE__' */ BT_BASE_FILE, /* `__BASE_FILE__' */ BT_INCLUDE_LEVEL, /* `__INCLUDE_LEVEL__' */ BT_TIME, /* `__TIME__' */ BT_STDC, /* `__STDC__' */ BT_PRAGMA, /* `_Pragma' operator */ BT_TIMESTAMP, /* `__TIMESTAMP__' */ BT_COUNTER, /* `__COUNTER__' */ BT_FIRST_USER, /* User defined builtin macros. */ BT_LAST_USER = BT_FIRST_USER + 31 }; I didn't try to handle them all. CVSROOT: /cvs/src Module name: src Changes by: tromey@sourceware.org 2012-05-16 20:31:10 Modified files: gdb : ChangeLog dwarf2read.c macroexp.c macroexp.h macrotab.c macrotab.h gdb/testsuite : ChangeLog gdb/testsuite/gdb.base: macscp.exp macscp1.c Log message: PR macros/13205: * macrotab.h: (macro_define_special): Declare. (enum macro_special_kind): New. (struct macro_definition) <argc, replacement>: Update comments. * macrotab.c (new_macro_definition): Unconditionally set 'argc'. (macro_define_object_internal): New function. (macro_define_object): Use it. (macro_define_special): New function. (fixup_definition): New function. (macro_lookup_definition, foreach_macro_in_scope) (foreach_macro): Use fixup_definition. * macroexp.h (macro_stringify): Declare. * macroexp.c (free_buffer_return_text): New function. (stringify): Constify "arg". (macro_stringify): New function. * dwarf2read.c (macro_start_file): Call macro_define_special. testsuite * gdb.base/macscp1.c (macscp_expr): Add comment. * gdb.base/macscp.exp: Test __FILE__ and __LINE__. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.14256&r2=1.14257 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/dwarf2read.c.diff?cvsroot=src&r1=1.649&r2=1.650 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/macroexp.c.diff?cvsroot=src&r1=1.28&r2=1.29 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/macroexp.h.diff?cvsroot=src&r1=1.11&r2=1.12 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/macrotab.c.diff?cvsroot=src&r1=1.26&r2=1.27 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/macrotab.h.diff?cvsroot=src&r1=1.17&r2=1.18 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.3193&r2=1.3194 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.base/macscp.exp.diff?cvsroot=src&r1=1.31&r2=1.32 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.base/macscp1.c.diff?cvsroot=src&r1=1.5&r2=1.6 Fixed. |