public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Add more flexibility to inferior call
@ 2023-03-22 17:13 Mohamed Bouhaouel
  2023-03-22 17:13 ` [PATCH 1/2] gdb, gdbarch, infcall: Add value_arg_coerce method to gdbarch Mohamed Bouhaouel
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Mohamed Bouhaouel @ 2023-03-22 17:13 UTC (permalink / raw)
  To: gdb-patches

Hi all,

The following two patches would add more flexibility to the infcalls
workflow by allowing targets to have their own implementations of:
	* value_arg_coerce: Enable the target to control arguments
	coercion whenever needed (e.g.  Coerce BOOL to UINT16_T
	instead of UINT32_T).
	* reserve_stack_space: Enable the target to decide how much
	space is needed for a type (e.g.  Targets might have a vectorized
	representation of variables).

Regards,
Mohamed

Mohamed Bouhaouel (2):
  gdb, gdbarch, infcall: Add value_arg_coerce method to gdbarch.
  gdb, gdbarch, infcall:  Add reserve_stack_space method to gdbarch

 gdb/gdbarch-gen.h         | 13 ++++++++++++
 gdb/gdbarch.c             | 44 +++++++++++++++++++++++++++++++++++++++
 gdb/gdbarch.h             |  1 +
 gdb/gdbarch_components.py | 26 +++++++++++++++++++++++
 gdb/infcall.c             | 32 +++++++++++-----------------
 gdb/infcall.h             | 17 +++++++++++++++
 6 files changed, 113 insertions(+), 20 deletions(-)

-- 
2.25.1

Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/2] gdb, gdbarch, infcall: Add value_arg_coerce method to gdbarch.
  2023-03-22 17:13 [PATCH 0/2] Add more flexibility to inferior call Mohamed Bouhaouel
@ 2023-03-22 17:13 ` Mohamed Bouhaouel
  2023-03-22 19:18   ` Simon Marchi
  2023-03-22 17:13 ` [PATCH 2/2] gdb, gdbarch, infcall: Add reserve_stack_space " Mohamed Bouhaouel
  2023-03-22 19:16 ` [PATCH 0/2] Add more flexibility to inferior call Simon Marchi
  2 siblings, 1 reply; 9+ messages in thread
From: Mohamed Bouhaouel @ 2023-03-22 17:13 UTC (permalink / raw)
  To: gdb-patches

Change the 'value_arg_coerce' function from a static common method to a
target-dependent method.

Signed-off-by: Mohamed Bouhaouel <mohamed.bouhaouel@intel.com>
---
 gdb/gdbarch-gen.h         |  7 +++++++
 gdb/gdbarch.c             | 22 ++++++++++++++++++++++
 gdb/gdbarch.h             |  1 +
 gdb/gdbarch_components.py | 16 ++++++++++++++++
 gdb/infcall.c             | 16 ++++++----------
 gdb/infcall.h             |  8 ++++++++
 6 files changed, 60 insertions(+), 10 deletions(-)

diff --git a/gdb/gdbarch-gen.h b/gdb/gdbarch-gen.h
index 76d12a15317..a9b0fe26837 100644
--- a/gdb/gdbarch-gen.h
+++ b/gdb/gdbarch-gen.h
@@ -319,6 +319,13 @@ typedef struct frame_id (gdbarch_dummy_id_ftype) (struct gdbarch *gdbarch, frame
 extern struct frame_id gdbarch_dummy_id (struct gdbarch *gdbarch, frame_info_ptr this_frame);
 extern void set_gdbarch_dummy_id (struct gdbarch *gdbarch, gdbarch_dummy_id_ftype *dummy_id);
 
+/* Perform the standard coercions that are specified for arguments to
+   be passed to C, Ada or Fortran functions. */
+
+typedef value * (gdbarch_value_arg_coerce_ftype) (struct gdbarch *gdbarch, value *arg, type *param_type, int is_prototyped);
+extern value * gdbarch_value_arg_coerce (struct gdbarch *gdbarch, value *arg, type *param_type, int is_prototyped);
+extern void set_gdbarch_value_arg_coerce (struct gdbarch *gdbarch, gdbarch_value_arg_coerce_ftype *value_arg_coerce);
+
 /* Implement DUMMY_ID and PUSH_DUMMY_CALL, then delete
    deprecated_fp_regnum. */
 
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index b4763aa6bf4..a411e5bbac7 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -91,6 +91,7 @@ struct gdbarch
   gdbarch_register_name_ftype *register_name = nullptr;
   gdbarch_register_type_ftype *register_type = nullptr;
   gdbarch_dummy_id_ftype *dummy_id = default_dummy_id;
+  gdbarch_value_arg_coerce_ftype *value_arg_coerce = default_value_arg_coerce;
   int deprecated_fp_regnum = -1;
   gdbarch_push_dummy_call_ftype *push_dummy_call = nullptr;
   enum call_dummy_location_type call_dummy_location = AT_ENTRY_POINT;
@@ -346,6 +347,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
   if (gdbarch->register_type == 0)
     log.puts ("\n\tregister_type");
   /* Skip verify of dummy_id, invalid_p == 0 */
+  /* Skip verify of value_arg_coerce, invalid_p == 0 */
   /* Skip verify of deprecated_fp_regnum, invalid_p == 0 */
   /* Skip verify of push_dummy_call, has predicate.  */
   /* Skip verify of call_dummy_location, invalid_p == 0 */
@@ -703,6 +705,9 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
   gdb_printf (file,
 	      "gdbarch_dump: dummy_id = <%s>\n",
 	      host_address_to_string (gdbarch->dummy_id));
+  gdb_printf (file,
+	      "gdbarch_dump: value_arg_coerce = <%s>\n",
+	      host_address_to_string (gdbarch->value_arg_coerce));
   gdb_printf (file,
 	      "gdbarch_dump: deprecated_fp_regnum = %s\n",
 	      plongest (gdbarch->deprecated_fp_regnum));
@@ -2203,6 +2208,23 @@ set_gdbarch_dummy_id (struct gdbarch *gdbarch,
   gdbarch->dummy_id = dummy_id;
 }
 
+value *
+gdbarch_value_arg_coerce (struct gdbarch *gdbarch, value *arg, type *param_type, int is_prototyped)
+{
+  gdb_assert (gdbarch != NULL);
+  gdb_assert (gdbarch->value_arg_coerce != NULL);
+  if (gdbarch_debug >= 2)
+    gdb_printf (gdb_stdlog, "gdbarch_value_arg_coerce called\n");
+  return gdbarch->value_arg_coerce (gdbarch, arg, param_type, is_prototyped);
+}
+
+void
+set_gdbarch_value_arg_coerce (struct gdbarch *gdbarch,
+			      gdbarch_value_arg_coerce_ftype value_arg_coerce)
+{
+  gdbarch->value_arg_coerce = value_arg_coerce;
+}
+
 int
 gdbarch_deprecated_fp_regnum (struct gdbarch *gdbarch)
 {
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index f0399c2fa88..cd0bcd1a6fe 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -25,6 +25,7 @@
 #include "frame.h"
 #include "dis-asm.h"
 #include "gdbsupport/gdb_obstack.h"
+#include "infcall.h"
 #include "infrun.h"
 #include "osabi.h"
 #include "displaced-stepping.h"
diff --git a/gdb/gdbarch_components.py b/gdb/gdbarch_components.py
index 92c501d2a72..10e8c2d52c8 100644
--- a/gdb/gdbarch_components.py
+++ b/gdb/gdbarch_components.py
@@ -606,6 +606,22 @@ frame.
     invalid=False,
 )
 
+Method(
+    comment="""
+Perform the standard coercions that are specified for arguments to
+be passed to C, Ada or Fortran functions.
+""",
+    type="value *",
+    name="value_arg_coerce",
+    params=[
+        ("value *", "arg"),
+        ("type *", "param_type"),
+        ("int", "is_prototyped")
+    ],
+    predefault="default_value_arg_coerce",
+    invalid=False,
+)
+
 Value(
     comment="""
 Implement DUMMY_ID and PUSH_DUMMY_CALL, then delete
diff --git a/gdb/infcall.c b/gdb/infcall.c
index 9ed17bf4f8b..b945adebc93 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -170,15 +170,11 @@ show_unwind_on_terminating_exception_p (struct ui_file *file, int from_tty,
 	      value);
 }
 
-/* Perform the standard coercions that are specified
-   for arguments to be passed to C, Ada or Fortran functions.
-
-   If PARAM_TYPE is non-NULL, it is the expected parameter type.
-   IS_PROTOTYPED is non-zero if the function declaration is prototyped.  */
+/* See infcall.h.  */
 
-static struct value *
-value_arg_coerce (struct gdbarch *gdbarch, struct value *arg,
-		  struct type *param_type, int is_prototyped)
+value *
+default_value_arg_coerce (gdbarch *gdbarch, value *arg,
+			  type *param_type, int is_prototyped)
 {
   const struct builtin_type *builtin = builtin_type (gdbarch);
   struct type *arg_type = check_typedef (arg->type ());
@@ -1099,8 +1095,8 @@ call_function_by_hand_dummy (struct value *function,
 	param_type = NULL;
 
       value *original_arg = args[i];
-      args[i] = value_arg_coerce (gdbarch, args[i],
-				  param_type, prototyped);
+      args[i] = gdbarch_value_arg_coerce (gdbarch, args[i],
+					  param_type, prototyped);
 
       if (param_type == NULL)
 	continue;
diff --git a/gdb/infcall.h b/gdb/infcall.h
index 81b0c8d3433..af3dd49220a 100644
--- a/gdb/infcall.h
+++ b/gdb/infcall.h
@@ -71,4 +71,12 @@ extern struct value *
 
 extern void error_call_unknown_return_type (const char *func_name);
 
+/* Perform the standard coercions that are specified
+   for arguments to be passed to C, Ada or Fortran functions.
+
+   If PARAM_TYPE is non-NULL, it is the expected parameter type.
+   IS_PROTOTYPED is non-zero if the function declaration is prototyped.  */
+
+extern value *default_value_arg_coerce (gdbarch *gdbarch, value *arg,
+					type *param_type, int is_prototyped);
 #endif
-- 
2.25.1

Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 2/2] gdb, gdbarch, infcall:  Add reserve_stack_space method to gdbarch
  2023-03-22 17:13 [PATCH 0/2] Add more flexibility to inferior call Mohamed Bouhaouel
  2023-03-22 17:13 ` [PATCH 1/2] gdb, gdbarch, infcall: Add value_arg_coerce method to gdbarch Mohamed Bouhaouel
@ 2023-03-22 17:13 ` Mohamed Bouhaouel
  2023-03-22 19:16 ` [PATCH 0/2] Add more flexibility to inferior call Simon Marchi
  2 siblings, 0 replies; 9+ messages in thread
From: Mohamed Bouhaouel @ 2023-03-22 17:13 UTC (permalink / raw)
  To: gdb-patches

Change the 'reserve_stack_space' function from a static common method to a
target-dependent method.

Signed-off-by: Mohamed Bouhaouel <mohamed.bouhaouel@intel.com>
---
 gdb/gdbarch-gen.h         |  6 ++++++
 gdb/gdbarch.c             | 22 ++++++++++++++++++++++
 gdb/gdbarch_components.py | 10 ++++++++++
 gdb/infcall.c             | 16 ++++++----------
 gdb/infcall.h             |  9 +++++++++
 5 files changed, 53 insertions(+), 10 deletions(-)

diff --git a/gdb/gdbarch-gen.h b/gdb/gdbarch-gen.h
index a9b0fe26837..ca3e074de8f 100644
--- a/gdb/gdbarch-gen.h
+++ b/gdb/gdbarch-gen.h
@@ -1687,3 +1687,9 @@ extern void set_gdbarch_get_pc_address_flags (struct gdbarch *gdbarch, gdbarch_g
 typedef void (gdbarch_read_core_file_mappings_ftype) (struct gdbarch *gdbarch, struct bfd *cbfd, read_core_file_mappings_pre_loop_ftype pre_loop_cb, read_core_file_mappings_loop_ftype loop_cb);
 extern void gdbarch_read_core_file_mappings (struct gdbarch *gdbarch, struct bfd *cbfd, read_core_file_mappings_pre_loop_ftype pre_loop_cb, read_core_file_mappings_loop_ftype loop_cb);
 extern void set_gdbarch_read_core_file_mappings (struct gdbarch *gdbarch, gdbarch_read_core_file_mappings_ftype *read_core_file_mappings);
+
+/* Reserve space on the stack for a value of the given type. */
+
+typedef CORE_ADDR (gdbarch_reserve_stack_space_ftype) (struct gdbarch *gdbarch, const type *valtype, CORE_ADDR &sp);
+extern CORE_ADDR gdbarch_reserve_stack_space (struct gdbarch *gdbarch, const type *valtype, CORE_ADDR &sp);
+extern void set_gdbarch_reserve_stack_space (struct gdbarch *gdbarch, gdbarch_reserve_stack_space_ftype *reserve_stack_space);
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index a411e5bbac7..25fdfc6b4c2 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -254,6 +254,7 @@ struct gdbarch
   gdbarch_type_align_ftype *type_align = default_type_align;
   gdbarch_get_pc_address_flags_ftype *get_pc_address_flags = default_get_pc_address_flags;
   gdbarch_read_core_file_mappings_ftype *read_core_file_mappings = default_read_core_file_mappings;
+  gdbarch_reserve_stack_space_ftype *reserve_stack_space = default_reserve_stack_space;
 };
 
 /* Create a new ``struct gdbarch'' based on information provided by
@@ -518,6 +519,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
   /* Skip verify of type_align, invalid_p == 0 */
   /* Skip verify of get_pc_address_flags, invalid_p == 0 */
   /* Skip verify of read_core_file_mappings, invalid_p == 0 */
+  /* Skip verify of reserve_stack_space, invalid_p == 0 */
   if (!log.empty ())
     internal_error (_("verify_gdbarch: the following are invalid ...%s"),
 		    log.c_str ());
@@ -1362,6 +1364,9 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
   gdb_printf (file,
 	      "gdbarch_dump: read_core_file_mappings = <%s>\n",
 	      host_address_to_string (gdbarch->read_core_file_mappings));
+  gdb_printf (file,
+	      "gdbarch_dump: reserve_stack_space = <%s>\n",
+	      host_address_to_string (gdbarch->reserve_stack_space));
   if (gdbarch->dump_tdep != NULL)
     gdbarch->dump_tdep (gdbarch, file);
 }
@@ -5365,3 +5370,20 @@ set_gdbarch_read_core_file_mappings (struct gdbarch *gdbarch,
 {
   gdbarch->read_core_file_mappings = read_core_file_mappings;
 }
+
+CORE_ADDR
+gdbarch_reserve_stack_space (struct gdbarch *gdbarch, const type *valtype, CORE_ADDR &sp)
+{
+  gdb_assert (gdbarch != NULL);
+  gdb_assert (gdbarch->reserve_stack_space != NULL);
+  if (gdbarch_debug >= 2)
+    gdb_printf (gdb_stdlog, "gdbarch_reserve_stack_space called\n");
+  return gdbarch->reserve_stack_space (gdbarch, valtype, sp);
+}
+
+void
+set_gdbarch_reserve_stack_space (struct gdbarch *gdbarch,
+				 gdbarch_reserve_stack_space_ftype reserve_stack_space)
+{
+  gdbarch->reserve_stack_space = reserve_stack_space;
+}
diff --git a/gdb/gdbarch_components.py b/gdb/gdbarch_components.py
index 10e8c2d52c8..800054a34b4 100644
--- a/gdb/gdbarch_components.py
+++ b/gdb/gdbarch_components.py
@@ -2683,3 +2683,13 @@ Read core file mappings
     predefault="default_read_core_file_mappings",
     invalid=False,
 )
+
+Method(
+    comment="Reserve space on the stack for a value of the given type.",
+    type="CORE_ADDR",
+    name="reserve_stack_space",
+    params=[("const type *", "valtype"), ("CORE_ADDR &", "sp")],
+    predefault="default_reserve_stack_space",
+    predicate=False,
+    invalid=False,
+)
diff --git a/gdb/infcall.c b/gdb/infcall.c
index b945adebc93..8ef05bec3e0 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -702,16 +702,12 @@ run_inferior_call (std::unique_ptr<call_thread_fsm> sm,
   return caught_error;
 }
 
-/* Reserve space on the stack for a value of the given type.
-   Return the address of the allocated space.
-   Make certain that the value is correctly aligned.
-   The SP argument is modified.  */
+/* See infcall.h.  */
 
-static CORE_ADDR
-reserve_stack_space (const type *values_type, CORE_ADDR &sp)
+CORE_ADDR
+default_reserve_stack_space (gdbarch *gdbarch, const type *values_type,
+			     CORE_ADDR &sp)
 {
-  frame_info_ptr frame = get_current_frame ();
-  struct gdbarch *gdbarch = get_frame_arch (frame);
   CORE_ADDR addr = 0;
 
   if (gdbarch_inner_than (gdbarch, 1, 2))
@@ -1116,7 +1112,7 @@ call_function_by_hand_dummy (struct value *function,
       /* Make a copy of the argument on the stack.  If the argument is
 	 trivially copy ctor'able, copy bit by bit.  Otherwise, call
 	 the copy ctor to initialize the clone.  */
-      CORE_ADDR addr = reserve_stack_space (param_type, sp);
+      CORE_ADDR addr = gdbarch_reserve_stack_space (gdbarch, param_type, sp);
       value *clone
 	= value_from_contents_and_address (param_type, nullptr, addr);
       push_thread_stack_temporary (call_thread.get (), clone);
@@ -1201,7 +1197,7 @@ call_function_by_hand_dummy (struct value *function,
 
   if (return_method != return_method_normal
       || (stack_temporaries && class_or_union_p (values_type)))
-    struct_addr = reserve_stack_space (values_type, sp);
+    struct_addr = gdbarch_reserve_stack_space (gdbarch, values_type, sp);
 
   std::vector<struct value *> new_args;
   if (return_method == return_method_hidden_param)
diff --git a/gdb/infcall.h b/gdb/infcall.h
index af3dd49220a..807d86d3989 100644
--- a/gdb/infcall.h
+++ b/gdb/infcall.h
@@ -79,4 +79,13 @@ extern void error_call_unknown_return_type (const char *func_name);
 
 extern value *default_value_arg_coerce (gdbarch *gdbarch, value *arg,
 					type *param_type, int is_prototyped);
+
+/* Reserve space on the stack for a value of the given type.
+   Return the address of the allocated space.
+   Make certain that the value is correctly aligned.
+   The SP argument is modified.  */
+
+extern CORE_ADDR default_reserve_stack_space (gdbarch *gdbarch,
+					      const type *values_type,
+					      CORE_ADDR &sp);
 #endif
-- 
2.25.1

Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/2] Add more flexibility to inferior call
  2023-03-22 17:13 [PATCH 0/2] Add more flexibility to inferior call Mohamed Bouhaouel
  2023-03-22 17:13 ` [PATCH 1/2] gdb, gdbarch, infcall: Add value_arg_coerce method to gdbarch Mohamed Bouhaouel
  2023-03-22 17:13 ` [PATCH 2/2] gdb, gdbarch, infcall: Add reserve_stack_space " Mohamed Bouhaouel
@ 2023-03-22 19:16 ` Simon Marchi
  2023-03-23 11:34   ` Bouhaouel, Mohamed
  2 siblings, 1 reply; 9+ messages in thread
From: Simon Marchi @ 2023-03-22 19:16 UTC (permalink / raw)
  To: Mohamed Bouhaouel, gdb-patches

On 3/22/23 13:13, Mohamed Bouhaouel via Gdb-patches wrote:
> Hi all,
> 
> The following two patches would add more flexibility to the infcalls
> workflow by allowing targets to have their own implementations of:
> 	* value_arg_coerce: Enable the target to control arguments
> 	coercion whenever needed (e.g.  Coerce BOOL to UINT16_T
> 	instead of UINT32_T).
> 	* reserve_stack_space: Enable the target to decide how much
> 	space is needed for a type (e.g.  Targets might have a vectorized
> 	representation of variables).

Hi Mohamed,

Is there an end goal to this?  It doesn't really make sense to add
gdbarch methods but have no architecture use it.  If it's necessary for
some upcoming feature, then include these patches as preparatory patches
in the series that adds said feature.

Simon

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] gdb, gdbarch, infcall: Add value_arg_coerce method to gdbarch.
  2023-03-22 17:13 ` [PATCH 1/2] gdb, gdbarch, infcall: Add value_arg_coerce method to gdbarch Mohamed Bouhaouel
@ 2023-03-22 19:18   ` Simon Marchi
  0 siblings, 0 replies; 9+ messages in thread
From: Simon Marchi @ 2023-03-22 19:18 UTC (permalink / raw)
  To: Mohamed Bouhaouel, gdb-patches

On 3/22/23 13:13, Mohamed Bouhaouel via Gdb-patches wrote:
> Change the 'value_arg_coerce' function from a static common method to a
> target-dependent method.

Just a note to use "arch" instead of target.  Target, inside GDB,
usually means target_ops.  Using the right term will avoid confusion.

Simon

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [PATCH 0/2] Add more flexibility to inferior call
  2023-03-22 19:16 ` [PATCH 0/2] Add more flexibility to inferior call Simon Marchi
@ 2023-03-23 11:34   ` Bouhaouel, Mohamed
  2023-03-24 13:38     ` Simon Marchi
  0 siblings, 1 reply; 9+ messages in thread
From: Bouhaouel, Mohamed @ 2023-03-23 11:34 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

Hi Simon,

Thanks for your feedback.  These patches are pre-requisite for an Intel architecture
that has not been yet up-streamed.  Waiting for the architecture to be introduced
first is likely more logical,  although, such flexibility might be useful for
other new architectures.

Should I submit a new version of those patches while considering your comments
or wait to post all together?

Thanks,
Mohamed

> -----Original Message-----
> From: Simon Marchi <simark@simark.ca>
> Sent: Wednesday, March 22, 2023 8:17 PM
> To: Bouhaouel, Mohamed <mohamed.bouhaouel@intel.com>; gdb-
> patches@sourceware.org
> Subject: Re: [PATCH 0/2] Add more flexibility to inferior call
> 
> On 3/22/23 13:13, Mohamed Bouhaouel via Gdb-patches wrote:
> > Hi all,
> >
> > The following two patches would add more flexibility to the infcalls
> > workflow by allowing targets to have their own implementations of:
> > 	* value_arg_coerce: Enable the target to control arguments
> > 	coercion whenever needed (e.g.  Coerce BOOL to UINT16_T
> > 	instead of UINT32_T).
> > 	* reserve_stack_space: Enable the target to decide how much
> > 	space is needed for a type (e.g.  Targets might have a vectorized
> > 	representation of variables).
> 
> Hi Mohamed,
> 
> Is there an end goal to this?  It doesn't really make sense to add
> gdbarch methods but have no architecture use it.  If it's necessary for
> some upcoming feature, then include these patches as preparatory patches
> in the series that adds said feature.
> 
> Simon


Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/2] Add more flexibility to inferior call
  2023-03-23 11:34   ` Bouhaouel, Mohamed
@ 2023-03-24 13:38     ` Simon Marchi
  2023-03-24 14:10       ` Bouhaouel, Mohamed
  2023-03-24 14:12       ` Tom Tromey
  0 siblings, 2 replies; 9+ messages in thread
From: Simon Marchi @ 2023-03-24 13:38 UTC (permalink / raw)
  To: Bouhaouel, Mohamed, gdb-patches

On 3/23/23 07:34, Bouhaouel, Mohamed wrote:
> Hi Simon,
> 
> Thanks for your feedback.  These patches are pre-requisite for an Intel architecture
> that has not been yet up-streamed.  Waiting for the architecture to be introduced
> first is likely more logical,  although, such flexibility might be useful for
> other new architectures.
> 
> Should I submit a new version of those patches while considering your comments
> or wait to post all together?

I think it's better to post it with the first architecture that uses it.
It helps illustrate what the method is for and how it works.  But also,
if your port never ends up upstream for whatever reason, it doesn't make
sense to have those methods with no users.

Simon

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [PATCH 0/2] Add more flexibility to inferior call
  2023-03-24 13:38     ` Simon Marchi
@ 2023-03-24 14:10       ` Bouhaouel, Mohamed
  2023-03-24 14:12       ` Tom Tromey
  1 sibling, 0 replies; 9+ messages in thread
From: Bouhaouel, Mohamed @ 2023-03-24 14:10 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

That makes sense, I will re-submit them once the new architecture is posted.

Thanks.
Mohamed


> -----Original Message-----
> From: Simon Marchi <simark@simark.ca>
> Sent: Friday, March 24, 2023 2:38 PM
> To: Bouhaouel, Mohamed <mohamed.bouhaouel@intel.com>; gdb-
> patches@sourceware.org
> Subject: Re: [PATCH 0/2] Add more flexibility to inferior call
> 
> On 3/23/23 07:34, Bouhaouel, Mohamed wrote:
> > Hi Simon,
> >
> > Thanks for your feedback.  These patches are pre-requisite for an Intel
> architecture
> > that has not been yet up-streamed.  Waiting for the architecture to be
> introduced
> > first is likely more logical,  although, such flexibility might be useful for
> > other new architectures.
> >
> > Should I submit a new version of those patches while considering your
> comments
> > or wait to post all together?
> 
> I think it's better to post it with the first architecture that uses it.
> It helps illustrate what the method is for and how it works.  But also,
> if your port never ends up upstream for whatever reason, it doesn't make
> sense to have those methods with no users.
> 
> Simon
Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/2] Add more flexibility to inferior call
  2023-03-24 13:38     ` Simon Marchi
  2023-03-24 14:10       ` Bouhaouel, Mohamed
@ 2023-03-24 14:12       ` Tom Tromey
  1 sibling, 0 replies; 9+ messages in thread
From: Tom Tromey @ 2023-03-24 14:12 UTC (permalink / raw)
  To: Simon Marchi via Gdb-patches; +Cc: Bouhaouel, Mohamed, Simon Marchi

Simon> I think it's better to post it with the first architecture that uses it.

Agreed.

Simon> It helps illustrate what the method is for and how it works.  But also,
Simon> if your port never ends up upstream for whatever reason, it doesn't make
Simon> sense to have those methods with no users.

Additionally, depending on exactly what it is needed for, there might be
some other solution, not involving new arch hooks, that we'd prefer.

Tom

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-03-24 14:12 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-22 17:13 [PATCH 0/2] Add more flexibility to inferior call Mohamed Bouhaouel
2023-03-22 17:13 ` [PATCH 1/2] gdb, gdbarch, infcall: Add value_arg_coerce method to gdbarch Mohamed Bouhaouel
2023-03-22 19:18   ` Simon Marchi
2023-03-22 17:13 ` [PATCH 2/2] gdb, gdbarch, infcall: Add reserve_stack_space " Mohamed Bouhaouel
2023-03-22 19:16 ` [PATCH 0/2] Add more flexibility to inferior call Simon Marchi
2023-03-23 11:34   ` Bouhaouel, Mohamed
2023-03-24 13:38     ` Simon Marchi
2023-03-24 14:10       ` Bouhaouel, Mohamed
2023-03-24 14:12       ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).