public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug breakpoints/27394] New: Breakpoint set on vector code but not serial code within a lexical scope
@ 2021-02-11 0:16 i at maskray dot me
2021-02-11 0:19 ` [Bug breakpoints/27394] Breakpoint set on vector code but not on " i at maskray dot me
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: i at maskray dot me @ 2021-02-11 0:16 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=27394
Bug ID: 27394
Summary: Breakpoint set on vector code but not serial code
within a lexical scope
Product: gdb
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: breakpoints
Assignee: unassigned at sourceware dot org
Reporter: i at maskray dot me
Target Milestone: ---
int Foo(const int iterations, const int initial) {
static int val = initial;
for (int i = 0; i <= iterations; ++i)
val += (i % 2 ? 50 : 25) * i; // If you set a breakpoint on this line, it
will not get hit
return val;
}
int main(int argc, char**) {
return Foo(4 + argc, 5 + argc);
}
clang++ -g -fno-inline -O2 a.cc
# g++ -g -fno-inline -O3 a.cc is similar. clang enables vectorization with -O2
gdb ./a.out -batch -ex 'b 5' -ex 'r'
The breakpoint is not triggered. (lldb has the same problem.)
The problem is that we have a vector code path (smaller address) and a serial
code path (larger address) under the same lexical scope.
The serial code path does not get a breakpoint.
gdb/linespec.c:2173 has such a comment
/* For optimized code, the compiler can scatter one source line
across disjoint ranges of PC values, even when no duplicate
functions or inline functions are involved. For example,
'for (;;)' inside a non-template, non-inline, and non-ctor-or-dtor
function can result in two PC ranges. In this case, we don't
want to set a breakpoint on the first PC of each range. To filter
such cases, we use containing blocks -- for each PC found
above, we see if there are other PCs that are in the same
block. If yes, the other PCs are filtered out. */
intermediate_results.size() is 4, matching the output of
% llvm-dwarfdump -debug-line ./a.out | grep ' 5 .*is_stmt'
# loop preheader for the vector code path
0x00000000004011e9 5 13 1 0 0 is_stmt
0x00000000004012ba 5 13 1 0 0 is_stmt
# loop preheader for the serial code path
0x0000000000401360 5 13 1 0 0 is_stmt
0x0000000000401377 5 9 1 0 0 is_stmt
blocks[*] values are the same, presumably because after considering
DW_TAG_inlined_subroutine/DW_TAG_lexical_block (what else?),
the four addresses are in the same scope.
After deduplication, only the first address gets a breakpoint.
--
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 breakpoints/27394] Breakpoint set on vector code but not on serial code within a lexical scope
2021-02-11 0:16 [Bug breakpoints/27394] New: Breakpoint set on vector code but not serial code within a lexical scope i at maskray dot me
@ 2021-02-11 0:19 ` i at maskray dot me
2021-02-12 1:20 ` ctice42 at gmail dot com
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: i at maskray dot me @ 2021-02-11 0:19 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=27394
Fangrui Song <i at maskray dot me> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|Breakpoint set on vector |Breakpoint set on vector
|code but not serial code |code but not on serial code
|within a lexical scope |within a lexical scope
--
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 breakpoints/27394] Breakpoint set on vector code but not on serial code within a lexical scope
2021-02-11 0:16 [Bug breakpoints/27394] New: Breakpoint set on vector code but not serial code within a lexical scope i at maskray dot me
2021-02-11 0:19 ` [Bug breakpoints/27394] Breakpoint set on vector code but not on " i at maskray dot me
@ 2021-02-12 1:20 ` ctice42 at gmail dot com
2021-02-19 0:00 ` dblaikie at gmail dot com
2024-01-09 17:24 ` ssbssa at sourceware dot org
3 siblings, 0 replies; 5+ messages in thread
From: ctice42 at gmail dot com @ 2021-02-12 1:20 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=27394
ctice42 at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ctice42 at gmail dot com
--
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 breakpoints/27394] Breakpoint set on vector code but not on serial code within a lexical scope
2021-02-11 0:16 [Bug breakpoints/27394] New: Breakpoint set on vector code but not serial code within a lexical scope i at maskray dot me
2021-02-11 0:19 ` [Bug breakpoints/27394] Breakpoint set on vector code but not on " i at maskray dot me
2021-02-12 1:20 ` ctice42 at gmail dot com
@ 2021-02-19 0:00 ` dblaikie at gmail dot com
2024-01-09 17:24 ` ssbssa at sourceware dot org
3 siblings, 0 replies; 5+ messages in thread
From: dblaikie at gmail dot com @ 2021-02-19 0:00 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=27394
David Blaikie <dblaikie at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dblaikie at gmail dot com
--
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 breakpoints/27394] Breakpoint set on vector code but not on serial code within a lexical scope
2021-02-11 0:16 [Bug breakpoints/27394] New: Breakpoint set on vector code but not serial code within a lexical scope i at maskray dot me
` (2 preceding siblings ...)
2021-02-19 0:00 ` dblaikie at gmail dot com
@ 2024-01-09 17:24 ` ssbssa at sourceware dot org
3 siblings, 0 replies; 5+ messages in thread
From: ssbssa at sourceware dot org @ 2024-01-09 17:24 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=27394
Hannes Domani <ssbssa at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ssbssa at sourceware dot org
--- Comment #1 from Hannes Domani <ssbssa at sourceware dot org> ---
I think this is a duplicate of PR24032, but I'm not completely sure.
--
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:[~2024-01-09 17:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-11 0:16 [Bug breakpoints/27394] New: Breakpoint set on vector code but not serial code within a lexical scope i at maskray dot me
2021-02-11 0:19 ` [Bug breakpoints/27394] Breakpoint set on vector code but not on " i at maskray dot me
2021-02-12 1:20 ` ctice42 at gmail dot com
2021-02-19 0:00 ` dblaikie at gmail dot com
2024-01-09 17:24 ` ssbssa at sourceware dot org
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).