Bug 19840 - gdb crashes on reverse-stepi
Summary: gdb crashes on reverse-stepi
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: remote (show other bugs)
Version: 7.4
: P2 normal
Target Milestone: 7.11.1
Assignee: Pedro Alves
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-17 22:20 UTC by Andi Kleen
Modified: 2016-04-13 13:38 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andi Kleen 2016-03-17 22:20:24 UTC
I'm using gdb to do reverse debugging simics the simics gdbstub.

Always see

(gdb) target remote localhost:...
(gdb) reverse-stepi
../../gdb/target.c:602: internal-error: default_execution_direction: to_execution_direction must be implemented for reverse async


The problem happens in the FC23 gdb 7.10 and current gdb master.

It does not happen with much older versions of gdb, like a gdb 7.7.1 from an older fedora release, so it appears to be an regression.
Comment 1 Pedro Alves 2016-03-23 10:38:06 UTC
Could you try the users/palves/PR19840-remote-reverse-stepi branch?
Comment 2 Andi Kleen 2016-03-23 15:02:27 UTC
Your branch fixes the problem. Thanks. Can step forwards and backwards now.
Comment 3 Pedro Alves 2016-03-30 12:06:28 UTC
Now posted:
 https://sourceware.org/ml/gdb-patches/2016-03/msg00558.html
Comment 4 cvs-commit@gcc.gnu.org 2016-04-13 13:35:05 UTC
The master branch has been updated by Pedro Alves <palves@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3a00c80277a54abe0b286a6e8babc8fe50120205

commit 3a00c80277a54abe0b286a6e8babc8fe50120205
Author: Pedro Alves <palves@redhat.com>
Date:   Wed Apr 13 14:34:00 2016 +0100

    Fix PR remote/19840: gdb crashes on reverse-stepi
    
    Reverse debugging against a remote target that does reverse debugging
    itself (with the bs/bc packets) always trips on:
    
     (gdb) target remote localhost:...
     (gdb) reverse-stepi
     ../../gdb/target.c:602: internal-error: default_execution_direction: to_execution_direction must be implemented for reverse async
    
    I missed adding a to_execution_direction method to remote.c in commit
    3223143295b5 (Adds target_execution_direction to make record targets
    support async mode), GDB 7.4 time.  Later, GDB 7.8 switched to
    target-async on by default, making the regression user-visible by
    default too.
    
    Fix is simply to add the missing to_execution_direction implementation
    to target remote.
    
    Tested by Andi Kleen against Simics.
    
    gdb/ChangeLog:
    2016-04-13  Pedro Alves  <palves@redhat.com>
    
    	PR remote/19840
    	* remote.c (struct remote_state) <last_resume_exec_dir>: New
    	field.
    	(new_remote_state): Default last_resume_exec_dir to EXEC_FORWARD.
    	(remote_open_1): Reset last_resume_exec_dir to EXEC_FORWARD.
    	(remote_resume): Store the last execution direction.
    	(remote_execution_direction): New function.
    	(init_remote_ops): Install it as to_execution_direction target_ops
    	method.
Comment 5 cvs-commit@gcc.gnu.org 2016-04-13 13:37:35 UTC
The gdb-7.11-branch branch has been updated by Pedro Alves <palves@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6b9ef0d488c556339aea7b095ef7a9b6bf6b1af1

commit 6b9ef0d488c556339aea7b095ef7a9b6bf6b1af1
Author: Pedro Alves <palves@redhat.com>
Date:   Wed Apr 13 14:34:00 2016 +0100

    Fix PR remote/19840: gdb crashes on reverse-stepi
    
    Reverse debugging against a remote target that does reverse debugging
    itself (with the bs/bc packets) always trips on:
    
     (gdb) target remote localhost:...
     (gdb) reverse-stepi
     ../../gdb/target.c:602: internal-error: default_execution_direction: to_execution_direction must be implemented for reverse async
    
    I missed adding a to_execution_direction method to remote.c in commit
    3223143295b5 (Adds target_execution_direction to make record targets
    support async mode), GDB 7.4 time.  Later, GDB 7.8 switched to
    target-async on by default, making the regression user-visible by
    default too.
    
    Fix is simply to add the missing to_execution_direction implementation
    to target remote.
    
    Tested by Andi Kleen against Simics.
    
    gdb/ChangeLog:
    2016-04-13  Pedro Alves  <palves@redhat.com>
    
    	PR remote/19840
    	* remote.c (struct remote_state) <last_resume_exec_dir>: New
    	field.
    	(new_remote_state): Default last_resume_exec_dir to EXEC_FORWARD.
    	(remote_open_1): Reset last_resume_exec_dir to EXEC_FORWARD.
    	(remote_resume): Store the last execution direction.
    	(remote_execution_direction): New function.
    	(init_remote_ops): Install it as to_execution_direction target_ops
    	method.
Comment 6 Pedro Alves 2016-04-13 13:38:49 UTC
Fixed, master and 7.11 branch.