public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug macros/9873] New: DWARF command-line defined macros get ignored
@ 2009-02-19 21:36 jan dot kratochvil at redhat dot com
  2009-02-19 21:37 ` [Bug macros/9873] " jan dot kratochvil at redhat dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: jan dot kratochvil at redhat dot com @ 2009-02-19 21:36 UTC (permalink / raw)
  To: gdb-prs

>From Roland McGrath:
-g3 puts both implicit predefines and -D/-U records in the wrong place in
.debug_macinfo.
Steps to Reproduce:
1. echo '#define foo bar' > g3.c; echo 'foo(){}' >> g3.c
2. gcc -c -g3 g3.c -DFOO=1 -UFOO
3. readelf --debug-dump=macro g3.o
Actual results:
The implicit predefines appear after the start_file record for "g3.c",
with fake line numbers, then the -D/-U records also with fake line numbers.
Expected results:
DWARF spec says predefines come before the first start_file record, and all use
line number 0.

GCC patch by Jakub Jelinek is provided but current GDB starts to ignore such
macros.  Thus the GDB HEAD acceptance is a prerequisite for the GCC HEAD change.

current GCC:
Contents of the .debug_macinfo section:
 DW_MACINFO_start_file - lineno: 0 filenum: 1
 DW_MACINFO_define - lineno : 0 macro : __STDC__ 1
 DW_MACINFO_define - lineno : 0 macro : __STDC_HOSTED__ 1

patched GCC:
Contents of the .debug_macinfo section:
 DW_MACINFO_define - lineno : 0 macro : __STDC__ 1
 DW_MACINFO_define - lineno : 0 macro : __STDC_HOSTED__ 1

http://dwarf.freestandards.org/Dwarf3.pdf
6.3.3 Macinfo Entries for Command Line Options
[..]
All such DW_MACINFO_define and DW_MACINFO_undef entries representing
compilation options should appear before the first DW_MACINFO_start_file entry
for that compilation unit and should encode the value 0 in their line number
operands.

current GCC + current GDB:
patched GCC + patched GDB:
(gdb) info macro __STDC__
Defined at ../.././gdb/testsuite/gdb.base/macscp1.c:0
#define __STDC__ 1

patched GCC + current GDB:
During symbol reading, debug info gives macro definition outside of any file:
__STDC__ 1.
During symbol reading, debug info gives macro definition outside of any file:
__STDC_HOSTED__ 1.
(gdb) info macro __STDC__
The symbol `__STDC__' has no definition as a C/C++ preprocessor macro
at gdb.base/macscp1.c:102

current GCC + patched GDB:
During symbol reading, debug info gives in-file macro definition with zero line
0: __STDC__ 1.
During symbol reading, debug info gives in-file macro definition with zero line
0: __STDC_HOSTED__ 1.
(gdb) info macro __STDC__
Defined at ../.././gdb/testsuite/gdb.base/macscp1.c:0
#define __STDC__ 1

-- 
           Summary: DWARF command-line defined macros get ignored
           Product: gdb
           Version: unknown
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: macros
        AssignedTo: jan dot kratochvil at redhat dot com
        ReportedBy: jan dot kratochvil at redhat dot com
                CC: gdb-prs at sourceware dot org


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug macros/9873] DWARF command-line defined macros get ignored
  2009-02-19 21:36 [Bug macros/9873] New: DWARF command-line defined macros get ignored jan dot kratochvil at redhat dot com
@ 2009-02-19 21:37 ` jan dot kratochvil at redhat dot com
  2009-02-19 21:39 ` jan dot kratochvil at redhat dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jan dot kratochvil at redhat dot com @ 2009-02-19 21:37 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From jan dot kratochvil at redhat dot com  2009-02-19 21:37 -------
Created an attachment (id=3753)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=3753&action=view)
GCC patch by Jakub Jelinek.


-- 


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug macros/9873] DWARF command-line defined macros get ignored
  2009-02-19 21:36 [Bug macros/9873] New: DWARF command-line defined macros get ignored jan dot kratochvil at redhat dot com
  2009-02-19 21:37 ` [Bug macros/9873] " jan dot kratochvil at redhat dot com
@ 2009-02-19 21:39 ` jan dot kratochvil at redhat dot com
  2009-03-09 18:54 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jan dot kratochvil at redhat dot com @ 2009-02-19 21:39 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From jan dot kratochvil at redhat dot com  2009-02-19 21:39 -------
Created an attachment (id=3754)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=3754&action=view)
GDB fix+testcase.


-- 


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug macros/9873] DWARF command-line defined macros get ignored
  2009-02-19 21:36 [Bug macros/9873] New: DWARF command-line defined macros get ignored jan dot kratochvil at redhat dot com
  2009-02-19 21:37 ` [Bug macros/9873] " jan dot kratochvil at redhat dot com
  2009-02-19 21:39 ` jan dot kratochvil at redhat dot com
@ 2009-03-09 18:54 ` cvs-commit at gcc dot gnu dot org
  2009-03-09 18:56 ` jan dot kratochvil at redhat dot com
  2009-03-09 18:57 ` jan dot kratochvil at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2009-03-09 18:54 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2009-03-09 18:54 -------
Subject: Bug 9873

CVSROOT:	/cvs/src
Module name:	src
Changes by:	jkratoch@sourceware.org	2009-03-09 18:53:48

Modified files:
	gdb            : ChangeLog dwarf2read.c 

Log message:
	PR gdb/9873:
	* dwarf2read.c (dwarf_decode_macros): New variable `at_commandline'.
	Move the variable `macinfo_type' out of the loop.  Create a new
	processing pass before the current one to pre-create `current_file'.
	New complaint on misplaced zero/non-zero definitions/includes.
	Skip first DW_MACINFO_start_file with `at_commandline' set.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.10233&r2=1.10234
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/dwarf2read.c.diff?cvsroot=src&r1=1.295&r2=1.296



-- 


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug macros/9873] DWARF command-line defined macros get ignored
  2009-02-19 21:36 [Bug macros/9873] New: DWARF command-line defined macros get ignored jan dot kratochvil at redhat dot com
                   ` (2 preceding siblings ...)
  2009-03-09 18:54 ` cvs-commit at gcc dot gnu dot org
@ 2009-03-09 18:56 ` jan dot kratochvil at redhat dot com
  2009-03-09 18:57 ` jan dot kratochvil at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: jan dot kratochvil at redhat dot com @ 2009-03-09 18:56 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From jan dot kratochvil at redhat dot com  2009-03-09 18:56 -------
(From update of attachment 3754)
Updated patch has been checked-in.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
Attachment #3754 is|0                           |1
           obsolete|                            |


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug macros/9873] DWARF command-line defined macros get ignored
  2009-02-19 21:36 [Bug macros/9873] New: DWARF command-line defined macros get ignored jan dot kratochvil at redhat dot com
                   ` (3 preceding siblings ...)
  2009-03-09 18:56 ` jan dot kratochvil at redhat dot com
@ 2009-03-09 18:57 ` jan dot kratochvil at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: jan dot kratochvil at redhat dot com @ 2009-03-09 18:57 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From jan dot kratochvil at redhat dot com  2009-03-09 18:57 -------
Checked-in.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

end of thread, other threads:[~2009-03-09 18:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-19 21:36 [Bug macros/9873] New: DWARF command-line defined macros get ignored jan dot kratochvil at redhat dot com
2009-02-19 21:37 ` [Bug macros/9873] " jan dot kratochvil at redhat dot com
2009-02-19 21:39 ` jan dot kratochvil at redhat dot com
2009-03-09 18:54 ` cvs-commit at gcc dot gnu dot org
2009-03-09 18:56 ` jan dot kratochvil at redhat dot com
2009-03-09 18:57 ` jan dot kratochvil 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).