gdb: introduce status enum for displaced step prepare/finish
authorSimon Marchi <simon.marchi@efficios.com>
Fri, 4 Dec 2020 21:43:54 +0000 (16:43 -0500)
committerSimon Marchi <simon.marchi@efficios.com>
Fri, 4 Dec 2020 21:43:54 +0000 (16:43 -0500)
commitbab37966cfd192a12d5d1d259c7009a02cefe8b3
treecd931b82c874bb51a037e25c5a887282f34fff4f
parent7def77a1cf6bfd9d3640701dc3414feb0034a858
gdb: introduce status enum for displaced step prepare/finish

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
gdb/ChangeLog
gdb/displaced-stepping.h [new file with mode: 0644]
gdb/infrun.c
This page took 0.025032 seconds and 4 git commands to generate.