* [Bug debug/51358] missing location
2011-11-30 16:49 [Bug debug/51358] New: missing location mark at gcc dot gnu.org
@ 2011-11-30 21:07 ` jan.kratochvil at redhat dot com
2011-12-01 11:08 ` jakub at gcc dot gnu.org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jan.kratochvil at redhat dot com @ 2011-11-30 21:07 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51358
--- Comment #1 from Jan Kratochvil <jan.kratochvil at redhat dot com> 2011-11-30 20:46:54 UTC ---
(In reply to comment #0)
> Compiling the following with g++ -gdwarf-4 -o length length.cxx
[...]
> <aa5> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
[...]
> <ab6> DW_AT_location : 2 byte block: 91 58 (DW_OP_fbreg: -40)
>
> Which seems to suggest that the formal_parameter "str" can always be accessed
> through fbreg -40. But this isn't true as you can see by looking at the
> generated code:
>
> Dump of assembler code for function length(std::string const&):
> 0x000000000040088c <+0>: push %rbp
> 0x000000000040088d <+1>: mov %rsp,%rbp
> 0x0000000000400890 <+4>: sub $0x20,%rsp
> 0x0000000000400894 <+8>: mov %rdi,-0x18(%rbp)
[...]
> The argument was actually in %rdi, which isn't pushed on the stack till
> 400894, so when we probe at the start of the function (40088c) we will see
> garbage when trying to extract the str parameter.
>
> Is there a way a dwarf consumer could have known that?
This is AFAIK correct. With -O0 there is no location tracking and the consumer
must skip the prologue first before considering DW_AT_location content.
See GDB symtab->locations_valid detection so that GDB at least knows the cases
when it does not have to skip the prologue.
locations_valid detection should be further extended by detecting -O>=1 in
DW_AT_producer for some rare cases where the current GDB detection would not
work. But -grecord-gcc-switches is not default in FSF GCC so the
DW_AT_producer may not be so useful for FSF GCC builds.
> GCC also doesn't seem to produce line table prologue markers, so it also
> doesn't help trying to search for the end of prologue.
(a) GDB reliably detects the prologue end by skipping the first source line.
GCC even supports this by producing 0-line advance in some cases.
(b) I cannot find the Bug now but my request for DW_LNS_set_prologue_end has
been declined as the current source-line based detection works correctly
and DW_LNS_set_prologue_end would just needlessly increase the debug info
size.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug debug/51358] missing location
2011-11-30 16:49 [Bug debug/51358] New: missing location mark at gcc dot gnu.org
2011-11-30 21:07 ` [Bug debug/51358] " jan.kratochvil at redhat dot com
@ 2011-12-01 11:08 ` jakub at gcc dot gnu.org
2012-08-06 18:36 ` [Bug debug/51358] incorrect/missing location for function arg, -O0, without VTA rguenth at gcc dot gnu.org
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-12-01 11:08 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51358
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-12-01 11:07:44 UTC ---
See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42801#c2
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug debug/51358] incorrect/missing location for function arg, -O0, without VTA
2011-11-30 16:49 [Bug debug/51358] New: missing location mark at gcc dot gnu.org
2011-11-30 21:07 ` [Bug debug/51358] " jan.kratochvil at redhat dot com
2011-12-01 11:08 ` jakub at gcc dot gnu.org
@ 2012-08-06 18:36 ` rguenth at gcc dot gnu.org
2012-08-12 18:38 ` jan.kratochvil at redhat dot com
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-08-06 18:36 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51358
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-debug
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-08-06
CC| |rguenth at gcc dot gnu.org
Ever Confirmed|0 |1
--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-08-06 18:35:35 UTC ---
I also recently ran into this ... why can't GCC simply provide no location
information for the prologue? Thus, properly restrict the PC range the
fb-based locations are valid? At the moment GCC simply lies.
Confirmed.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug debug/51358] incorrect/missing location for function arg, -O0, without VTA
2011-11-30 16:49 [Bug debug/51358] New: missing location mark at gcc dot gnu.org
` (2 preceding siblings ...)
2012-08-06 18:36 ` [Bug debug/51358] incorrect/missing location for function arg, -O0, without VTA rguenth at gcc dot gnu.org
@ 2012-08-12 18:38 ` jan.kratochvil at redhat dot com
2012-08-12 20:22 ` fche at redhat dot com
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jan.kratochvil at redhat dot com @ 2012-08-12 18:38 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51358
--- Comment #4 from Jan Kratochvil <jan.kratochvil at redhat dot com> 2012-08-12 18:37:26 UTC ---
It would not be helpful, systemtap would then see no data (just not wrong
data).
Also at that time location list will need to be used and currently GDB when it
sees any location list it thinks it no longer needs to skip the prologue.
OTOH GDB could look at -grecord-gcc-switches first which it currently does not
so I should just finally implement -grecord-gcc-switches in GDB in such case.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug debug/51358] incorrect/missing location for function arg, -O0, without VTA
2011-11-30 16:49 [Bug debug/51358] New: missing location mark at gcc dot gnu.org
` (3 preceding siblings ...)
2012-08-12 18:38 ` jan.kratochvil at redhat dot com
@ 2012-08-12 20:22 ` fche at redhat dot com
2012-08-12 20:31 ` mark at gcc dot gnu.org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: fche at redhat dot com @ 2012-08-12 20:22 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51358
--- Comment #5 from Frank Ch. Eigler <fche at redhat dot com> 2012-08-12 20:21:24 UTC ---
(In reply to comment #4)
> It would not be helpful, systemtap would then see no data [...]
Not quite; systemtap can search the PC ranges/line tables for a nearby address
where a corrected location list would cover.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug debug/51358] incorrect/missing location for function arg, -O0, without VTA
2011-11-30 16:49 [Bug debug/51358] New: missing location mark at gcc dot gnu.org
` (4 preceding siblings ...)
2012-08-12 20:22 ` fche at redhat dot com
@ 2012-08-12 20:31 ` mark at gcc dot gnu.org
2012-08-13 8:56 ` rguenth at gcc dot gnu.org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: mark at gcc dot gnu.org @ 2012-08-12 20:31 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51358
--- Comment #6 from Mark Wielaard <mark at gcc dot gnu.org> 2012-08-12 20:30:36 UTC ---
(In reply to comment #5)
> (In reply to comment #4)
> > It would not be helpful, systemtap would then see no data [...]
>
> Not quite; systemtap can search the PC ranges/line tables for a nearby address
> where a corrected location list would cover.
And at least systemtap could give an error/warning to the user the data isn't
available instead of providing bogus values...
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug debug/51358] incorrect/missing location for function arg, -O0, without VTA
2011-11-30 16:49 [Bug debug/51358] New: missing location mark at gcc dot gnu.org
` (5 preceding siblings ...)
2012-08-12 20:31 ` mark at gcc dot gnu.org
@ 2012-08-13 8:56 ` rguenth at gcc dot gnu.org
2012-11-18 4:13 ` [Bug debug/51358] [4.8 Regression] " pinskia at gcc dot gnu.org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-08-13 8:56 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51358
--- Comment #7 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-08-13 08:55:05 UTC ---
(In reply to comment #4)
> It would not be helpful, systemtap would then see no data (just not wrong
> data).
>
> Also at that time location list will need to be used and currently GDB when it
> sees any location list it thinks it no longer needs to skip the prologue.
> OTOH GDB could look at -grecord-gcc-switches first which it currently does not
> so I should just finally implement -grecord-gcc-switches in GDB in such case.
I think seeing wrong data, thus, wrong-debug is never superior over "no debug
info / no data".
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug debug/51358] [4.8 Regression] incorrect/missing location for function arg, -O0, without VTA
2011-11-30 16:49 [Bug debug/51358] New: missing location mark at gcc dot gnu.org
` (6 preceding siblings ...)
2012-08-13 8:56 ` rguenth at gcc dot gnu.org
@ 2012-11-18 4:13 ` pinskia at gcc dot gnu.org
2012-11-19 9:10 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-11-18 4:13 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51358
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.8.0
Summary|incorrect/missing location |[4.8 Regression]
|for function arg, -O0, |incorrect/missing location
|without VTA |for function arg, -O0,
| |without VTA
--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-11-18 04:13:17 UTC ---
This has now become an user visible regression as dwarf4 is now default.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug debug/51358] [4.8 Regression] incorrect/missing location for function arg, -O0, without VTA
2011-11-30 16:49 [Bug debug/51358] New: missing location mark at gcc dot gnu.org
` (7 preceding siblings ...)
2012-11-18 4:13 ` [Bug debug/51358] [4.8 Regression] " pinskia at gcc dot gnu.org
@ 2012-11-19 9:10 ` jakub at gcc dot gnu.org
2012-12-06 16:21 ` [Bug debug/51358] " rguenth at gcc dot gnu.org
2013-12-26 0:21 ` fche at redhat dot com
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-11-19 9:10 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51358
--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-11-19 09:09:59 UTC ---
I don't see the link between the bugreport and dwarf4, why do you think this is
a regression?
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug debug/51358] incorrect/missing location for function arg, -O0, without VTA
2011-11-30 16:49 [Bug debug/51358] New: missing location mark at gcc dot gnu.org
` (8 preceding siblings ...)
2012-11-19 9:10 ` jakub at gcc dot gnu.org
@ 2012-12-06 16:21 ` rguenth at gcc dot gnu.org
2013-12-26 0:21 ` fche at redhat dot com
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-12-06 16:21 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51358
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.8.0 |---
Summary|[4.8 Regression] |incorrect/missing location
|incorrect/missing location |for function arg, -O0,
|for function arg, -O0, |without VTA
|without VTA |
--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> 2012-12-06 16:21:33 UTC ---
Don't see that either.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug debug/51358] incorrect/missing location for function arg, -O0, without VTA
2011-11-30 16:49 [Bug debug/51358] New: missing location mark at gcc dot gnu.org
` (9 preceding siblings ...)
2012-12-06 16:21 ` [Bug debug/51358] " rguenth at gcc dot gnu.org
@ 2013-12-26 0:21 ` fche at redhat dot com
10 siblings, 0 replies; 12+ messages in thread
From: fche at redhat dot com @ 2013-12-26 0:21 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51358
--- Comment #11 from Frank Ch. Eigler <fche at redhat dot com> ---
This problem continues to hit in gcc 4.8.2.
^ permalink raw reply [flat|nested] 12+ messages in thread