aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2022-09-12 07:04:21 -0600
committerTom Tromey <tromey@adacore.com>2022-10-31 09:04:11 -0600
commit7807dfae36d5c0435ac58711a5028f217800db60 (patch)
tree2a6ab1d179d22f1a31afadddec893750e453418f
parent6c8912c64bcbfd109af0500577409690074e9d27 (diff)
downloadgdb-7807dfae36d5c0435ac58711a5028f217800db60.zip
gdb-7807dfae36d5c0435ac58711a5028f217800db60.tar.gz
gdb-7807dfae36d5c0435ac58711a5028f217800db60.tar.bz2
Use enum for gdbarch's call_dummy_location
This changes gdbarch to use an enum for call_dummy_location, providing a little more type safety.
-rw-r--r--gdb/gdbarch-components.py2
-rw-r--r--gdb/gdbarch-gen.h4
-rw-r--r--gdb/gdbarch.c6
-rw-r--r--gdb/gdbarch.h7
-rw-r--r--gdb/inferior.h3
5 files changed, 13 insertions, 9 deletions
diff --git a/gdb/gdbarch-components.py b/gdb/gdbarch-components.py
index c997a70..b2c7b78 100644
--- a/gdb/gdbarch-components.py
+++ b/gdb/gdbarch-components.py
@@ -647,7 +647,7 @@ Method(
)
Value(
- type="int",
+ type="enum call_dummy_location_type",
name="call_dummy_location",
predefault="AT_ENTRY_POINT",
invalid=False,
diff --git a/gdb/gdbarch-gen.h b/gdb/gdbarch-gen.h
index 840de58..e0d7a08 100644
--- a/gdb/gdbarch-gen.h
+++ b/gdb/gdbarch-gen.h
@@ -331,8 +331,8 @@ typedef CORE_ADDR (gdbarch_push_dummy_call_ftype) (struct gdbarch *gdbarch, stru
extern CORE_ADDR gdbarch_push_dummy_call (struct gdbarch *gdbarch, struct value *function, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp, function_call_return_method return_method, CORE_ADDR struct_addr);
extern void set_gdbarch_push_dummy_call (struct gdbarch *gdbarch, gdbarch_push_dummy_call_ftype *push_dummy_call);
-extern int gdbarch_call_dummy_location (struct gdbarch *gdbarch);
-extern void set_gdbarch_call_dummy_location (struct gdbarch *gdbarch, int call_dummy_location);
+extern enum call_dummy_location_type gdbarch_call_dummy_location (struct gdbarch *gdbarch);
+extern void set_gdbarch_call_dummy_location (struct gdbarch *gdbarch, enum call_dummy_location_type call_dummy_location);
extern bool gdbarch_push_dummy_code_p (struct gdbarch *gdbarch);
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 6ff4fee..9d929da 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -97,7 +97,7 @@ struct gdbarch
gdbarch_dummy_id_ftype *dummy_id = default_dummy_id;
int deprecated_fp_regnum = -1;
gdbarch_push_dummy_call_ftype *push_dummy_call = nullptr;
- int call_dummy_location = AT_ENTRY_POINT;
+ enum call_dummy_location_type call_dummy_location = AT_ENTRY_POINT;
gdbarch_push_dummy_code_ftype *push_dummy_code = nullptr;
gdbarch_code_of_frame_writable_ftype *code_of_frame_writable = default_code_of_frame_writable;
gdbarch_print_registers_info_ftype *print_registers_info = default_print_registers_info;
@@ -2229,7 +2229,7 @@ set_gdbarch_push_dummy_call (struct gdbarch *gdbarch,
gdbarch->push_dummy_call = push_dummy_call;
}
-int
+enum call_dummy_location_type
gdbarch_call_dummy_location (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
@@ -2241,7 +2241,7 @@ gdbarch_call_dummy_location (struct gdbarch *gdbarch)
void
set_gdbarch_call_dummy_location (struct gdbarch *gdbarch,
- int call_dummy_location)
+ enum call_dummy_location_type call_dummy_location)
{
gdbarch->call_dummy_location = call_dummy_location;
}
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 2f1c739..f2ba5f9 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -149,6 +149,13 @@ using read_core_file_mappings_loop_ftype =
const char *filename,
const bfd_build_id *build_id)>;
+/* Possible values for gdbarch_call_dummy_location. */
+enum call_dummy_location_type
+{
+ ON_STACK,
+ AT_ENTRY_POINT,
+};
+
#include "gdbarch-gen.h"
/* An internal function that should _only_ be called from gdbarch_tdep.
diff --git a/gdb/inferior.h b/gdb/inferior.h
index 8877be3..69525a2 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -282,9 +282,6 @@ enum stop_kind
};
-/* Possible values for gdbarch_call_dummy_location. */
-#define ON_STACK 1
-#define AT_ENTRY_POINT 4
/* Base class for target-specific inferior data. */