
This is a preparatory patch to reduce the size of the diff of the upcoming main patch. It introduces enum types for the return values of displaced step "prepare" and "finish" operations. I find that this expresses better the intention of the code, rather than returning arbitrary integer values (-1, 0 and 1) which are difficult to remember. That makes the code easier to read. I put the new enum types in a new displaced-stepping.h file, because I introduce that file in a later patch anyway. Putting it there avoids having to move it later. There is one change in behavior for displaced_step_finish: it currently returns 0 if the thread wasn't doing a displaced step and 1 if the thread was doing a displaced step which was executed successfully. It turns out that this distinction is not needed by any caller, so I've merged these two cases into "_OK", rather than adding an extra enumerator. gdb/ChangeLog: * infrun.c (displaced_step_prepare_throw): Change return type to displaced_step_prepare_status. (displaced_step_prepare): Likewise. (displaced_step_finish): Change return type to displaced_step_finish_status. (resume_1): Adjust. (stop_all_threads): Adjust. * displaced-stepping.h: New file. Change-Id: I5c8fe07212cd398d5b486b5936d9d0807acd3788
47 lines
1.6 KiB
C
47 lines
1.6 KiB
C
/* Displaced stepping related things.
|
|
|
|
Copyright (C) 2020 Free Software Foundation, Inc.
|
|
|
|
This file is part of GDB.
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
|
#ifndef DISPLACED_STEPPING_H
|
|
#define DISPLACED_STEPPING_H
|
|
|
|
enum displaced_step_prepare_status
|
|
{
|
|
/* A displaced stepping buffer was successfully allocated and prepared. */
|
|
DISPLACED_STEP_PREPARE_STATUS_OK,
|
|
|
|
/* This particular instruction can't be displaced stepped, GDB should fall
|
|
back on in-line stepping. */
|
|
DISPLACED_STEP_PREPARE_STATUS_CANT,
|
|
|
|
/* Not enough resources are available at this time, try again later. */
|
|
DISPLACED_STEP_PREPARE_STATUS_UNAVAILABLE,
|
|
};
|
|
|
|
enum displaced_step_finish_status
|
|
{
|
|
/* Either the instruction was stepped and fixed up, or the specified thread
|
|
wasn't executing a displaced step (in which case there's nothing to
|
|
finish). */
|
|
DISPLACED_STEP_FINISH_STATUS_OK,
|
|
|
|
/* The thread started a displaced step, but didn't complete it. */
|
|
DISPLACED_STEP_FINISH_STATUS_NOT_EXECUTED,
|
|
};
|
|
|
|
#endif /* DISPLACED_STEPPING_H */
|