aboutsummaryrefslogtreecommitdiff
path: root/gdb/make-target-delegates.py
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2023-08-23 19:28:37 +0200
committerTom de Vries <tdevries@suse.de>2023-08-23 19:28:37 +0200
commit010278690441ef32d3c1089fa4fdfaeaf8cc49b7 (patch)
tree9f1696c4381f5caff45b824d4cea54ec8e397920 /gdb/make-target-delegates.py
parentfa4f2d46f95a1c673b025fab7f292cb864a99020 (diff)
downloadgdb-010278690441ef32d3c1089fa4fdfaeaf8cc49b7.zip
gdb-010278690441ef32d3c1089fa4fdfaeaf8cc49b7.tar.gz
gdb-010278690441ef32d3c1089fa4fdfaeaf8cc49b7.tar.bz2
[gdb/build] Support reference return type in make-target-delegates.py
When doing this in target.h: ... - virtual gdb::byte_vector thread_info_to_thread_handle (struct thread_info *) + virtual gdb::byte_vector &thread_info_to_thread_handle (struct thread_info *) ... make-target-delegates.py drops the function. By handling '&' in POINTER_PART we can prevent that the function is dropped, but when recompiling target.o we get: ... gdb/target-delegates.c: In member function ‘virtual gdb::byte_vector& \ debug_target::thread_info_to_thread_handle(thread_info*)’: gdb/target-delegates.c:1889:22: error: ‘result’ declared as reference but not \ initialized gdb::byte_vector & result; ^~~~~~ make: *** [Makefile:1923: target.o] Error 1 ... Fix this by making sure result is initialized. Regenerate target-delegates.c using this new style. Tested on x86_64-linux. Approved-By: Pedro Alves <pedro@palves.net>
Diffstat (limited to 'gdb/make-target-delegates.py')
-rwxr-xr-xgdb/make-target-delegates.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/gdb/make-target-delegates.py b/gdb/make-target-delegates.py
index 704d3f1..5e766e3 100755
--- a/gdb/make-target-delegates.py
+++ b/gdb/make-target-delegates.py
@@ -40,7 +40,7 @@ ARGS_PART = r"(?P<args>\(.*\))"
# We strip the indentation so here we only need the caret.
INTRO_PART = r"^"
-POINTER_PART = r"\s*(\*)?\s*"
+POINTER_PART = r"\s*(\*|\&)?\s*"
# Match a C++ symbol, including scope operators and template
# parameters. E.g., 'std::vector<something>'.
@@ -268,8 +268,6 @@ def write_debugmethod(
print("", file=f)
debugname = "debug_target::" + name
names = write_function_header(f, False, debugname, return_type, argtypes)
- if return_type != "void":
- print(" " + return_type + " result;", file=f)
print(
' gdb_printf (gdb_stdlog, "-> %s->'
+ name
@@ -278,9 +276,11 @@ def write_debugmethod(
)
# Delegate to the beneath target.
- print(" ", file=f, end="")
if return_type != "void":
- print("result = ", file=f, end="")
+ print(" " + return_type + " result", file=f)
+ print(" = ", file=f, end="")
+ else:
+ print(" ", file=f, end="")
print("this->beneath ()->" + name + " (", file=f, end="")
print(", ".join(names), file=f, end="")
print(");", file=f)