mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-28 04:25:10 +08:00
424646edf4
It was pointed out[1] that after this commit:
commit 3812b38d8d
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>
45 lines
1.7 KiB
Modula-2
45 lines
1.7 KiB
Modula-2
/* Agent expression result types.
|
|
|
|
Copyright (C) 2023 Free Software Foundation, Inc.
|
|
|
|
This file is part of GDB.
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
|
/* The AX_RESULT_TYPE macro is used to define a result type that can be
|
|
generated by agent expression evaluation. The first macro argument is
|
|
the name of an enum entry, and the second is a string that describes
|
|
this result type. */
|
|
|
|
AX_RESULT_TYPE (expr_eval_no_error,
|
|
"terror:no error")
|
|
AX_RESULT_TYPE (expr_eval_empty_expression,
|
|
"terror:empty expression")
|
|
AX_RESULT_TYPE (expr_eval_empty_stack,
|
|
"terror:empty stack")
|
|
AX_RESULT_TYPE (expr_eval_stack_overflow,
|
|
"terror:stack overflow")
|
|
AX_RESULT_TYPE (expr_eval_stack_underflow,
|
|
"terror:stack underflow")
|
|
AX_RESULT_TYPE (expr_eval_unhandled_opcode,
|
|
"terror:unhandled opcode")
|
|
AX_RESULT_TYPE (expr_eval_unrecognized_opcode,
|
|
"terror:unrecognized opcode")
|
|
AX_RESULT_TYPE (expr_eval_divide_by_zero,
|
|
"terror:divide by zero")
|
|
AX_RESULT_TYPE (expr_eval_invalid_goto,
|
|
"terror:invalid goto")
|
|
AX_RESULT_TYPE (expr_eval_invalid_memory_access,
|
|
"terror:invalid memory access")
|