aboutsummaryrefslogtreecommitdiff
path: root/gdbserver/tracepoint.cc
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2023-07-07 17:18:46 +0100
committerAndrew Burgess <aburgess@redhat.com>2023-07-10 14:42:54 +0100
commit424646edf42425390c0174f344a2acbd33b68fc9 (patch)
tree0780cf22e4850159a4341aa72b610d70d6cf4d9a /gdbserver/tracepoint.cc
parent9f462ddef8456dc3b47e21f5f1995d1119e18b3f (diff)
downloadfsf-binutils-gdb-424646edf42425390c0174f344a2acbd33b68fc9.zip
fsf-binutils-gdb-424646edf42425390c0174f344a2acbd33b68fc9.tar.gz
fsf-binutils-gdb-424646edf42425390c0174f344a2acbd33b68fc9.tar.bz2
gdbserver: handle all eval_result_type values in tracepoint.cc
It was pointed out[1] that after this commit: commit 3812b38d8de5804ad3eadd6c7a5d532402ddabab Date: Thu Oct 20 11:14:33 2022 +0100 gdbserver: allow agent expressions to fail with invalid memory access Now that agent expressions might fail with the error expr_eval_invalid_memory_access, we might overflow the eval_result_names array in tracepoint.cc. This is because the eval_result_names array does not include a string for either expr_eval_invalid_goto or expr_eval_invalid_memory_access. I don't know if having expr_eval_invalid_goto missing is also a problem, but it feels like eval_result_names should just include a string for every possible error. I could just add two more strings into the array, but I figure that a more robust solution will be to move all of the error types, and their associated strings, into a new ax-result-types.def file, and to then include this file in both ax.h and tracepoint.cc in order to build the enum eval_result_type and the eval_result_names string array. Doing this means it is impossible to have a missing error string in the future. [1] https://inbox.sourceware.org/gdb-patches/01059f8a-0e59-55b5-f530-190c26df5ba3@palves.net/ Approved-By: Pedro Alves <pedro@palves.net>
Diffstat (limited to 'gdbserver/tracepoint.cc')
-rw-r--r--gdbserver/tracepoint.cc11
1 files changed, 3 insertions, 8 deletions
diff --git a/gdbserver/tracepoint.cc b/gdbserver/tracepoint.cc
index 1f31e0c..609d49a 100644
--- a/gdbserver/tracepoint.cc
+++ b/gdbserver/tracepoint.cc
@@ -859,14 +859,9 @@ static struct tracepoint *last_tracepoint;
static const char * const eval_result_names[] =
{
- "terror:in the attic", /* this should never be reported */
- "terror:empty expression",
- "terror:empty stack",
- "terror:stack overflow",
- "terror:stack underflow",
- "terror:unhandled opcode",
- "terror:unrecognized opcode",
- "terror:divide by zero"
+#define AX_RESULT_TYPE(ENUM,STR) STR,
+#include "ax-result-types.def"
+#undef AX_RESULT_TYPE
};
#endif