public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug macros/13205] New: Add support for __FILE__, __LINE__.
@ 2011-09-20 21:31 dje at google dot com
  2012-05-16 19:52 ` [Bug macros/13205] " tromey at redhat dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: dje at google dot com @ 2011-09-20 21:31 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=13205

             Bug #: 13205
           Summary: Add support for __FILE__, __LINE__.
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: macros
        AssignedTo: unassigned@sourceware.org
        ReportedBy: dje@google.com
    Classification: Unclassified


This is related to 9748, but concerns the specific cases of __FILE__, __LINE__.
[And maybe __FUNCTION__, __func__, __PRETTY_FUNCTION__ (though for reference
sake these aren't preprocessor macros).]

IWBN if the expression parser recognized these symbols and did the right thing.
As for producing the same value as GCC would in the presence of optimized code,
one has to weigh having cut-n-pasted expressions break versus producing some
answer.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug macros/13205] Add support for __FILE__, __LINE__.
  2011-09-20 21:31 [Bug macros/13205] New: Add support for __FILE__, __LINE__ dje at google dot com
@ 2012-05-16 19:52 ` tromey at redhat dot com
  2012-05-16 20:06 ` tromey at redhat dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: tromey at redhat dot com @ 2012-05-16 19:52 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=13205

Tom Tromey <tromey at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at redhat dot com

--- Comment #1 from Tom Tromey <tromey at redhat dot com> 2012-05-16 19:52:25 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.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug macros/13205] Add support for __FILE__, __LINE__.
  2011-09-20 21:31 [Bug macros/13205] New: Add support for __FILE__, __LINE__ dje at google dot com
  2012-05-16 19:52 ` [Bug macros/13205] " tromey at redhat dot com
@ 2012-05-16 20:06 ` tromey at redhat dot com
  2012-05-16 20:32 ` cvs-commit at gcc dot gnu.org
  2012-05-16 20:32 ` tromey at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: tromey at redhat dot com @ 2012-05-16 20:06 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=13205

Tom Tromey <tromey at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at sourceware    |tromey at redhat dot com
                   |dot org                     |

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug macros/13205] Add support for __FILE__, __LINE__.
  2011-09-20 21:31 [Bug macros/13205] New: Add support for __FILE__, __LINE__ dje at google dot com
  2012-05-16 19:52 ` [Bug macros/13205] " tromey at redhat dot com
  2012-05-16 20:06 ` tromey at redhat dot com
@ 2012-05-16 20:32 ` cvs-commit at gcc dot gnu.org
  2012-05-16 20:32 ` tromey at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2012-05-16 20:32 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=13205

--- Comment #2 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> 2012-05-16 20:31:14 UTC ---
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

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug macros/13205] Add support for __FILE__, __LINE__.
  2011-09-20 21:31 [Bug macros/13205] New: Add support for __FILE__, __LINE__ dje at google dot com
                   ` (2 preceding siblings ...)
  2012-05-16 20:32 ` cvs-commit at gcc dot gnu.org
@ 2012-05-16 20:32 ` tromey at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: tromey at redhat dot com @ 2012-05-16 20:32 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=13205

Tom Tromey <tromey at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |7.5

--- Comment #3 from Tom Tromey <tromey at redhat dot com> 2012-05-16 20:32:09 UTC ---
Fixed.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

end of thread, other threads:[~2012-05-16 20:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-20 21:31 [Bug macros/13205] New: Add support for __FILE__, __LINE__ dje at google dot com
2012-05-16 19:52 ` [Bug macros/13205] " tromey at redhat dot com
2012-05-16 20:06 ` tromey at redhat dot com
2012-05-16 20:32 ` cvs-commit at gcc dot gnu.org
2012-05-16 20:32 ` tromey at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).