RE: GDB MI Reverse Commands added [1 of 3]

Jakob Engblom
2010-01-13T20:32:14Z

[-- Attachment #1: Type: text/plain, Size: 740 bytes --]

Here is an updated patch for the MI reverse commands, against the latest gdb 7 from cvs.

It removes the buggy whitespace changes, and also removes the small duplication of code with reverse.c (it was really only the setting of the default direction of execution that was duplicated).

In my build, this version passes all the mi-reverse.exp tests.

Best regards,

/jakob

_______________________________________________________

Jakob Engblom, PhD, Technical Marketing Manager

Virtutech Direct: +46 8 690 07 47
Drottningholmsvägen 22 Mobile: +46 709 242 646
11243 Stockholm Web: www.virtutech.com
Sweden
________________________________________________________

[-- Attachment #2: gdb-mi-reverse-gdb7.diff --]
[-- Type: application/octet-stream, Size: 5636 bytes --]

Index: gdb/mi/mi-main.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-main.c,v
retrieving revision 1.163
diff -c -p -r1.163 mi-main.c
*** gdb/mi/mi-main.c 12 Jan 2010 23:05:52 -0000 1.163
--- gdb/mi/mi-main.c 13 Jan 2010 20:16:03 -0000
*************** void
*** 121,155 ****
mi_cmd_exec_next (char *command, char **argv, int argc)
{
/* FIXME: Should call a libgdb function, not a cli wrapper. */
! mi_execute_async_cli_command ("next", argv, argc);
}

void
mi_cmd_exec_next_instruction (char *command, char **argv, int argc)
{
/* FIXME: Should call a libgdb function, not a cli wrapper. */
! mi_execute_async_cli_command ("nexti", argv, argc);
}

void
mi_cmd_exec_step (char *command, char **argv, int argc)
{
/* FIXME: Should call a libgdb function, not a cli wrapper. */
! mi_execute_async_cli_command ("step", argv, argc);
}

void
mi_cmd_exec_step_instruction (char *command, char **argv, int argc)
{
/* FIXME: Should call a libgdb function, not a cli wrapper. */
! mi_execute_async_cli_command ("stepi", argv, argc);
}

void
mi_cmd_exec_finish (char *command, char **argv, int argc)
{
/* FIXME: Should call a libgdb function, not a cli wrapper. */
! mi_execute_async_cli_command ("finish", argv, argc);
}

void
--- 121,170 ----
mi_cmd_exec_next (char *command, char **argv, int argc)
{
/* FIXME: Should call a libgdb function, not a cli wrapper. */
! if (argc > 0 && strcmp(argv[0], "--reverse") == 0)
! mi_execute_async_cli_command ("reverse-next", argv + 1, argc - 1);
! else
! mi_execute_async_cli_command ("next", argv, argc);
}

void
mi_cmd_exec_next_instruction (char *command, char **argv, int argc)
{
/* FIXME: Should call a libgdb function, not a cli wrapper. */
! if (argc > 0 && strcmp(argv[0], "--reverse") == 0)
! mi_execute_async_cli_command ("reverse-nexti", argv + 1, argc - 1);
! else
! mi_execute_async_cli_command ("nexti", argv, argc);
}

void
mi_cmd_exec_step (char *command, char **argv, int argc)
{
/* FIXME: Should call a libgdb function, not a cli wrapper. */
! if (argc > 0 && strcmp(argv[0], "--reverse") == 0)
! mi_execute_async_cli_command ("reverse-step", argv + 1, argc - 1);
! else
! mi_execute_async_cli_command ("step", argv, argc);
}

void
mi_cmd_exec_step_instruction (char *command, char **argv, int argc)
{
/* FIXME: Should call a libgdb function, not a cli wrapper. */
! if (argc > 0 && strcmp(argv[0], "--reverse") == 0)
! mi_execute_async_cli_command ("reverse-stepi", argv + 1, argc - 1);
! else
! mi_execute_async_cli_command ("stepi", argv, argc);
}

void
mi_cmd_exec_finish (char *command, char **argv, int argc)
{
/* FIXME: Should call a libgdb function, not a cli wrapper. */
! if (argc > 0 && strcmp(argv[0], "--reverse") == 0)
! mi_execute_async_cli_command ("reverse-finish", argv + 1, argc - 1);
! else
! mi_execute_async_cli_command ("finish", argv, argc);
}

void
*************** proceed_thread_callback (struct thread_i
*** 195,202 ****
return 0;
}

! void
! mi_cmd_exec_continue (char *command, char **argv, int argc)
{
if (argc == 0)
continue_1 (0);
--- 210,217 ----
return 0;
}

! static void
! exec_continue (char **argv, int argc)
{
if (argc == 0)
continue_1 (0);
*************** mi_cmd_exec_continue (char *command, cha
*** 217,223 ****
do_cleanups (old_chain);
}
else
! error ("Usage: -exec-continue [--all|--thread-group id]");
}

static int
--- 232,271 ----
do_cleanups (old_chain);
}
else
! error ("Usage: -exec-continue [--reverse] [--all|--thread-group id]");
! }
!
! /* Function found in gdb/reverse.c */
! void exec_direction_default(void *);
!
! static void
! exec_reverse_continue (char **argv, int argc)
! {
! enum exec_direction_kind dir = execution_direction;
! struct cleanup *old_chain;
!
! if (dir == EXEC_ERROR)
! error (_("Target %s does not support this command."), target_shortname);
!
! if (dir == EXEC_REVERSE)
! error (_("Already in reverse mode."));
!
! if (!target_can_execute_reverse)
! error (_("Target %s does not support this command."), target_shortname);
!
! old_chain = make_cleanup (exec_direction_default, NULL);
! execution_direction = EXEC_REVERSE;
! exec_continue (argv, argc);
! do_cleanups (old_chain);
! }
!
! void
! mi_cmd_exec_continue (char *command, char **argv, int argc)
! {
! if (argc > 0 && strcmp(argv[0], "--reverse") == 0)
! exec_reverse_continue (argv + 1, argc - 1);
! else
! exec_continue (argv, argc);
}

static int
Index: gdb/reverse.c
===================================================================
RCS file: /cvs/src/src/gdb/reverse.c,v
retrieving revision 1.8
diff -c -p -r1.8 reverse.c
*** gdb/reverse.c 1 Jan 2010 07:31:41 -0000 1.8
--- gdb/reverse.c 13 Jan 2010 20:16:04 -0000
***************
*** 29,35 ****
/* User interface:
reverse-step, reverse-next etc. */

! static void
exec_direction_default (void *notused)
{
/* Return execution direction to default state. */
--- 29,35 ----
/* User interface:
reverse-step, reverse-next etc. */

! void
exec_direction_default (void *notused)
{
/* Return execution direction to default state. */