public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/16774] New: AVR: Backtraces fail when r1 is used to subtract from the frame pointer
@ 2014-03-29 5:58 justin at jgottula dot com
2014-03-29 5:58 ` [Bug gdb/16774] " justin at jgottula dot com
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: justin at jgottula dot com @ 2014-03-29 5:58 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=16774
Bug ID: 16774
Summary: AVR: Backtraces fail when r1 is used to subtract from
the frame pointer
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: gdb
Assignee: unassigned at sourceware dot org
Reporter: justin at jgottula dot com
The function avr_scan_prologue in gdb/avr-tdep.c provides for two ways that a
function prologue might allocate space for locals. The documentation for the
function says:
Some devices lack the sbiw instruction, so on those replace this:
sbiw r28, XX
with this:
subi r28,lo8(XX)
sbci r29,hi8(XX)
and:
Scan for:
sbiw r28,XX or subi r28,lo8(XX)
sbci r29,hi8(XX)
However, I have come across a third case that avr-gcc will sometimes generate:
00001980 <assert_fail.1469>:
1980: cf 93 push r28
1982: df 93 push r29
1984: cd b7 in r28, 0x3d ; 61
1986: de b7 in r29, 0x3e ; 62
1988: c0 5c subi r28, 0xC0 ; 192
198a: d1 09 sbc r29, r1
198c: cd bf out 0x3d, r28 ; 61
198e: de bf out 0x3e, r29 ; 62
Here, r1 (the zero register) is used in the second half of the subtraction
instead of doing, say, 'sbci r29,0'.
Unfortunately, when avr_scan_prologue sees the subi instruction in scan_stage
2, it assumes that the next instruction will be sbci and extracts bits to
determine how much was subtracted.
This will obviously not work correctly if the second instruction is not sbci
(in this particular case, I believe it will extract 0xfe as the supposed
immediate value; clearly, wrong). This breaks backtraces.
The code needs an extra case to check for 'sbc r29, r1' and act accordingly.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug gdb/16774] AVR: Backtraces fail when r1 is used to subtract from the frame pointer
2014-03-29 5:58 [Bug gdb/16774] New: AVR: Backtraces fail when r1 is used to subtract from the frame pointer justin at jgottula dot com
@ 2014-03-29 5:58 ` justin at jgottula dot com
2014-03-29 6:32 ` [Bug breakpoints/16774] " justin at jgottula dot com
2014-03-29 6:33 ` [Bug backtrace/16774] " justin at jgottula dot com
2 siblings, 0 replies; 4+ messages in thread
From: justin at jgottula dot com @ 2014-03-29 5:58 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=16774
Justin Gottula <justin at jgottula dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |justin at jgottula dot com
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug breakpoints/16774] AVR: Backtraces fail when r1 is used to subtract from the frame pointer
2014-03-29 5:58 [Bug gdb/16774] New: AVR: Backtraces fail when r1 is used to subtract from the frame pointer justin at jgottula dot com
2014-03-29 5:58 ` [Bug gdb/16774] " justin at jgottula dot com
@ 2014-03-29 6:32 ` justin at jgottula dot com
2014-03-29 6:33 ` [Bug backtrace/16774] " justin at jgottula dot com
2 siblings, 0 replies; 4+ messages in thread
From: justin at jgottula dot com @ 2014-03-29 6:32 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=16774
Justin Gottula <justin at jgottula dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|gdb |breakpoints
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug backtrace/16774] AVR: Backtraces fail when r1 is used to subtract from the frame pointer
2014-03-29 5:58 [Bug gdb/16774] New: AVR: Backtraces fail when r1 is used to subtract from the frame pointer justin at jgottula dot com
2014-03-29 5:58 ` [Bug gdb/16774] " justin at jgottula dot com
2014-03-29 6:32 ` [Bug breakpoints/16774] " justin at jgottula dot com
@ 2014-03-29 6:33 ` justin at jgottula dot com
2 siblings, 0 replies; 4+ messages in thread
From: justin at jgottula dot com @ 2014-03-29 6:33 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=16774
Justin Gottula <justin at jgottula dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|breakpoints |backtrace
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-03-29 6:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-29 5:58 [Bug gdb/16774] New: AVR: Backtraces fail when r1 is used to subtract from the frame pointer justin at jgottula dot com
2014-03-29 5:58 ` [Bug gdb/16774] " justin at jgottula dot com
2014-03-29 6:32 ` [Bug breakpoints/16774] " justin at jgottula dot com
2014-03-29 6:33 ` [Bug backtrace/16774] " justin at jgottula 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).