public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug macros/15611] New: macros don't work with CWEB
@ 2013-06-12 17:32 knuth-bug at cs dot stanford.edu
  2013-06-14 17:10 ` [Bug macros/15611] " ccoutant at google dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: knuth-bug at cs dot stanford.edu @ 2013-06-12 17:32 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 15611
           Summary: macros don't work with CWEB
           Product: gdb
           Version: 7.4
            Status: NEW
          Severity: normal
          Priority: P2
         Component: macros
          Assignee: unassigned at sourceware dot org
          Reporter: knuth-bug at cs dot stanford.edu

Created attachment 7074
  --> http://sourceware.org/bugzilla/attachment.cgi?id=7074&action=edit
self-explanatory shell log

I've used CWEB for all my programs for more than 20 years (and more than
a thousand programs!). And I unwittingly introduce bugs, so I'm a heavy user
of GDB. Because of the #line directives, GDB works quite beautifully in
connection with CWEB, and I consider it to be a great treasure.

But I just learned about the "macro" abilities of GDB, and I find that
they are totally useless to me because the #line directives make the
macros invisible.

I know that CWEB accounts for only a relatively small subset of today's
users, even though it comes already installed with many Linux distributions.
In order to understand my problem with GDB's macros, you don't need to
know anything about CWEB except that it's a super-duper way to construct
C programs, using a processor called CTANGLE.

CTANGLE converts *.w files to *.c files. Those files contain #line directives,
which allow gcc and gdb etc. to sync with the original *.w source lines.
CTANGLE also changes CWEB constructs like "@d foo bar" into "#define foo bar".

The attached file is hopefully self-explanatory: I show a CWEB source file
"macrotest.w", I show the file "macrotest.c" produced by CTANGLE, and I show
GDB's inability to see the macros. Then I change "macrotest.c"
to "mcrtst.c", which is identical except for the #line directives;
and all works fine.

-- 
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/15611] macros don't work with CWEB
  2013-06-12 17:32 [Bug macros/15611] New: macros don't work with CWEB knuth-bug at cs dot stanford.edu
@ 2013-06-14 17:10 ` ccoutant at google dot com
  2015-10-20 13:29 ` sourceware at christianjaeger dot ch
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: ccoutant at google dot com @ 2013-06-14 17:10 UTC (permalink / raw)
  To: gdb-prs

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

Cary Coutant <ccoutant at google dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ccoutant at google dot com

--- Comment #1 from Cary Coutant <ccoutant at google dot com> ---
Have you tried the -a option?

(gdb) info macro -a a
Defined at /usr/local/google/home/ccoutant/scratch/macro/macrotest.c:2
#define a(x) b[x]

Without -a, GDB looks for macro definitions only in the current compilation
unit, and it thinks the macro is defined in macrotest.c, while you are
currently in macrotest.w.

I noticed that CTANGLE isn't putting a #line directive in front of the
translated macro definitions, so there's not even an expectation that they
would appear as coming from the original .w source file. That seems like a bug
in CTANGLE.

Nevertheless, when I added the #line directive manually, GCC seems to ignore it
when it generates the macro information in the DWARF (I tested with both the
older .debug_macinfo and the newer .debug_macro). That seems like a bug in GCC.

-- 
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/15611] macros don't work with CWEB
  2013-06-12 17:32 [Bug macros/15611] New: macros don't work with CWEB knuth-bug at cs dot stanford.edu
  2013-06-14 17:10 ` [Bug macros/15611] " ccoutant at google dot com
@ 2015-10-20 13:29 ` sourceware at christianjaeger dot ch
  2015-10-20 13:34 ` [Bug macros/15611] macros don't work with CWEB, or Perl XS, or other use of #line directives sourceware at christianjaeger dot ch
  2015-10-20 13:39 ` sourceware at christianjaeger dot ch
  3 siblings, 0 replies; 5+ messages in thread
From: sourceware at christianjaeger dot ch @ 2015-10-20 13:29 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=15611

ChristianJ <sourceware at christianjaeger dot ch> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sourceware@christianjaeger.
                   |                            |ch

--- Comment #2 from ChristianJ <sourceware at christianjaeger dot ch> ---
This problem is not limited to CWEB, of course. I just spent an hour trying to
figure out why macro debugging doesn't work for Perl modules that are using XS
code, which is C extended with more syntax which is translated to plain .c
files with #line directives of course to map back to the original source file.
And that breaks the macro debugging feature.

Also, while "info macro -a" works, there's no "-a" for "p" ("print"), and it's
print that I really want to be able to handle macros.

-- 
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/15611] macros don't work with CWEB, or Perl XS, or other use of #line directives
  2013-06-12 17:32 [Bug macros/15611] New: macros don't work with CWEB knuth-bug at cs dot stanford.edu
  2013-06-14 17:10 ` [Bug macros/15611] " ccoutant at google dot com
  2015-10-20 13:29 ` sourceware at christianjaeger dot ch
@ 2015-10-20 13:34 ` sourceware at christianjaeger dot ch
  2015-10-20 13:39 ` sourceware at christianjaeger dot ch
  3 siblings, 0 replies; 5+ messages in thread
From: sourceware at christianjaeger dot ch @ 2015-10-20 13:34 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=15611

ChristianJ <sourceware at christianjaeger dot ch> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|macros don't work with CWEB |macros don't work with
                   |                            |CWEB, or Perl XS, or other
                   |                            |use of #line directives

-- 
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/15611] macros don't work with CWEB, or Perl XS, or other use of #line directives
  2013-06-12 17:32 [Bug macros/15611] New: macros don't work with CWEB knuth-bug at cs dot stanford.edu
                   ` (2 preceding siblings ...)
  2015-10-20 13:34 ` [Bug macros/15611] macros don't work with CWEB, or Perl XS, or other use of #line directives sourceware at christianjaeger dot ch
@ 2015-10-20 13:39 ` sourceware at christianjaeger dot ch
  3 siblings, 0 replies; 5+ messages in thread
From: sourceware at christianjaeger dot ch @ 2015-10-20 13:39 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=15611

--- Comment #3 from ChristianJ <sourceware at christianjaeger dot ch> ---
PS. these are the gdb versions that I've tested, all with the same result (from
Debian oldstable, stable, and testing):

GNU gdb (GDB) 7.4.1-debian
GNU gdb (Debian 7.7.1+dfsg-5) 7.7.1
GNU gdb (Debian 7.10-1) 7.10

-- 
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:[~2015-10-20 13:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-12 17:32 [Bug macros/15611] New: macros don't work with CWEB knuth-bug at cs dot stanford.edu
2013-06-14 17:10 ` [Bug macros/15611] " ccoutant at google dot com
2015-10-20 13:29 ` sourceware at christianjaeger dot ch
2015-10-20 13:34 ` [Bug macros/15611] macros don't work with CWEB, or Perl XS, or other use of #line directives sourceware at christianjaeger dot ch
2015-10-20 13:39 ` sourceware at christianjaeger dot ch

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).