rr-debugger / rr-debugger/rr

reverse-stepi stepping more than one instruction

Open
#2,015 16 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
10.7k
Forks
662
Avg merge
2d 3h
Merged PRs (30d)
2

Description

If I run reverse-stepi after running to a certain event with rr replay -g, then I've got a situation where reverse-stepi steps more than one instruction:

(rr) disas
Dump of assembler code for function core::slice::from_raw_parts<u8>:
   0x000056197ad5aab0 <+0>:	push   %rbp
   0x000056197ad5aab1 <+1>:	mov    %rsp,%rbp
   0x000056197ad5aab4 <+4>:	mov    %rdi,-0x40(%rbp)
   0x000056197ad5aab8 <+8>:	mov    %rsi,-0x38(%rbp)
   0x000056197ad5aabc <+12>:	mov    -0x40(%rbp),%rax
   0x000056197ad5aac0 <+16>:	mov    %rax,-0x30(%rbp)
   0x000056197ad5aac4 <+20>:	mov    -0x38(%rbp),%rax
   0x000056197ad5aac8 <+24>:	mov    %rax,-0x28(%rbp)
   0x000056197ad5aacc <+28>:	mov    -0x30(%rbp),%rax
   0x000056197ad5aad0 <+32>:	mov    -0x28(%rbp),%rcx
   0x000056197ad5aad4 <+36>:	mov    %rax,-0x20(%rbp)
   0x000056197ad5aad8 <+40>:	mov    %rcx,-0x18(%rbp)
   0x000056197ad5aadc <+44>:	mov    -0x20(%rbp),%rax
=> 0x000056197ad5aae0 <+48>:	mov    -0x18(%rbp),%rcx
   0x000056197ad5aae4 <+52>:	mov    %rax,-0x10(%rbp)
   0x000056197ad5aae8 <+56>:	mov    %rcx,-0x8(%rbp)
   0x000056197ad5aaec <+60>:	mov    -0x10(%rbp),%rax
   0x000056197ad5aaf0 <+64>:	mov    -0x8(%rbp),%rdx
   0x000056197ad5aaf4 <+68>:	mov    %rax,-0x48(%rbp)
   0x000056197ad5aaf8 <+72>:	mov    %rdx,-0x50(%rbp)
   0x000056197ad5aafc <+76>:	mov    -0x48(%rbp),%rax
   0x000056197ad5ab00 <+80>:	mov    -0x50(%rbp),%rdx
   0x000056197ad5ab04 <+84>:	pop    %rbp
   0x000056197ad5ab05 <+85>:	retq   
End of assembler dump.
(rr) reverse-stepi

Thread 1 received signal SIGINT, Interrupt.
core::slice::{{impl}}::index<u8> (self=..., slice=...) at /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libcore/slice.rs:708
708	in /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libcore/slice.rs
(rr) disas
Dump of assembler code for function core::slice::{{impl}}::index<u8>:
   0x000056197ad5b040 <+0>:	push   %rbp
   0x000056197ad5b041 <+1>:	mov    %rsp,%rbp
   0x000056197ad5b044 <+4>:	sub    $0x90,%rsp
   0x000056197ad5b04b <+11>:	mov    (%rdi),%rax
   0x000056197ad5b04e <+14>:	mov    %rax,-0x58(%rbp)
   0x000056197ad5b052 <+18>:	mov    0x8(%rdi),%rax
   0x000056197ad5b056 <+22>:	mov    %rax,-0x50(%rbp)
   0x000056197ad5b05a <+26>:	mov    %rsi,-0x48(%rbp)
   0x000056197ad5b05e <+30>:	mov    %rdx,-0x40(%rbp)
   0x000056197ad5b062 <+34>:	mov    -0x58(%rbp),%rax
   0x000056197ad5b066 <+38>:	mov    -0x50(%rbp),%rcx
   0x000056197ad5b06a <+42>:	mov    %rax,-0x38(%rbp)
   0x000056197ad5b06e <+46>:	mov    %rcx,-0x30(%rbp)
   0x000056197ad5b072 <+50>:	mov    -0x48(%rbp),%rax
   0x000056197ad5b076 <+54>:	mov    -0x40(%rbp),%rcx
   0x000056197ad5b07a <+58>:	mov    %rax,-0x28(%rbp)
   0x000056197ad5b07e <+62>:	mov    %rcx,-0x20(%rbp)
   0x000056197ad5b082 <+66>:	mov    -0x38(%rbp),%rax
   0x000056197ad5b086 <+70>:	cmp    -0x30(%rbp),%rax
   0x000056197ad5b08a <+74>:	jbe    0x56197ad5b099 <core::slice::{{impl}}::index<u8>+89>
   0x000056197ad5b08c <+76>:	mov    -0x38(%rbp),%rdi
   0x000056197ad5b090 <+80>:	mov    -0x30(%rbp),%rsi
   0x000056197ad5b094 <+84>:	callq  0x56197af5c380 <core::slice::slice_index_order_fail>
=> 0x000056197ad5b099 <+89>:	mov    -0x30(%rbp),%rax
   0x000056197ad5b09d <+93>:	mov    -0x28(%rbp),%rdi
   0x000056197ad5b0a1 <+97>:	mov    -0x20(%rbp),%rsi
   0x000056197ad5b0a5 <+101>:	mov    %rax,-0x60(%rbp)
---Type <return> to continue, or q <return> to quit---q
Quit
(rr) stepi

Thread 1 received signal SIGINT, Interrupt.
0x000056197ad5aae0 in core::slice::from_raw_parts<u8> (p=0x56197af69140 <str.V> "raw_capacity overflowraw_cap overflow\000", len=0) at /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libcore/slice.rs:2161
2161	in /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libcore/slice.rs
(rr) 

Thread 1 received signal SIGKILL, Killed.
0x000056197ad5aae0 in core::slice::from_raw_parts<u8> (p=0x56197af69140 <str.V> "raw_capacity overflowraw_cap overflow\000", len=0) at /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libcore/slice.rs:2161
2161	in /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libcore/slice.rs
(rr) 
[Inferior 1 (process 26877) exited normally]
(rr) 

If you need more information, please tell me what is necessary.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported sequence: run rr replay -g, use reverse-stepi, and compare the disassembly before and after stepping. Determine why the command moves from core::slice::from_raw_parts<u8> to core::slice::{{impl}}::index<u8> instead of one instruction; done means reverse-stepi reliably advances to the immediately preceding instruction.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.