** The 'qualified' argument to gdb.Breakpoint constructor will no
longer accept non-bool types.
+ ** Added the gdb.Symbol.is_artificial attribute.
+
* Debugger Adapter Protocol changes
** The "scopes" request will now return a scope holding global
(or send a response) until after the "configurationDone" request
has been sent.
+ ** The "variables" request will not return artificial symbols.
+
* New commands
show jit-reader-directory
@code{True} if the symbol is an argument of a function.
@end defvar
+@defvar Symbol.is_artificial
+@code{True} if the symbol is artificial. An artificial symbol is one
+that is introduced by the compiler.
+@end defvar
+
@defvar Symbol.is_constant
@code{True} if the symbol is a constant.
@end defvar
# returns False for arguments as well. Anyway,
# don't include non-variables here.
continue
+ elif sym.is_artificial:
+ # Skip artificial symbols.
+ continue
lvars.append(SymValueWrapper(frame, sym))
if block.function is not None:
syms = []
block_iter = block
while block_iter is not None:
- syms += [sym for sym in block_iter if sym.is_variable]
+ syms += [sym for sym in block_iter if sym.is_variable and not sym.is_artificial]
block_iter = block_iter.superblock
if len(syms) == 0:
|| theclass == LOC_OPTIMIZED_OUT));
}
+/* Implementation of Symbol.is_artificial. */
+
+static PyObject *
+sympy_is_artificial (PyObject *self, void *closure)
+{
+ struct symbol *symbol = nullptr;
+
+ SYMPY_REQUIRE_VALID (self, symbol);
+
+ return PyBool_FromLong (symbol->is_artificial ());
+}
+
/* Implementation of gdb.Symbol.needs_frame -> Boolean.
Returns true iff the symbol needs a frame for evaluation. */
{ "addr_class", sympy_get_addr_class, NULL, "Address class of the symbol." },
{ "is_argument", sympy_is_argument, NULL,
"True if the symbol is an argument of a function." },
+ { "is_artificial", sympy_is_artificial, nullptr,
+ "True if the symbol is marked artificial." },
{ "is_constant", sympy_is_constant, NULL,
"True if the symbol is a constant." },
{ "is_function", sympy_is_function, NULL,
--- /dev/null
+# Copyright (C) 2024 Free Software Foundation, Inc.
+
+# 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/>.
+#
+# Test gdb.Symbol.artificial.
+
+load_lib dwarf.exp
+load_lib gdb-python.exp
+
+require dwarf2_support allow_python_tests
+
+# Just use a no-op main.
+standard_testfile py-arch.c -dw.S
+
+set asm_file [standard_output_file ${srcfile2}]
+Dwarf::assemble $asm_file {
+ cu {} {
+ compile_unit {
+ {language @DW_LANG_C}
+ {name py-sym-artificial.c}
+ } {
+ declare_labels signed
+
+ signed: DW_TAG_base_type {
+ {DW_AT_byte_size 1 DW_FORM_sdata}
+ {DW_AT_encoding @DW_ATE_signed}
+ {DW_AT_name bool}
+ }
+
+ DW_TAG_variable {
+ {name the_variable}
+ {DW_AT_type :$signed}
+ {artificial 1 DW_FORM_flag_present}
+ }
+ }
+ }
+}
+
+if {[prepare_for_testing "failed to prepare" ${testfile} \
+ [list $srcfile $asm_file] {nodebug}]} {
+ return -1
+}
+
+if {![runto_main]} {
+ return -1
+}
+
+gdb_py_test_silent_cmd "python v = gdb.lookup_symbol('the_variable')" \
+ "get variable" 1
+gdb_test "python print(v\[0\].is_artificial)" True \
+ "variable is artificial"