aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/infcall.c4
-rw-r--r--gdb/testsuite/ChangeLog9
-rw-r--r--gdb/testsuite/gdb.cp/method-call-in-c.cc9
-rw-r--r--gdb/testsuite/gdb.cp/method-call-in-c.exp3
5 files changed, 28 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 1d10ae0..9613e3e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2021-06-25 Andrew Burgess <andrew.burgess@embecosm.com>
+ * infcall.c (call_function_by_hand_dummy): Add missing 'else' when
+ setting prototyped flag.
+
+2021-06-25 Andrew Burgess <andrew.burgess@embecosm.com>
+
* ada-lang.c (desc_bounds): Use '{}' instead of NULL to indicate
an empty gdb::optional when calling value_struct_elt.
(desc_data): Likewise.
diff --git a/gdb/infcall.c b/gdb/infcall.c
index ca3347f..40298fb 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -1026,8 +1026,8 @@ call_function_by_hand_dummy (struct value *function,
prototyped. Can we respect TYPE_VARARGS? Probably not. */
if (ftype->code () == TYPE_CODE_METHOD)
prototyped = 1;
- if (TYPE_TARGET_TYPE (ftype) == NULL && ftype->num_fields () == 0
- && default_return_type != NULL)
+ else if (TYPE_TARGET_TYPE (ftype) == NULL && ftype->num_fields () == 0
+ && default_return_type != NULL)
{
/* Calling a no-debug function with the return type
explicitly cast. Assume the function is prototyped,
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index b155c71..9bf8e9e 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,14 @@
2021-06-25 Andrew Burgess <andrew.burgess@embecosm.com>
+ * gdb.cp/method-call-in-c.cc (struct foo_type): Add static member
+ function static_method.
+ (global_var): New global.
+ (main): Use new static_method to ensure it is compiled in.
+ * gdb.cp/method-call-in-c.exp: Test calls to static member
+ function.
+
+2021-06-25 Andrew Burgess <andrew.burgess@embecosm.com>
+
PR gdb/27994
* gdb.cp/method-call-in-c.cc (struct foo_type): Add operator+=,
change initial value of var member variable.
diff --git a/gdb/testsuite/gdb.cp/method-call-in-c.cc b/gdb/testsuite/gdb.cp/method-call-in-c.cc
index 95f3f3c..846a911 100644
--- a/gdb/testsuite/gdb.cp/method-call-in-c.cc
+++ b/gdb/testsuite/gdb.cp/method-call-in-c.cc
@@ -35,9 +35,16 @@ struct foo_type
return *this;
}
+ static int static_method (float f, baz_type b)
+ {
+ return b.a + b.b + b.c + (int) f;
+ }
+
int var = 120;
};
+volatile int global_var;
+
int
main (void)
{
@@ -48,5 +55,7 @@ main (void)
foo += b;
+ global_var = foo.static_method (f, b);
+
return foo.func (b, f); /* Break here. */
}
diff --git a/gdb/testsuite/gdb.cp/method-call-in-c.exp b/gdb/testsuite/gdb.cp/method-call-in-c.exp
index 411ba67..5debc0e 100644
--- a/gdb/testsuite/gdb.cp/method-call-in-c.exp
+++ b/gdb/testsuite/gdb.cp/method-call-in-c.exp
@@ -43,5 +43,8 @@ foreach_with_prefix lang { c++ c } {
set result [expr $result + 3]
gdb_test "print foo += b" \
" = \\((?:struct )?foo_type &\\) @${hex}: \\\{var = ${result}\\\}"
+
+ gdb_test "print foo.static_method (f, b)" " = 4"
+ gdb_test "print foo_type::static_method (f, b)" " = 4"
}
}