Bug 18840 - interp_exec doesn't use a cleanup
Summary: interp_exec doesn't use a cleanup
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: gdb (show other bugs)
Version: unknown
: P2 normal
Target Milestone: 8.3
Assignee: Not yet assigned to anyone
URL:
Keywords: good-first-bug
Depends on:
Blocks:
 
Reported: 2015-08-17 19:15 UTC by dje
Modified: 2019-07-09 13:59 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 dje 2015-08-17 19:15:38 UTC
Filing this so I don't forget it.

interp_exec has this:

struct gdb_exception
interp_exec (struct interp *interp, const char *command_str)
{
  struct gdb_exception ex;
  struct interp *save_command_interp;

  gdb_assert (interp->procs->exec_proc != NULL);

  /* See `command_interp' for why we do this.  */
  save_command_interp = command_interpreter;
  command_interpreter = interp;

  ex = interp->procs->exec_proc (interp->data, command_str);

  command_interpreter = save_command_interp;

  return ex;
}

so it's assuming interp->procs->exec_proc won't throw an exception.
But MI's version calls bpstat_do_actions outside of any TRY/CATCH.
I don't see any guarantees that bpstat_do_actions won't throw an exception.
See mi_execute_command.
Comment 1 Tom Tromey 2019-07-09 13:59:12 UTC
This is fixed now:

  scoped_restore save_command_interp
    = make_scoped_restore (&ui_interp->command_interpreter, interp);