diff options
Diffstat (limited to 'gdb')
755 files changed, 3162 insertions, 2330 deletions
@@ -14,6 +14,15 @@ this flag is used gdbserver will not escape special shell characters within the inferior arguments. +* The add-inferior, clone-inferior, and MI -add-inferior commands will + now give a warning, and create the new inferior without a + connection, when the current inferior's connection, at the time the + command is given, is unshareable. For example, the core-file target + cannot be shared between inferiors, nor can the Window native + target. These targets could never really be shared. Attempting to + share them would usually lead to GDB crashing. GDB now prevents + this invalid sharing. + * New targets GNU/Linux/MicroBlaze (gdbserver) microblazeel-*linux* diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index a13d5c0..dfe3493 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -3508,8 +3508,40 @@ with no connection yet. You can then for example use the @code{target remote} command to connect to some other @code{gdbserver} instance, use @code{run} to spawn a local program, etc. +Not all connections can be shared between inferiors. For example, the +@code{target core} target is unique for each inferior. That is, +multiple inferiors can use @code{target core} at the same time, but +each @code{target core} is different. If you try to +@code{add-inferior}, and the current inferior is @code{target core}, +then @value{GDBN} will give a warning and create the new inferior +without a connection, like this@: + +@smallexample +(@value{GDBP}) file test1 +Reading symbols from test1... +(@value{GDBP}) target core core.test1.433190 +[New LWP 433190] +Core was generated by `./test1'. +Program terminated with signal SIGSEGV, Segmentation fault. +#0 0x0000000000401111 in foo () at test1.c:6 +6 return *global_ptr; +(@value{GDBP}) add-inferior +[New inferior 2] +warning: can't share connection 1 (core) between inferiors +Added inferior 2 +@end smallexample + +Another target that cannot be shared is @code{target remote} +(@pxref{Connecting,,Types of Remote Connections}). A remote target +doesn't allow new inferiors to be started, as such creating a new, +non-running, inferior that shares a remote connection doesn't make +sense. As with the core target above, if you try to +@code{add-inferior}, and the current inferior is @code{target remote}, +then @value{GDBN} will give a warning and create the new inferior +without a connection. + @kindex clone-inferior -@item clone-inferior [ -copies @var{n} ] [ @var{infno} ] +@item clone-inferior [ -copies @var{n} ] [ -no-connection ] [ @var{infno} ] Adds @var{n} inferiors ready to execute the same program as inferior @var{infno}; @var{n} defaults to 1, and @var{infno} defaults to the number of the current inferior. This command copies the values of the @@ -3534,6 +3566,13 @@ Added inferior 2. You can now simply switch focus to inferior 2 and run it. +Like @code{add-inferior}, @code{clone-inferior} shares the connection +with the inferior @var{infno}. If the @var{-no-connection} option is +given, then the new inferior will be created without a connection. If +the connection of inferior @var{infno} can't be shared, then +@value{GDBN} will give a warning, and the new inferior will be created +without a connection. + @anchor{remove_inferiors_cli} @kindex remove-inferiors @item remove-inferiors @var{infno}@dots{} @@ -39458,6 +39497,11 @@ with no connection yet. You can then for example use the @code{gdbserver} instance, use @code{-exec-run} to spawn a local program, etc. +If the connection of the current inferior cannot be shared, e.g.@: the +@code{-target-select core} target cannot be shared between inferiors, +then @value{GDBN} will give a warning and create the new inferior +without a connection. + The command response always has a field, @var{inferior}, whose value is the identifier of the thread group corresponding to the new inferior. diff --git a/gdb/dwarf2/cooked-index-worker.h b/gdb/dwarf2/cooked-index-worker.h index 433515b..dfdc82f 100644 --- a/gdb/dwarf2/cooked-index-worker.h +++ b/gdb/dwarf2/cooked-index-worker.h @@ -296,8 +296,16 @@ protected: /* The per-objfile object. */ dwarf2_per_objfile *m_per_objfile; + /* Result of each worker task. */ std::vector<cooked_index_worker_result> m_results; + +#if CXX_STD_THREAD + /* Mutex to synchronize access to M_RESULTS when workers append their + result. */ + std::mutex m_results_mutex; +#endif /* CXX_STD_THREAD */ + /* Any warnings emitted. For the time being at least, this only needed in do_reading, not in every worker. Note that deferred_warnings uses gdb_stderr in its constructor, and this diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 8019179..bf982f9 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -52,6 +52,7 @@ #include "elf-bfd.h" #include "event-top.h" #include "exceptions.h" +#include "gdbsupport/parallel-for.h" #include "gdbsupport/task-group.h" #include "maint.h" #include "symtab.h" @@ -3308,6 +3309,61 @@ public: } private: + /* The task for parallel workers that index units. */ + struct parallel_indexing_worker + { + parallel_indexing_worker (const char *step_name, + cooked_index_worker_debug_info *parent) + : m_scoped_time_it (step_name, parent->m_per_command_time), + m_parent (parent) + { + } + + DISABLE_COPY_AND_ASSIGN (parallel_indexing_worker); + + ~parallel_indexing_worker () + { + bfd_thread_cleanup (); + + m_thread_storage.done_reading (m_complaint_handler.release ()); + + /* Append the results of this worker to the parent instance. */ +#if CXX_STD_THREAD + std::lock_guard<std::mutex> lock (m_parent->m_results_mutex); +#endif + m_parent->m_results.emplace_back (std::move (m_thread_storage)); + } + + void operator() (iterator_range<dwarf2_per_cu_up *> range) + { + for (auto &it : range) + this->process_one (*it); + } + + private: + void process_one (dwarf2_per_cu &unit) + { + m_thread_storage.catch_error ([&] () + { + m_parent->process_unit (&unit, m_parent->m_per_objfile, + &m_thread_storage); + }); + } + + /* Measures the execution time of this worker. */ + scoped_time_it m_scoped_time_it; + + /* Delayed complaints and errors recorded while indexing units. */ + complaint_interceptor m_complaint_handler; + std::vector<gdb_exception> m_errors; + + /* Index storage for this worker. */ + cooked_index_worker_result m_thread_storage; + + /* The instance that spawned this worker. */ + cooked_index_worker_debug_info *m_parent; + }; + void do_reading () override; /* Print collected type unit statistics. */ @@ -3350,12 +3406,6 @@ private: /* An iterator for the comp units. */ using unit_iterator = std::vector<dwarf2_per_cu_up>::iterator; - /* Process a batch of CUs. This may be called multiple times in - separate threads. TASK_NUMBER indicates which task this is -- - the result is stored in that slot of M_RESULTS. */ - void process_units (size_t task_number, unit_iterator first, - unit_iterator end); - /* Process unit THIS_CU. */ void process_unit (dwarf2_per_cu *this_cu, dwarf2_per_objfile *per_objfile, cooked_index_worker_result *storage); @@ -3580,32 +3630,6 @@ cooked_index_worker_debug_info::process_skeletonless_type_units } void -cooked_index_worker_debug_info::process_units (size_t task_number, - unit_iterator first, - unit_iterator end) -{ - SCOPE_EXIT { bfd_thread_cleanup (); }; - - /* Ensure that complaints are handled correctly. */ - complaint_interceptor complaint_handler; - - std::vector<gdb_exception> errors; - cooked_index_worker_result thread_storage; - for (auto inner = first; inner != end; ++inner) - { - dwarf2_per_cu *per_cu = inner->get (); - - thread_storage.catch_error ([&] () - { - process_unit (per_cu, m_per_objfile, &thread_storage); - }); - } - - thread_storage.done_reading (complaint_handler.release ()); - m_results[task_number] = std::move (thread_storage); -} - -void cooked_index_worker_debug_info::done_reading () { /* This has to wait until we read the CUs, we need the list of DWOs. */ @@ -3630,62 +3654,16 @@ cooked_index_worker_debug_info::do_reading () m_index_storage.get_addrmap (), &m_warnings); - /* We want to balance the load between the worker threads. This is - done by using the size of each CU as a rough estimate of how - difficult it will be to operate on. This isn't ideal -- for - example if dwz is used, the early CUs will all tend to be - "included" and won't be parsed independently. However, this - heuristic works well for typical compiler output. */ - - size_t total_size = 0; - for (const auto &per_cu : per_bfd->all_units) - total_size += per_cu->length (); - - /* How many worker threads we plan to use. We may not actually use - this many. We use 1 as the minimum to avoid division by zero, - and anyway in the N==0 case the work will be done - synchronously. */ - const size_t n_worker_threads - = std::max (gdb::thread_pool::g_thread_pool->thread_count (), (size_t) 1); - - /* How much effort should be put into each worker. */ - const size_t size_per_thread - = std::max (total_size / n_worker_threads, (size_t) 1); - - /* Work is done in a task group. */ - gdb::task_group workers ([this] () - { - this->done_reading (); - }); - - auto end = per_bfd->all_units.end (); - size_t task_count = 0; - for (auto iter = per_bfd->all_units.begin (); iter != end; ) - { - auto last = iter; - /* Put all remaining CUs into the last task. */ - if (task_count == n_worker_threads - 1) - last = end; - else - { - size_t chunk_size = 0; - for (; last != end && chunk_size < size_per_thread; ++last) - chunk_size += (*last)->length (); - } - - gdb_assert (iter != last); - workers.add_task ([this, task_count, iter, last] () - { - scoped_time_it time_it ("DWARF indexing worker", m_per_command_time); - process_units (task_count, iter, last); - }); - - ++task_count; - iter = last; - } + /* Launch parallel tasks to index units. - m_results.resize (task_count); - workers.start (); + The (unfortunate) reason why we don't use + std::vector<dwarf2_per_cu_up>::iterator as the parallel-for-each iterator + type is that std::atomic won't work with that type when building with + -D_GLIBCXX_DEBUG. */ + gdb::parallel_for_each_async<1, dwarf2_per_cu_up *, parallel_indexing_worker> + (per_bfd->all_units.data (), + per_bfd->all_units.data () + per_bfd->all_units.size (), + [this] () { this->done_reading (); }, "DWARF indexing worker", this); } static void diff --git a/gdb/fbsd-nat.h b/gdb/fbsd-nat.h index fb81c53..76d5aee 100644 --- a/gdb/fbsd-nat.h +++ b/gdb/fbsd-nat.h @@ -122,6 +122,10 @@ public: bool supports_disable_randomization () override; + /* FreeBSD ptrace targets are shareable. */ + bool is_shareable () override final + { return true; } + /* Methods meant to be overridden by arch-specific target classes. */ diff --git a/gdb/inferior.c b/gdb/inferior.c index eb895f2..78ecb16 100644 --- a/gdb/inferior.c +++ b/gdb/inferior.c @@ -880,6 +880,19 @@ switch_to_inferior_and_push_target (inferior *new_inf, symbols. */ switch_to_inferior_no_thread (new_inf); + /* If the user didn't specify '-no-connection', and the ORG_INF has a + process stratum target, but that target cannot be shared, or cannot + start a new inferior, then don't try to share the target. */ + if (!no_connection && proc_target != nullptr + && (!proc_target->is_shareable () + || !proc_target->can_create_inferior ())) + { + warning (_("can't share connection %d (%s) between inferiors"), + proc_target->connection_number, + make_target_connection_string (proc_target).c_str ()); + proc_target = nullptr; + } + /* Reuse the target for new inferior. */ if (!no_connection && proc_target != NULL) { diff --git a/gdb/inferior.h b/gdb/inferior.h index 8455b79..0dffbb1 100644 --- a/gdb/inferior.h +++ b/gdb/inferior.h @@ -856,9 +856,10 @@ extern struct inferior *add_inferior_with_spaces (void); /* Print the current selected inferior. */ extern void print_selected_inferior (struct ui_out *uiout); -/* Switch to inferior NEW_INF, a new inferior, and unless - NO_CONNECTION is true, push the process_stratum_target of ORG_INF - to NEW_INF. */ +/* Switch to inferior NEW_INF, a new inferior, and unless NO_CONNECTION is + true, or the process_stratum_target of ORG_INF is not shareable, or the + process_stratum_target cannot start new inferiors, push the + process_stratum_target of ORG_INF to NEW_INF. */ extern void switch_to_inferior_and_push_target (inferior *new_inf, bool no_connection, inferior *org_inf); diff --git a/gdb/linux-nat.h b/gdb/linux-nat.h index 7cbe9a9..ed128c0 100644 --- a/gdb/linux-nat.h +++ b/gdb/linux-nat.h @@ -137,6 +137,10 @@ public: std::vector<static_tracepoint_marker> static_tracepoint_markers_by_strid (const char *id) override; + /* Linux ptrace targets are shareable. */ + bool is_shareable () override final + { return true; } + /* Methods that are meant to overridden by the concrete arch-specific target instance. */ diff --git a/gdb/minsyms.c b/gdb/minsyms.c index c4a0fa8..d3a8d67 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -1390,6 +1390,88 @@ build_minimal_symbol_hash_tables } } +/* gdb::parallel_for_each worker to compute minimal symbol names and hashes. */ + +class minimal_symbol_install_worker +{ +public: + minimal_symbol_install_worker + (minimal_symbol *msymbols, + gdb::array_view<computed_hash_values> hash_values, + objfile_per_bfd_storage *per_bfd +#if CXX_STD_THREAD + , std::mutex &demangled_mutex +#endif + ) + : m_time_it ("minsym install worker"), + m_msymbols (msymbols), + m_hash_values (hash_values), + m_per_bfd (per_bfd) +#if CXX_STD_THREAD + , m_demangled_mutex (demangled_mutex) +#endif + {} + + void operator() (iterator_range<minimal_symbol *> msym_range) noexcept + { + for (minimal_symbol &msym : msym_range) + { + size_t idx = &msym - m_msymbols; + m_hash_values[idx].name_length = strlen (msym.linkage_name ()); + + if (!msym.name_set) + { + /* This will be freed later, by compute_and_set_names. */ + gdb::unique_xmalloc_ptr<char> demangled_name + = symbol_find_demangled_name (&msym, msym.linkage_name ()); + msym.set_demangled_name (demangled_name.release (), + &m_per_bfd->storage_obstack); + msym.name_set = 1; + } + + /* This mangled_name_hash computation has to be outside of + the name_set check, or compute_and_set_names below will + be called with an invalid hash value. */ + m_hash_values[idx].mangled_name_hash + = fast_hash (msym.linkage_name (), m_hash_values[idx].name_length); + m_hash_values[idx].minsym_hash = msymbol_hash (msym.linkage_name ()); + + /* We only use this hash code if the search name differs + from the linkage name. See the code in + build_minimal_symbol_hash_tables. */ + if (msym.search_name () != msym.linkage_name ()) + m_hash_values[idx].minsym_demangled_hash + = search_name_hash (msym.language (), msym.search_name ()); + } + + { + /* To limit how long we hold the lock, we only acquire it here + and not while we demangle the names above. */ +#if CXX_STD_THREAD + std::lock_guard<std::mutex> guard (m_demangled_mutex); +#endif + for (minimal_symbol &msym : msym_range) + { + size_t idx = &msym - m_msymbols; + std::string_view name (msym.linkage_name (), + m_hash_values[idx].name_length); + hashval_t hashval = m_hash_values[idx].mangled_name_hash; + + msym.compute_and_set_names (name, false, m_per_bfd, hashval); + } + } + } + +private: + scoped_time_it m_time_it; + minimal_symbol *m_msymbols; + gdb::array_view<computed_hash_values> m_hash_values; + objfile_per_bfd_storage *m_per_bfd; +#if CXX_STD_THREAD + std::mutex &m_demangled_mutex; +#endif +}; + /* Add the minimal symbols in the existing bunches to the objfile's official minimal symbol table. In most cases there is no minimal symbol table yet for this objfile, and the existing bunches are used to create one. Once @@ -1476,59 +1558,15 @@ minimal_symbol_reader::install () std::vector<computed_hash_values> hash_values (mcount); msymbols = m_objfile->per_bfd->msymbols.get (); - /* Arbitrarily require at least 10 elements in a thread. */ - gdb::parallel_for_each<10> (&msymbols[0], &msymbols[mcount], - [&] (minimal_symbol *start, minimal_symbol *end) - { - scoped_time_it time_it ("minsyms install worker"); - - for (minimal_symbol *msym = start; msym < end; ++msym) - { - size_t idx = msym - msymbols; - hash_values[idx].name_length = strlen (msym->linkage_name ()); - if (!msym->name_set) - { - /* This will be freed later, by compute_and_set_names. */ - gdb::unique_xmalloc_ptr<char> demangled_name - = symbol_find_demangled_name (msym, msym->linkage_name ()); - msym->set_demangled_name - (demangled_name.release (), - &m_objfile->per_bfd->storage_obstack); - msym->name_set = 1; - } - /* This mangled_name_hash computation has to be outside of - the name_set check, or compute_and_set_names below will - be called with an invalid hash value. */ - hash_values[idx].mangled_name_hash - = fast_hash (msym->linkage_name (), - hash_values[idx].name_length); - hash_values[idx].minsym_hash - = msymbol_hash (msym->linkage_name ()); - /* We only use this hash code if the search name differs - from the linkage name. See the code in - build_minimal_symbol_hash_tables. */ - if (msym->search_name () != msym->linkage_name ()) - hash_values[idx].minsym_demangled_hash - = search_name_hash (msym->language (), msym->search_name ()); - } - { - /* To limit how long we hold the lock, we only acquire it here - and not while we demangle the names above. */ + + gdb::parallel_for_each<1000, minimal_symbol *, minimal_symbol_install_worker> + (&msymbols[0], &msymbols[mcount], msymbols, + gdb::array_view<computed_hash_values> (hash_values), + m_objfile->per_bfd #if CXX_STD_THREAD - std::lock_guard<std::mutex> guard (demangled_mutex); + , demangled_mutex #endif - for (minimal_symbol *msym = start; msym < end; ++msym) - { - size_t idx = msym - msymbols; - msym->compute_and_set_names - (std::string_view (msym->linkage_name (), - hash_values[idx].name_length), - false, - m_objfile->per_bfd, - hash_values[idx].mangled_name_hash); - } - } - }); + ); build_minimal_symbol_hash_tables (m_objfile, hash_values); } diff --git a/gdb/process-stratum-target.h b/gdb/process-stratum-target.h index 2545d48..b646c11 100644 --- a/gdb/process-stratum-target.h +++ b/gdb/process-stratum-target.h @@ -79,6 +79,11 @@ public: target_waitkind fork_kind, bool follow_child, bool detach_on_fork) override; + /* Assume sub-classes are not shareable. Those that are need to mark + themselves as such. */ + bool is_shareable () override + { return false; } + /* True if any thread is, or may be executing. We need to track this separately because until we fully sync the thread list, we won't know whether the target is fully stopped, even if we see diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c index a2c5939..65753fd 100644 --- a/gdb/python/py-type.c +++ b/gdb/python/py-type.c @@ -842,11 +842,11 @@ typy_lookup_typename (const char *type_name, const struct block *block) try { if (startswith (type_name, "struct ")) - type = lookup_struct (type_name + 7, NULL); + type = lookup_struct (type_name + 7, block); else if (startswith (type_name, "union ")) - type = lookup_union (type_name + 6, NULL); + type = lookup_union (type_name + 6, block); else if (startswith (type_name, "enum ")) - type = lookup_enum (type_name + 5, NULL); + type = lookup_enum (type_name + 5, block); else type = lookup_typename (current_language, type_name, block, 0); diff --git a/gdb/remote.c b/gdb/remote.c index 9fc8712..5ee0d77 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -1167,6 +1167,12 @@ public: bool is_address_tagged (gdbarch *gdbarch, CORE_ADDR address) override; + /* A remote target can be shared if it is able to create new inferiors. */ + bool is_shareable () override final + { + return true; + } + public: /* Remote specific methods. */ void remote_download_command_source (int num, ULONGEST addr, diff --git a/gdb/target.c b/gdb/target.c index f7c43f6..d12df7d 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -1186,6 +1186,14 @@ target_stack::push (target_ops *t) if (m_stack[stratum].get () != nullptr) unpush (m_stack[stratum].get ()); + /* If this target can't be shared, then check that the target doesn't + already appear on some other target stack. */ + if (!t->is_shareable ()) + for (inferior *inf : all_inferiors ()) + if (inf->target_is_pushed (t)) + internal_error (_("Attempt to push unshareable target: %s."), + t->shortname ()); + /* Now add the new one. */ m_stack[stratum] = std::move (ref); diff --git a/gdb/target.h b/gdb/target.h index 365e894..3525a43 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -1399,6 +1399,23 @@ struct target_ops virtual void displaced_step_restore_all_in_ptid (inferior *parent_inf, ptid_t child_ptid) TARGET_DEFAULT_FUNC (default_displaced_step_restore_all_in_ptid); + + /* Return true if an instance of this target can appear on multiple + target stacks, or false if an instance of this target can only + appear on a single target stack. + + Returning false doesn't mean that GDB can't create multiple + instances of this target, just that each instance will only be used + by a single inferior. + + The default return value for this function is true indicating + targets can be shared. The only non-shareable targets are some of + the process_stratum_target sub-classes, as such, this default is + changed in process_stratum_target to return false, then those + process_stratum_target sub-classes that are shareable set this to + true. */ + virtual bool is_shareable () + { return true; } }; /* Deleter for std::unique_ptr. See comments in diff --git a/gdb/tclint.toml b/gdb/tclint.toml index 47c3ce4..1d77b08 100644 --- a/gdb/tclint.toml +++ b/gdb/tclint.toml @@ -13,21 +13,59 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -# Configuration file for tclint ( https://github.com/nmoroze/tclint ). +# Configuration file for the tclint and tclfmt tools from the tclint package +# ( https://github.com/nmoroze/tclint ). +# +# Eventually we'd like to move these settings to pyproject.toml, but currently +# that's not possible. See this tclint issue ( +# https://github.com/nmoroze/tclint/issues/120 ). +# +# Issues related to using the tclint tool in the gdb testsuite: +# - tclint does not support expect. +# https://github.com/nmoroze/tclint/issues/118 +# - tclint doesn't inspect code passed as arguments to gdb testsuite specific +# commands like with_test_prefix. +# https://github.com/nmoroze/tclint/issues/121 +# - tclint ignores splat ({*}$foo) when checking number of arguments +# https://github.com/nmoroze/tclint/issues/122 exclude = [ # TODO: "gdb/testsuite/boards", "gdb/testsuite/config", -"gdb/testsuite/lib", -"gdb/testsuite/gdb.arch", -"gdb/testsuite/gdb.base", -"gdb/testsuite/gdb.cp", -"gdb/testsuite/gdb.dwarf2", -"gdb/testsuite/gdb.mi", -"gdb/testsuite/gdb.trace", +"gdb/testsuite/lib/aarch64.exp", +"gdb/testsuite/lib/aarch64-scalable.exp", +"gdb/testsuite/lib/ada.exp", +"gdb/testsuite/lib/cache.exp", +"gdb/testsuite/lib/check-test-names.exp", +"gdb/testsuite/lib/completion-support.exp", +"gdb/testsuite/lib/cp-support.exp", +"gdb/testsuite/lib/debuginfod-support.exp", +"gdb/testsuite/lib/d-support.exp", +"gdb/testsuite/lib/dtrace.exp", +"gdb/testsuite/lib/dwarf.exp", +"gdb/testsuite/lib/fortran.exp", +"gdb/testsuite/lib/future.exp", +"gdb/testsuite/lib/gdb.exp", +"gdb/testsuite/lib/gdb-guile.exp", +"gdb/testsuite/lib/gdbreplay-support.exp", +"gdb/testsuite/lib/gdbserver-support.exp", +"gdb/testsuite/lib/gdb-utils.exp", +"gdb/testsuite/lib/gen-perf-test.exp", +"gdb/testsuite/lib/go.exp", +"gdb/testsuite/lib/jit-elf-helpers.exp", +"gdb/testsuite/lib/mi-support.exp", +"gdb/testsuite/lib/objc.exp", +"gdb/testsuite/lib/pascal.exp", +"gdb/testsuite/lib/perftest.exp", +"gdb/testsuite/lib/prelink-support.exp", +"gdb/testsuite/lib/prompt.exp", +"gdb/testsuite/lib/rust-support.exp", +"gdb/testsuite/lib/selftest-support.exp", +"gdb/testsuite/lib/trace-support.exp", # IGNORE (document reason in trailing comment): "gdb/testsuite/gdb.stabs", # To be removed. +"gdb/testsuite/lib/ton.tcl", # Imported. ] # A maximum line length of 80 is current policy, but it hasn't been too diff --git a/gdb/testsuite/gdb.ada/big_packed_array.exp b/gdb/testsuite/gdb.ada/big_packed_array.exp index b1566af..aa328a5 100644 --- a/gdb/testsuite/gdb.ada/big_packed_array.exp +++ b/gdb/testsuite/gdb.ada/big_packed_array.exp @@ -38,7 +38,7 @@ foreach_gnat_encoding scenario flags {all minimal} { gdb_test "print good" \ "= \\(false <repeats 196 times>\\)" \ - set have_xfail [expr $old_gcc && [string equal "$scenario" "minimal"]] + set have_xfail [expr {$old_gcc && [string equal "$scenario" "minimal"]}] set re "= \\(false <repeats 196 times>\\)" set re_xfail "= \\(0 => 0 <repeats 25 times>\\)" diff --git a/gdb/testsuite/gdb.ada/finish-var-size.exp b/gdb/testsuite/gdb.ada/finish-var-size.exp index 6365c95..895a248 100644 --- a/gdb/testsuite/gdb.ada/finish-var-size.exp +++ b/gdb/testsuite/gdb.ada/finish-var-size.exp @@ -18,7 +18,7 @@ load_lib "ada.exp" require allow_ada_tests # GCC 12 has the needed fix. -require {expr [gcc_major_version] >= 12} +require {expr {[gcc_major_version] >= 12}} standard_ada_testfile p diff --git a/gdb/testsuite/gdb.ada/huge.exp b/gdb/testsuite/gdb.ada/huge.exp index fa94fa0..7bf7003 100644 --- a/gdb/testsuite/gdb.ada/huge.exp +++ b/gdb/testsuite/gdb.ada/huge.exp @@ -46,7 +46,7 @@ for { set size $max } { $size >= $min } { set size [expr {$size / 2}] } { set compilation_succeeded 1 break } -require {expr $compilation_succeeded} +require {expr {$compilation_succeeded}} foreach_with_prefix varname {Arr Packed_Arr} { clean_restart ${testfile} diff --git a/gdb/testsuite/gdb.ada/import.exp b/gdb/testsuite/gdb.ada/import.exp index 51ce7fa..d7d11e1 100644 --- a/gdb/testsuite/gdb.ada/import.exp +++ b/gdb/testsuite/gdb.ada/import.exp @@ -21,7 +21,7 @@ require allow_ada_tests # declarations only") is required. The commit makes sure that file-scope # function and variable declarations are emitted in dwarf. This allows the # description of imported entries, making them available to the debugger. -require {expr [gcc_major_version] >= 8} +require {expr {[gcc_major_version] >= 8}} standard_ada_testfile prog diff --git a/gdb/testsuite/gdb.ada/uninitialized-variable-record.exp b/gdb/testsuite/gdb.ada/uninitialized-variable-record.exp index 0e198cb..4366b20 100644 --- a/gdb/testsuite/gdb.ada/uninitialized-variable-record.exp +++ b/gdb/testsuite/gdb.ada/uninitialized-variable-record.exp @@ -91,7 +91,7 @@ for { set i 0 } { $i < 256 } { incr i } { continue } - if { [expr $size > $offset_d] } { + if {$size > $offset_d} { # Field d fits in the size. continue } @@ -101,7 +101,7 @@ for { set i 0 } { $i < 256 } { incr i } { } } -require {expr $interesting_discriminator != -1} +require {expr {$interesting_discriminator != -1}} foreach lang [gdb_supported_languages] { with_test_prefix $lang { diff --git a/gdb/testsuite/gdb.ada/verylong.exp b/gdb/testsuite/gdb.ada/verylong.exp index de5fd04..da1ce79 100644 --- a/gdb/testsuite/gdb.ada/verylong.exp +++ b/gdb/testsuite/gdb.ada/verylong.exp @@ -41,7 +41,7 @@ gdb_test_multiple "ptype Long_Long_Long_Integer" "" { } } -require {expr $lll_int_size == 8 || $lll_int_size == 16} +require {expr {$lll_int_size == 8 || $lll_int_size == 16}} gdb_test "print x" " = $max" gdb_test "print x / 2" " = [expr {$max / 2}]" diff --git a/gdb/testsuite/gdb.arch/aarch64-atomic-inst.exp b/gdb/testsuite/gdb.arch/aarch64-atomic-inst.exp index 091d1f8..fa80a9c 100644 --- a/gdb/testsuite/gdb.arch/aarch64-atomic-inst.exp +++ b/gdb/testsuite/gdb.arch/aarch64-atomic-inst.exp @@ -25,7 +25,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/aarch64-fp.exp b/gdb/testsuite/gdb.arch/aarch64-fp.exp index 0c24939..ab4988c 100644 --- a/gdb/testsuite/gdb.arch/aarch64-fp.exp +++ b/gdb/testsuite/gdb.arch/aarch64-fp.exp @@ -25,7 +25,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/aarch64-gcs-core.exp b/gdb/testsuite/gdb.arch/aarch64-gcs-core.exp index 9c4b7d5..66990eb 100644 --- a/gdb/testsuite/gdb.arch/aarch64-gcs-core.exp +++ b/gdb/testsuite/gdb.arch/aarch64-gcs-core.exp @@ -26,7 +26,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } { set linespec ${srcfile}:[gdb_get_line_number "Break here"] -if ![runto $linespec] { +if {![runto $linespec]} { return } @@ -40,14 +40,14 @@ proc check_core_file {core_filename saved_gcspr} { global decimal hex # Load the core file. - if [gdb_test "core $core_filename" \ - [multi_line \ - "Core was generated by .*\\." \ - "Program terminated with signal SIGSEGV, Segmentation fault" \ - "Guarded Control Stack error\\." \ - "#0 function \\(gcspr=$hex\\) at .*aarch64-gcs-core.c:$decimal" \ - "$decimal.*__asm__ volatile \\(\"ret\\\\n\"\\);"] \ - "load core file"] { + if {[gdb_test "core $core_filename" \ + [multi_line \ + "Core was generated by .*\\." \ + "Program terminated with signal SIGSEGV, Segmentation fault" \ + "Guarded Control Stack error\\." \ + "#0 function \\(gcspr=$hex\\) at .*aarch64-gcs-core.c:$decimal" \ + "$decimal.*__asm__ volatile \\(\"ret\\\\n\"\\);"] \ + "load core file"]} { return -1 } @@ -74,7 +74,7 @@ if {$core_generated} { } } -if ![gcore_cmd_available] { +if {![gcore_cmd_available]} { unsupported "target does not support gcore command." return } @@ -82,7 +82,7 @@ if ![gcore_cmd_available] { clean_restart gdb_load $binfile -if ![runto $linespec] { +if {![runto $linespec]} { return } diff --git a/gdb/testsuite/gdb.arch/aarch64-gcs-disp-step.exp b/gdb/testsuite/gdb.arch/aarch64-gcs-disp-step.exp index 2359d96..e625251 100644 --- a/gdb/testsuite/gdb.arch/aarch64-gcs-disp-step.exp +++ b/gdb/testsuite/gdb.arch/aarch64-gcs-disp-step.exp @@ -23,7 +23,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { return } -if ![runto_main] { +if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.arch/aarch64-gcs-return.exp b/gdb/testsuite/gdb.arch/aarch64-gcs-return.exp index 6f695da..7e531e8 100644 --- a/gdb/testsuite/gdb.arch/aarch64-gcs-return.exp +++ b/gdb/testsuite/gdb.arch/aarch64-gcs-return.exp @@ -31,7 +31,7 @@ set begin_line [gdb_get_line_number "Break begin"] set call1_line [gdb_get_line_number "Break call1"] set call2_line [gdb_get_line_number "Break call2"] -if ![runto ${begin_line}] { +if {![runto ${begin_line}]} { return } @@ -39,7 +39,7 @@ proc restart_and_run_infcall_call2 {} { global binfile call2_line clean_restart gdb_load $binfile - if ![runto_main] { + if {![runto_main]} { return } set inside_infcall_str "The program being debugged stopped while in a function called from GDB" @@ -82,7 +82,7 @@ with_test_prefix "test return 'above' an inferior call" { clean_restart gdb_load $binfile -if ![runto ${begin_line}] { +if {![runto ${begin_line}]} { return } @@ -114,7 +114,7 @@ with_test_prefix "test return from current frame" { clean_restart gdb_load $binfile -if ![runto_main] { +if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.arch/aarch64-gcs-wrong-tdesc.exp b/gdb/testsuite/gdb.arch/aarch64-gcs-wrong-tdesc.exp index f0508cd..ba7741f 100644 --- a/gdb/testsuite/gdb.arch/aarch64-gcs-wrong-tdesc.exp +++ b/gdb/testsuite/gdb.arch/aarch64-gcs-wrong-tdesc.exp @@ -36,7 +36,7 @@ if {[gdb_protocol_is_remote]} { return } -if ![runto_main] { +if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.arch/aarch64-gcs.exp b/gdb/testsuite/gdb.arch/aarch64-gcs.exp index b09e010..63c18a1 100644 --- a/gdb/testsuite/gdb.arch/aarch64-gcs.exp +++ b/gdb/testsuite/gdb.arch/aarch64-gcs.exp @@ -25,7 +25,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { set linespec ${srcfile}:[gdb_get_line_number "Break here"] -if ![runto ${linespec}] { +if {![runto ${linespec}]} { return } @@ -80,7 +80,7 @@ gdb_test "print \$gcspr == \$gcspr_in_main - 16" ". = 1" \ # Test writing to GCSPR. clean_restart gdb_load $binfile -if ![runto normal_function0] { +if {![runto normal_function0]} { return } diff --git a/gdb/testsuite/gdb.arch/aarch64-mops-single-step.exp b/gdb/testsuite/gdb.arch/aarch64-mops-single-step.exp index 4cdd985..3891fcc 100644 --- a/gdb/testsuite/gdb.arch/aarch64-mops-single-step.exp +++ b/gdb/testsuite/gdb.arch/aarch64-mops-single-step.exp @@ -71,7 +71,7 @@ proc step_through_sequence { prefix } { return 0 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/aarch64-mops-watchpoint.exp b/gdb/testsuite/gdb.arch/aarch64-mops-watchpoint.exp index 70a49b5..20d2513 100644 --- a/gdb/testsuite/gdb.arch/aarch64-mops-watchpoint.exp +++ b/gdb/testsuite/gdb.arch/aarch64-mops-watchpoint.exp @@ -28,7 +28,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ } set linespec ${srcfile}:[gdb_get_line_number "Break here"] -if ![runto ${linespec}] { +if {![runto ${linespec}]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/aarch64-mte-core.exp b/gdb/testsuite/gdb.arch/aarch64-mte-core.exp index 7da836e..849780a 100644 --- a/gdb/testsuite/gdb.arch/aarch64-mte-core.exp +++ b/gdb/testsuite/gdb.arch/aarch64-mte-core.exp @@ -67,14 +67,14 @@ proc test_mte_core_file { core_filename mode } { # has the expected value, that means the core file was generated correctly # and that GDB read the contents correctly. for {set i 0} {$i < $nmaps} {incr i} { - for {set offset 0} {$offset < $page_size} {set offset [expr $offset + 16]} { + for {set offset 0} {$offset < $page_size} {set offset [expr {$offset + 16}]} { set hex_tag [format "%x" $tag] gdb_test "memory-tag print-allocation-tag mmap_pointers\[$i\] + $offset" \ "= 0x$hex_tag" \ "mmap_ponters\[$i\] + $offset contains expected tag" # Update the expected tag. The test writes tags in sequential # order. - set tag [expr ($tag + 1) % 16] + set tag [expr {($tag + 1) % 16}] } } } @@ -98,7 +98,7 @@ proc test_mode { mode } { } set binfile [standard_output_file ${executable}] - if ![runto_main] { + if {![runto_main]} { untested "could not run to main" return -1 } diff --git a/gdb/testsuite/gdb.arch/aarch64-mte.exp b/gdb/testsuite/gdb.arch/aarch64-mte.exp index 8bb5814..a228755 100644 --- a/gdb/testsuite/gdb.arch/aarch64-mte.exp +++ b/gdb/testsuite/gdb.arch/aarch64-mte.exp @@ -50,7 +50,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } @@ -63,7 +63,7 @@ if {![supports_memtag]} { gdb_breakpoint "access_memory" -if [gdb_continue "access_memory"] { +if {[gdb_continue "access_memory"]} { return -1 } @@ -104,7 +104,7 @@ with_test_prefix "literals" { set addr_tagged [get_tagged_ptr $i ${tagged_ptr_addr}] } - set tag_hexnz [get_hex_tag [expr $i % 16]] + set tag_hexnz [get_hex_tag [expr {$i % 16}]] gdb_test "memory-tag print-logical-tag ${addr_tagged}" \ " = 0x${tag_hexnz}" \ "print-logical-tag with tag ${i}" @@ -124,7 +124,7 @@ with_test_prefix "literals" { $atag_msg \ "set-allocation-tag with tag ${i}" - set tag_hexnz [get_hex_tag [expr $i % 16]] + set tag_hexnz [get_hex_tag [expr {$i % 16}]] gdb_test "memory-tag print-allocation-tag ${tagged_ptr_addr}" " = 0x${tag_hexnz}" \ "print-allocation-tag with tag ${i}" } @@ -139,7 +139,7 @@ with_test_prefix "literals" { $atag_msg \ "set-allocation-tag with tag ${i}" - set atag_hexnz [get_hex_tag [expr $i % 16]] + set atag_hexnz [get_hex_tag [expr {$i % 16}]] # Validate that the logical tag matches the allocation tag. with_test_prefix "tag ${i}" { @@ -152,14 +152,14 @@ with_test_prefix "literals" { # Get a pointer with the logical tag that does not match the # allocation tag. - set ltag [expr $i + 1] + set ltag [expr {$i + 1}] with_test_prefix "fetch mismatch tag ${i}" { set addr_tagged [get_tagged_ptr $ltag ${tagged_ptr_addr}] } # Validate that the logical tag does not match the allocation # tag. - set ltag_hexnz [get_hex_tag [expr [expr $i + 1]% 16]] + set ltag_hexnz [get_hex_tag [expr {($i + 1) % 16}]] gdb_test "memory-tag check ${addr_tagged}" \ "Logical tag \\(0x${ltag_hexnz}\\) does not match the allocation tag \\(0x${atag_hexnz}\\) for address $hex\." \ "check mismatch with tag ${i}" @@ -187,7 +187,7 @@ with_test_prefix "symbolic" { "update value of symbol ${tagged_ptr_symbol}" } - set tag_hexnz [get_hex_tag [expr $i % 16]] + set tag_hexnz [get_hex_tag [expr {$i % 16}]] gdb_test "memory-tag print-logical-tag ${tagged_ptr_symbol}" \ " = 0x${tag_hexnz}" \ "print-logical-tag with tag ${i}" @@ -211,7 +211,7 @@ with_test_prefix "symbolic" { $atag_msg \ "set-allocation-tag with tag ${i}" - set tag_hexnz [get_hex_tag [expr $i % 16]] + set tag_hexnz [get_hex_tag [expr {$i % 16}]] gdb_test "memory-tag print-allocation-tag ${tagged_ptr_symbol}" \ " = 0x${tag_hexnz}" \ "print-allocation-tag with tag ${i}" @@ -227,7 +227,7 @@ with_test_prefix "symbolic" { $atag_msg \ "set-allocation-tag with tag ${i}" - set atag_hexnz [get_hex_tag [expr $i % 16]] + set atag_hexnz [get_hex_tag [expr {$i % 16}]] # Validate that the logical tag matches the allocation tag. with_test_prefix "tag ${i}" { @@ -245,7 +245,7 @@ with_test_prefix "symbolic" { # Get a pointer with the logical tag that does not match the # allocation tag. - set ltag [expr $i + 1] + set ltag [expr {$i + 1}] with_test_prefix "fetch mismatch tag ${i}" { set addr_tagged [get_tagged_ptr $ltag ${tagged_ptr_addr}] } @@ -257,7 +257,7 @@ with_test_prefix "symbolic" { # Validate that the logical tag does not match the allocation # tag. - set ltag_hexnz [get_hex_tag [expr [expr $i + 1]% 16]] + set ltag_hexnz [get_hex_tag [expr {($i + 1) % 16}]] gdb_test "memory-tag check ${tagged_ptr_symbol}" \ "Logical tag \\(0x${ltag_hexnz}\\) does not match the allocation tag \\(0x${atag_hexnz}\\) for address $hex\." \ "check mismatch with tag ${i}" @@ -281,7 +281,7 @@ with_test_prefix "print command" { return -1 } - set atag [expr [expr $ltag + 1] % 16] + set atag [expr {($ltag + 1) % 16}] set atag_hexnn [get_tag_nn $atag] gdb_test "memory-tag set-allocation-tag ${tagged_ptr_symbol} 1 ${atag_hexnn}" \ @@ -334,13 +334,13 @@ gdb_test "continue" \ # Restart to execute the async tag fault test. with_test_prefix "async" { - if ![runto_main] { + if {![runto_main]} { return -1 } gdb_breakpoint "access_memory" - if [gdb_continue "access_memory"] { + if {[gdb_continue "access_memory"]} { fail "could not run to tagged memory test function" return -1 } diff --git a/gdb/testsuite/gdb.arch/aarch64-non-address-bits.exp b/gdb/testsuite/gdb.arch/aarch64-non-address-bits.exp index 0f90da8..e3023d1 100644 --- a/gdb/testsuite/gdb.arch/aarch64-non-address-bits.exp +++ b/gdb/testsuite/gdb.arch/aarch64-non-address-bits.exp @@ -26,7 +26,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/aarch64-pauth.exp b/gdb/testsuite/gdb.arch/aarch64-pauth.exp index 72cefa1..89193ce 100644 --- a/gdb/testsuite/gdb.arch/aarch64-pauth.exp +++ b/gdb/testsuite/gdb.arch/aarch64-pauth.exp @@ -45,7 +45,7 @@ if {!$compilation_ok} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/aarch64-prologue.exp b/gdb/testsuite/gdb.arch/aarch64-prologue.exp index f782daa..2e0d05d 100644 --- a/gdb/testsuite/gdb.arch/aarch64-prologue.exp +++ b/gdb/testsuite/gdb.arch/aarch64-prologue.exp @@ -22,7 +22,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile {nodebug}]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/aarch64-sighandler-regs.exp b/gdb/testsuite/gdb.arch/aarch64-sighandler-regs.exp index f8039d4..cce7376 100644 --- a/gdb/testsuite/gdb.arch/aarch64-sighandler-regs.exp +++ b/gdb/testsuite/gdb.arch/aarch64-sighandler-regs.exp @@ -32,7 +32,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} ${compile_f return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } @@ -91,7 +91,7 @@ gdb_breakpoint [gdb_get_line_number "exit(0)"] gdb_continue_to_breakpoint "exit" ".*exit.*" set handlerframe [get_current_frame_number] -set mainframe [expr $handlerframe + 2] +set mainframe [expr {$handlerframe + 2}] # Check register values diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-core.exp.tcl b/gdb/testsuite/gdb.arch/aarch64-sme-core.exp.tcl index 64cfd54..b57ff73 100644 --- a/gdb/testsuite/gdb.arch/aarch64-sme-core.exp.tcl +++ b/gdb/testsuite/gdb.arch/aarch64-sme-core.exp.tcl @@ -25,13 +25,13 @@ load_lib aarch64-scalable.exp # proc check_sme_core_file { core_filename state vl svl } { # Load the core file. - if [gdb_test "core $core_filename" \ - [multi_line \ - "Core was generated by.*\." \ - "Program terminated with signal SIGSEGV, Segmentation fault\." \ - "#0 ${::hex} in main \\(.*\\) at .*" \ + if {[gdb_test "core $core_filename" \ + [multi_line \ + "Core was generated by.*\." \ + "Program terminated with signal SIGSEGV, Segmentation fault\." \ + "#0 ${::hex} in main \\(.*\\) at .*" \ ".*p = 0xff;.* crash point .*"] \ - "load core file"] { + "load core file"]} { untested "failed to generate core file" return -1 } @@ -169,7 +169,7 @@ proc test_sme_core_file { id_start id_end } { return -1 } - if ![runto_main] { + if {![runto_main]} { untested "could not run to main" return -1 } diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-regs-available.exp.tcl b/gdb/testsuite/gdb.arch/aarch64-sme-regs-available.exp.tcl index 4dc106e..de17e4e 100644 --- a/gdb/testsuite/gdb.arch/aarch64-sme-regs-available.exp.tcl +++ b/gdb/testsuite/gdb.arch/aarch64-sme-regs-available.exp.tcl @@ -34,11 +34,11 @@ require !gdb_protocol_is_remote # proc check_regs { mode vl svl } { # Check VG to make sure it is correct - set expected_vg [expr $vl / 8] + set expected_vg [expr {$vl / 8}] gdb_test "print \$vg" "= ${expected_vg}" # Check SVG to make sure it is correct - set expected_svg [expr $svl / 8] + set expected_svg [expr {$svl / 8}] gdb_test "print \$svg" "= ${expected_svg}" # If svl is adjusted by prctl, we will have ZA enabled. If gdb is @@ -50,13 +50,13 @@ proc check_regs { mode vl svl } { } # Check SVCR. - if [gdb_test "print \$svcr" $za_state "svcr before assignments" ] { + if {[gdb_test "print \$svcr" $za_state "svcr before assignments" ]} { fail "incorrect za state" return -1 } # Check the size of ZA. - set expected_za_size [expr $svl * $svl] + set expected_za_size [expr {$svl * $svl}] gdb_test "print sizeof \$za" " = $expected_za_size" # Check the size of Z0. @@ -69,7 +69,7 @@ proc check_regs { mode vl svl } { # Exercise reading/writing from/to the tile pseudo-registers. set last_tile 1 - set expected_size [expr $svl * $svl] + set expected_size [expr {$svl * $svl}] set tile_svl $svl set za_state "= \\\[ ZA \\\]" foreach_with_prefix granularity {"b" "h" "s" "d" "q"} { @@ -83,7 +83,7 @@ proc check_regs { mode vl svl } { initialize_2d_array $register_name 255 $tile_svl $tile_svl # Make sure we have ZA state. - if [gdb_test "print \$svcr" $za_state "svcr after assignment to ${register_name}" ] { + if {[gdb_test "print \$svcr" $za_state "svcr after assignment to ${register_name}" ]} { fail "incorrect za state" return -1 } @@ -91,9 +91,9 @@ proc check_regs { mode vl svl } { set pattern [string_to_regexp [2d_array_value_pattern 255 $tile_svl $tile_svl]] gdb_test "print $register_name" " = $pattern" "read back from $register_name" } - set last_tile [expr $last_tile * 2] - set expected_size [expr $expected_size / 2] - set tile_svl [expr $tile_svl / 2] + set last_tile [expr {$last_tile * 2}] + set expected_size [expr {$expected_size / 2}] + set tile_svl [expr {$tile_svl / 2}] } # Exercise reading/writing from/to the tile slice pseudo-registers. @@ -114,7 +114,7 @@ proc check_regs { mode vl svl } { initialize_1d_array $register_name 255 $num_elements # Make sure we have ZA state. - if [gdb_test "print \$svcr" $za_state "svcr after assignment of ${register_name}" ] { + if {[gdb_test "print \$svcr" $za_state "svcr after assignment of ${register_name}" ]} { fail "incorrect za state" return -1 } @@ -124,13 +124,13 @@ proc check_regs { mode vl svl } { } } } - set last_tile [expr $last_tile * 2] - set last_slice [expr ($last_slice / 2)] - set num_elements [expr $num_elements / 2] + set last_tile [expr {$last_tile * 2}] + set last_slice [expr {($last_slice / 2)}] + set num_elements [expr {$num_elements / 2}] } # Exercise reading/writing from/to SME2 registers. - if [is_sme2_available] { + if {[is_sme2_available]} { # The target supports SME2. set zt_size 64 gdb_test "print sizeof \$zt0" " = $zt_size" @@ -163,7 +163,7 @@ proc test_sme_registers_available { id_start id_end } { } set binfile [standard_output_file ${executable}] - if ![runto_main] { + if {![runto_main]} { untested "could not run to main" return -1 } @@ -245,8 +245,8 @@ proc test_sme_registers_available { id_start id_end } { gdb_continue_to_breakpoint $non_prctl_breakpoint # Adjust svl via gdb. - set vg_value [expr $vl / 8] - set svg_value [expr $svl / 8] + set vg_value [expr {$vl / 8}] + set svg_value [expr {$svl / 8}] gdb_test_no_output "set \$vg = ${vg_value}" gdb_test_no_output "set \$svg = ${svg_value}" diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe.exp.tcl b/gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe.exp.tcl index 403da75..4f37019 100644 --- a/gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe.exp.tcl +++ b/gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe.exp.tcl @@ -42,7 +42,7 @@ proc test_sme_registers_sigframe { id_start id_end } { } set binfile [standard_output_file ${executable}] - if ![runto_main] { + if {![runto_main]} { untested "could not run to main" return -1 } @@ -83,16 +83,16 @@ proc test_sme_registers_sigframe { id_start id_end } { } # Run the program until it has adjusted the svl. - if [gdb_continue_to_breakpoint $sigill_breakpoint] { + if {[gdb_continue_to_breakpoint $sigill_breakpoint]} { return -1 } # Check SVG to make sure it is correct - set expected_svg [expr $svl / 8] + set expected_svg [expr {$svl / 8}] gdb_test "print \$svg" "= ${expected_svg}" # Check the size of ZA. - set expected_za_size [expr $svl * $svl] + set expected_za_size [expr {$svl * $svl}] gdb_test "print sizeof \$za" " = $expected_za_size" # Check the value of SVCR. @@ -134,14 +134,14 @@ proc test_sme_registers_sigframe { id_start id_end } { gdb_test_no_output "set \$tpidr2=0x0102030405060708" # Run to the illegal instruction. - if [gdb_test "continue" "Continuing\.\r\n\r\nProgram received signal SIGILL, Illegal instruction\..*in main.*"] { + if {[gdb_test "continue" "Continuing\.\r\n\r\nProgram received signal SIGILL, Illegal instruction\..*in main.*"]} { return } # Skip the illegal instruction. The signal handler will be called after we continue. gdb_test_no_output "set \$pc=\$pc+4" # Continue to the signal handler. - if [gdb_continue_to_breakpoint $handler_breakpoint] { + if {[gdb_continue_to_breakpoint $handler_breakpoint]} { return -1 } @@ -159,7 +159,7 @@ proc test_sme_registers_sigframe { id_start id_end } { } # Check the size of ZA in the signal frame. - set expected_za_size [expr $svl * $svl] + set expected_za_size [expr {$svl * $svl}] gdb_test "print sizeof \$za" " = $expected_za_size" "size of za in signal frame" # Check the value of SVCR in the signal frame. @@ -172,7 +172,7 @@ proc test_sme_registers_sigframe { id_start id_end } { gdb_test "print/x \$tpidr2" " = 0x102030405060708" "tpidr2 contents from signal frame" # Check the value of SME2 ZT0 in the signal frame. - if [is_sme2_available] { + if {[is_sme2_available]} { # The target supports SME2. set zt_size 64 gdb_test "print sizeof \$zt0" " = $zt_size" diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable.exp.tcl b/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable.exp.tcl index ba69b76..04e8b88 100644 --- a/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable.exp.tcl +++ b/gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable.exp.tcl @@ -26,21 +26,21 @@ load_lib aarch64-scalable.exp # proc_with_prefix check_regs { vl svl } { # Check VG to make sure it is correct - set expected_vg [expr $vl / 8] + set expected_vg [expr {$vl / 8}] gdb_test "print \$vg" "= ${expected_vg}" # Check SVG to make sure it is correct - set expected_svg [expr $svl / 8] + set expected_svg [expr {$svl / 8}] gdb_test "print \$svg" "= ${expected_svg}" # Make sure there is no SM or ZA state. - if [gdb_test "print \$svcr" "= \\\[ \\\]"] { + if {[gdb_test "print \$svcr" "= \\\[ \\\]"]} { fail "incorrect ZA state" return -1 } # Check the size of ZA. - set expected_za_size [expr $svl * $svl] + set expected_za_size [expr {$svl * $svl}] gdb_test "print sizeof \$za" " = $expected_za_size" # Check the size of Z0. @@ -69,15 +69,15 @@ proc_with_prefix check_regs { vl svl } { } } } - set last_tile [expr $last_tile * 2] - set last_slice [expr ($last_slice / 2)] - set elements [expr ($elements / 2)] + set last_tile [expr {$last_tile * 2}] + set last_slice [expr {($last_slice / 2)}] + set elements [expr {($elements / 2)}] } # Exercise reading/writing the tile pseudo-registers. set last_tile 1 set elements $svl - set expected_size [expr $svl * $svl] + set expected_size [expr {$svl * $svl}] foreach_with_prefix granularity {"b" "h" "s" "d" "q"} { set pattern [string_to_regexp [2d_array_value_pattern 0 $elements $elements]] for {set tile 0} {$tile < $last_tile} {incr tile} { @@ -86,13 +86,13 @@ proc_with_prefix check_regs { vl svl } { gdb_test "print sizeof ${register_name}" " = ${expected_size}" gdb_test "print ${register_name}" $pattern } - set last_tile [expr $last_tile * 2] - set expected_size [expr $expected_size / 2] - set elements [expr ($elements / 2)] + set last_tile [expr {$last_tile * 2}] + set expected_size [expr {$expected_size / 2}] + set elements [expr {($elements / 2)}] } # Exercise reading from SME2 registers. - if [is_sme2_available] { + if {[is_sme2_available]} { # The target supports SME2. set zt_size 64 gdb_test "print sizeof \$zt0" " = $zt_size" @@ -128,7 +128,7 @@ proc test_sme_registers_unavailable { id_start id_end } { return -1 } - if ![runto_main] { + if {![runto_main]} { untested "could not run to main" return -1 } @@ -207,8 +207,8 @@ proc test_sme_registers_unavailable { id_start id_end } { } # Adjust vg and svg. - set vg_value [expr $vl / 8] - set svg_value [expr $svl / 8] + set vg_value [expr {$vl / 8}] + set svg_value [expr {$svl / 8}] gdb_test_no_output "set \$vg = ${vg_value}" gdb_test_no_output "set \$svg = ${svg_value}" diff --git a/gdb/testsuite/gdb.arch/aarch64-sme-sanity.exp b/gdb/testsuite/gdb.arch/aarch64-sme-sanity.exp index c72e578..9664069 100644 --- a/gdb/testsuite/gdb.arch/aarch64-sme-sanity.exp +++ b/gdb/testsuite/gdb.arch/aarch64-sme-sanity.exp @@ -60,8 +60,8 @@ gdb_test_no_output "set print repeats 1" "adjust repeat count" # Fetch both the vector length and the streaming vector length the target # system is using. We do not force any vector lengths and do not change # it mid-execution. -set vl [expr [get_valueof "" "\$vg" "0" "fetch value of vl"] * 8] -set svl [expr [get_valueof "" "\$svg" "0" "fetch value of svl"] * 8] +set vl [expr {[get_valueof "" "\$vg" "0" "fetch value of vl"] * 8}] +set svl [expr {[get_valueof "" "\$svg" "0" "fetch value of svl"] * 8}] # Now we are at the point where we can start checking state and moving the # testcase forward. diff --git a/gdb/testsuite/gdb.arch/aarch64-sve-sigunwind.exp b/gdb/testsuite/gdb.arch/aarch64-sve-sigunwind.exp index 32340bb..7a47fc7 100644 --- a/gdb/testsuite/gdb.arch/aarch64-sve-sigunwind.exp +++ b/gdb/testsuite/gdb.arch/aarch64-sve-sigunwind.exp @@ -58,12 +58,12 @@ gdb_test "handle SIGUSR1 nostop" \ set linespec ${srcfile}:[gdb_get_line_number "Break here."] gdb_test_no_output "set args $first_vl $second_vl" -if ![runto ${linespec}] { +if {![runto ${linespec}]} { return } -set first_vg [expr $first_vl/8] -set second_vg [expr $second_vl/8] +set first_vg [expr {$first_vl/8}] +set second_vg [expr {$second_vl/8}] gdb_test "print \$vg" ". = $second_vg" "vg was changed" @@ -77,10 +77,10 @@ for {set row 0} {$row < 32} {incr row} { for {set row 0} {$row < 16} {incr row} { set register_name "\$p${row}" - gdb_test "print $register_name" ". = \\{(0, ){[expr $second_vl/8 - 1]}0\\}" \ + gdb_test "print $register_name" ". = \\{(0, ){[expr {$second_vl/8 - 1}]}0\\}" \ "$register_name contents in signal handler" } -gdb_test "print \$ffr" ". = \\{(255, ){[expr $second_vl/8 - 1]}255\\}" \ +gdb_test "print \$ffr" ". = \\{(255, ){[expr {$second_vl/8 - 1}]}255\\}" \ "ffr contents in signal handler" gdb_test "frame function main" \ @@ -99,8 +99,8 @@ for {set row 0} {$row < 32} {incr row} { for {set row 0} {$row < 16} {incr row} { set register_name "\$p${row}" - gdb_test "print $register_name" ". = \\{(1, ){[expr $first_vl/8 - 1]}1\\}" \ + gdb_test "print $register_name" ". = \\{(1, ){[expr {$first_vl/8 - 1}]}1\\}" \ "$register_name contents were correctly unwound" } -gdb_test "print \$ffr" ". = \\{(255, ){[expr $first_vl/8 - 1]}255\\}" \ +gdb_test "print \$ffr" ". = \\{(255, ){[expr {$first_vl/8 - 1}]}255\\}" \ "ffr contents were correctly unwound" diff --git a/gdb/testsuite/gdb.arch/aarch64-sve.exp b/gdb/testsuite/gdb.arch/aarch64-sve.exp index 34bcff2..6cdc30d 100644 --- a/gdb/testsuite/gdb.arch/aarch64-sve.exp +++ b/gdb/testsuite/gdb.arch/aarch64-sve.exp @@ -24,7 +24,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { set linespec ${srcfile}:[gdb_get_line_number "break here"] -if ![runto ${linespec}] { +if {![runto ${linespec}]} { return } @@ -59,7 +59,7 @@ proc get_register_value {register} { # The test executable halves the vector length in a loop, so loop along # to check it. -for {set i [get_register_value "vg"]} {$i > 1} {set i [expr $i / 2]} { +for {set i [get_register_value "vg"]} {$i > 1} {set i [expr {$i / 2}]} { set lines_before [count_info_registers] gdb_test "next" ".*if .res < 0." "step over prctl vg = ${i}" diff --git a/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.exp b/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.exp index 904f92f..eb2bc92 100644 --- a/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.exp +++ b/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.exp @@ -22,7 +22,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/aarch64-unwind-pc.exp b/gdb/testsuite/gdb.arch/aarch64-unwind-pc.exp index 1bcd1b2..bc6d242 100644 --- a/gdb/testsuite/gdb.arch/aarch64-unwind-pc.exp +++ b/gdb/testsuite/gdb.arch/aarch64-unwind-pc.exp @@ -25,7 +25,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/aarch64-w-registers.exp b/gdb/testsuite/gdb.arch/aarch64-w-registers.exp index 409beec..06c6626 100644 --- a/gdb/testsuite/gdb.arch/aarch64-w-registers.exp +++ b/gdb/testsuite/gdb.arch/aarch64-w-registers.exp @@ -23,7 +23,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile {nodebug}]} { return -1 } -if ![runto_main] { +if {![runto_main]} { untested "could not run to main" return -1 } diff --git a/gdb/testsuite/gdb.arch/alpha-step.exp b/gdb/testsuite/gdb.arch/alpha-step.exp index bdbfeec..aea492e 100644 --- a/gdb/testsuite/gdb.arch/alpha-step.exp +++ b/gdb/testsuite/gdb.arch/alpha-step.exp @@ -42,50 +42,50 @@ proc test_stepi {function } { gdb_test "break *$function+4" \ "Breakpoint .* at .*" \ "breakpoint on fb$function instruction" - + gdb_test "continue" \ "Breakpoint .*, 0x\[0-9a-fA-F\]+ in $function\(\).*" \ "continue to fb$function instruction (first call)" - + # Extra check to make sure we stopped on the FP branch instruction. - + gdb_test "x /i \$pc" \ "0x\[0-9a-fA-F\]+ <.*>:\[ \t\]+fb$function.*" \ "Check breakpoint on fb$function instruction (first call)" - + # Step test, followed by the check that we landed on the expected # instruction (the testcase should be written in such a way that # the branch is taken on the first call to this function. - + gdb_test "stepi" \ "0x\[0-9a-fA-F\]+.*" \ "stepi on fb$function (first call)" - + gdb_test "x /i \$pc" \ "0x\[0-9a-fA-F\]+ <.*>:\[ \t\]+ret.*" \ "Check stepi over fb$function stopped on ret" - + # Continue again. FUNCTION should be called a second time, this time # with an argument such that the FP branch will not be taken. - + gdb_test "continue" \ "Breakpoint .*, 0x\[0-9a-fA-F\]+ in $function\(\).*" \ "continue to fb$function instruction (second call)" - + # Extra check to make sure we stopped on the FP branch instruction. - + gdb_test "x /i \$pc" \ "0x\[0-9a-fA-F\]+ <.*>:\[ \t\]+fb$function.*" \ "Check breakpoint on fb$function instruction (second call)" - + # Step test, branch should not be taken. - + gdb_test "stepi" \ "0x\[0-9a-fA-F\]+.*" \ "stepi on fb$function (branch not taken)" - + # Extra check to verify that we landed on the instruction we expected. - + gdb_test "x /i \$pc" \ "0x\[0-9a-fA-F\]+ <.*>:\[ \t\]+fneg.*" \ "check stepi over fb$function stopped on fneg instruction" diff --git a/gdb/testsuite/gdb.arch/altivec-abi.exp b/gdb/testsuite/gdb.arch/altivec-abi.exp index fb5367d..c41e82d 100644 --- a/gdb/testsuite/gdb.arch/altivec-abi.exp +++ b/gdb/testsuite/gdb.arch/altivec-abi.exp @@ -39,7 +39,7 @@ proc altivec_abi_tests { extra_flags force_abi } { if { "$force_abi" == "auto" } { # If the toolchain does not record attributes, skip auto-ABI tests. set readelf_program [gdb_find_readelf] - set result [catch "exec $readelf_program -A $binfile" output] + set result [catch {exec $readelf_program -A $binfile} output] if {$result == 0 && ![regexp Tag_GNU_Power_ABI_Vector $output]} { untested "ABI not marked" @@ -132,7 +132,7 @@ proc altivec_abi_tests { extra_flags force_abi } { gdb_test "p matrix\[3\]" ".*= .31, 32, 33, 34, 35, 36, 37, 38." "print fourth vector" } -if [test_compiler_info gcc*] { +if {[test_compiler_info gcc*]} { set binprefix ${binfile} with_test_prefix "default ABI, auto" { @@ -166,7 +166,7 @@ if [test_compiler_info gcc*] { altivec_abi_tests "additional_flags=-maltivec additional_flags=-mabi=altivec" "auto" } } -} elseif [test_compiler_info xlc*] { +} elseif {[test_compiler_info xlc*]} { altivec_abi_tests "additional_flags=-qaltivec" "auto" } else { warning "unknown compiler" diff --git a/gdb/testsuite/gdb.arch/altivec-regs.exp b/gdb/testsuite/gdb.arch/altivec-regs.exp index d297f4b..dfe7e24 100644 --- a/gdb/testsuite/gdb.arch/altivec-regs.exp +++ b/gdb/testsuite/gdb.arch/altivec-regs.exp @@ -1,5 +1,5 @@ # Copyright (C) 2002-2025 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 @@ -26,9 +26,9 @@ require allow_altivec_tests standard_testfile set compile_flags {debug nowarnings} -if [test_compiler_info gcc*] { +if {[test_compiler_info gcc*]} { set compile_flags "$compile_flags additional_flags=-maltivec additional_flags=-mabi=altivec" -} elseif [test_compiler_info xlc*] { +} elseif {[test_compiler_info xlc*]} { set compile_flags "$compile_flags additional_flags=-qaltivec" } else { warning "unknown compiler" @@ -134,11 +134,11 @@ gdb_test "continue" \ "Breakpoint $decimal, vector_fun .a=.0xfefefefe, 0xfefefefe, 0xfefefefe, 0xfefefefe., b=.0x1010101, 0x1010101, 0x1010101, 0x1010101.*altivec-regs.c.*vec_splat_u8.2..;" \ "continue to vector_fun" -# Do a next over the assignment to vector 'a'. +# Do a next over the assignment to vector 'a'. gdb_test "next" ".*b = \\(\\(vector unsigned int\\) vec_splat_u8\\(3\\)\\);" \ "next (1)" -# Do a next over the assignment to vector 'b'. +# Do a next over the assignment to vector 'b'. gdb_test "next" "c = vec_add \\(a, b\\);" \ "next (2)" diff --git a/gdb/testsuite/gdb.arch/amd64-break-on-asm-line.exp b/gdb/testsuite/gdb.arch/amd64-break-on-asm-line.exp index 7f0a8b8..a2caf46 100644 --- a/gdb/testsuite/gdb.arch/amd64-break-on-asm-line.exp +++ b/gdb/testsuite/gdb.arch/amd64-break-on-asm-line.exp @@ -23,7 +23,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/amd64-byte.exp b/gdb/testsuite/gdb.arch/amd64-byte.exp index d084303..d67361d 100644 --- a/gdb/testsuite/gdb.arch/amd64-byte.exp +++ b/gdb/testsuite/gdb.arch/amd64-byte.exp @@ -63,7 +63,7 @@ with_test_prefix "at first bp" { } for { set r 1 } { $r <= 4 } { incr r } { - set h [expr $r + 14] + set h [expr {$r + 14}] gdb_test "print/x \$$byte_regs($h)" \ ".. = 0x[format %x $r]2" \ "check contents of %$byte_regs($h)" @@ -85,7 +85,7 @@ with_test_prefix "at second bp" { } for { set r 1 } { $r <= 4 } { incr r } { - set h [expr $r + 14] + set h [expr {$r + 14}] gdb_test "set var \$$byte_regs($h) = $h" "" "set %$byte_regs($h)" } } @@ -101,7 +101,7 @@ with_test_prefix "at third bp" { } for { set r 1 } { $r <= 4 } { incr r } { - set h [expr $r + 14] + set h [expr {$r + 14}] gdb_test "print \$$byte_regs($h)" \ ".. = $h" \ "check contents of %$byte_regs($h)" diff --git a/gdb/testsuite/gdb.arch/amd64-disp-step-self-call.exp b/gdb/testsuite/gdb.arch/amd64-disp-step-self-call.exp index 61ce4be..cd982a0 100644 --- a/gdb/testsuite/gdb.arch/amd64-disp-step-self-call.exp +++ b/gdb/testsuite/gdb.arch/amd64-disp-step-self-call.exp @@ -59,7 +59,7 @@ gdb_test_multiple "x/2i \$pc" "get address of next insn" { } # Clear the slot on the stack and confirm it was set to zero. -set sp [expr $sp - 0x8] +set sp [expr {$sp - 0x8}] gdb_test_no_output "set {unsigned long long} $sp = 0" \ "clear stack slot" set zero_val 0x[format %016x 0] @@ -73,7 +73,7 @@ gdb_test "stepi" \ # Check stack pointer was updated to the expected value. set new_sp [get_hexadecimal_valueof "\$sp" "*UNKNOWN*" \ "get stack pointer after step"] -gdb_assert {[expr $sp == $new_sp]} \ +gdb_assert {[expr {$sp == $new_sp}]} \ "check stack pointer was updated as expected" # Check the contents of the stack were updated to the expected value. diff --git a/gdb/testsuite/gdb.arch/amd64-disp-step.exp b/gdb/testsuite/gdb.arch/amd64-disp-step.exp index aee1d7a..3b0d828 100644 --- a/gdb/testsuite/gdb.arch/amd64-disp-step.exp +++ b/gdb/testsuite/gdb.arch/amd64-disp-step.exp @@ -143,7 +143,7 @@ proc set_regs { regs val } { # Use send_gdb/gdb_expect so that these aren't logged as pass/fail. send_gdb "set \$${reg} = ${val}\n" gdb_expect 10 { - -re "$gdb_prompt $" { + -re "$gdb_prompt $" { verbose "Setting ${reg} to ${val}." 2 } timeout { @@ -223,7 +223,7 @@ proc rip_test { reg test_start_label test_end_label signal_modes } { # the displaced step, but instead just delivers the signal. set inferior_pid [get_inferior_pid] # Ensure that $inferior_pid refers to a single process. - gdb_assert {[expr $inferior_pid > 0]} \ + gdb_assert {[expr {$inferior_pid > 0}]} \ "check for a sane inferior pid" if {$inferior_pid > 0} { remote_exec target "kill -ALRM $inferior_pid" diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-inline.exp b/gdb/testsuite/gdb.arch/amd64-entry-value-inline.exp index 14946d7..ec6ebc4 100644 --- a/gdb/testsuite/gdb.arch/amd64-entry-value-inline.exp +++ b/gdb/testsuite/gdb.arch/amd64-entry-value-inline.exp @@ -16,7 +16,7 @@ set opts {} standard_testfile .S .c -if [info exists COMPILE] { +if {[info exists COMPILE]} { # make check RUNTESTFLAGS="gdb.arch/amd64-entry-value-inline.exp COMPILE=1" standard_testfile .c .c lappend opts debug optimize=-O2 @@ -25,7 +25,7 @@ if [info exists COMPILE] { } # Make .c available on the host. -if [is_remote host] { +if {[is_remote host]} { gdb_remote_download host $srcdir/$subdir/$srcfile2 } @@ -33,7 +33,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.exp b/gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.exp index d31c057..2207ecf 100644 --- a/gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.exp +++ b/gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.exp @@ -16,7 +16,7 @@ standard_testfile .S .c set opts {} -if [info exists COMPILE] { +if {[info exists COMPILE]} { # make check RUNTESTFLAGS="gdb.arch/amd64-entry-value-param-dwarf5.exp COMPILE=1" standard_testfile .c .c lappend opts optimize=-O2 dwarf5 @@ -25,7 +25,7 @@ if [info exists COMPILE] { } # Make .c available on the host. -if [is_remote host] { +if {[is_remote host]} { gdb_remote_download host $srcdir/$subdir/$srcfile2 } @@ -33,7 +33,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-param.exp b/gdb/testsuite/gdb.arch/amd64-entry-value-param.exp index 0c7cd21..57b3ca4 100644 --- a/gdb/testsuite/gdb.arch/amd64-entry-value-param.exp +++ b/gdb/testsuite/gdb.arch/amd64-entry-value-param.exp @@ -16,7 +16,7 @@ standard_testfile .S .c set opts {} -if [info exists COMPILE] { +if {[info exists COMPILE]} { # make check RUNTESTFLAGS="gdb.arch/amd64-entry-value-param.exp COMPILE=1" standard_testfile .c .c lappend opts debug optimize=-O2 @@ -25,7 +25,7 @@ if [info exists COMPILE] { } # Make .c available on the host. -if [is_remote host] { +if {[is_remote host]} { remote_download host $srcdir/$subdir/$srcfile2 } @@ -33,7 +33,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.exp b/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.exp index e508a04..94737f3 100644 --- a/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.exp +++ b/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.exp @@ -18,7 +18,7 @@ standard_testfile .S .cc require is_x86_64_m64_target # Make .cc available on the host. -if [is_remote host] { +if {[is_remote host]} { gdb_remote_download host $srcdir/$subdir/$srcfile2 } @@ -27,7 +27,7 @@ if { [prepare_for_testing_full "failed to prepare" \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value.exp b/gdb/testsuite/gdb.arch/amd64-entry-value.exp index 2bc676c..59f0975 100644 --- a/gdb/testsuite/gdb.arch/amd64-entry-value.exp +++ b/gdb/testsuite/gdb.arch/amd64-entry-value.exp @@ -16,7 +16,7 @@ standard_testfile .s set opts {nopie} -if [info exists COMPILE] { +if {[info exists COMPILE]} { # make check RUNTESTFLAGS="gdb.arch/amd64-entry-value.exp COMPILE=1" set srcfile ${testfile}.cc lappend opts debug @@ -30,7 +30,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/amd64-eval.exp b/gdb/testsuite/gdb.arch/amd64-eval.exp index 3d798ee..79ff8aa 100644 --- a/gdb/testsuite/gdb.arch/amd64-eval.exp +++ b/gdb/testsuite/gdb.arch/amd64-eval.exp @@ -26,7 +26,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/amd64-extended-prologue-analysis.exp b/gdb/testsuite/gdb.arch/amd64-extended-prologue-analysis.exp index 356afc7..dcdb850 100644 --- a/gdb/testsuite/gdb.arch/amd64-extended-prologue-analysis.exp +++ b/gdb/testsuite/gdb.arch/amd64-extended-prologue-analysis.exp @@ -37,7 +37,7 @@ proc test_run {} { set main_r12 [get_integer_valueof "\$r12" "null"] gdb_assert { $main_r12 ne "null" } - set foo_r12 [expr "$main_r12 + 2"] + set foo_r12 [expr {$main_r12 + 2}] gdb_test "print \$r12=$foo_r12" "$foo_r12" "Set foo's %r12=$foo_r12" gdb_test "up" ".*main.*" "Go up a frame from foo" gdb_test "print \$r12" "$main_r12" "foo's %r12 unwound" @@ -52,7 +52,7 @@ proc offset_test_run {} { set old_reg_val [get_integer_valueof "\$r12" "null"] gdb_assert { $old_reg_val ne "null" } - set new_reg_val [expr "$old_reg_val + 3"] + set new_reg_val [expr {$old_reg_val + 3}] gdb_test "print \$r14=$new_reg_val" "$new_reg_val" "Set %r14=$new_reg_val" gdb_test "print \$r13=$new_reg_val" "$new_reg_val" "Set %r13=$new_reg_val" gdb_test "print \$r12=$new_reg_val" "$new_reg_val" "Set %r12=$new_reg_val" diff --git a/gdb/testsuite/gdb.arch/amd64-gs_base.exp b/gdb/testsuite/gdb.arch/amd64-gs_base.exp index 90cbe02..a48cbec 100644 --- a/gdb/testsuite/gdb.arch/amd64-gs_base.exp +++ b/gdb/testsuite/gdb.arch/amd64-gs_base.exp @@ -22,7 +22,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/amd64-i386-address.exp b/gdb/testsuite/gdb.arch/amd64-i386-address.exp index 55a25db..31ce704 100644 --- a/gdb/testsuite/gdb.arch/amd64-i386-address.exp +++ b/gdb/testsuite/gdb.arch/amd64-i386-address.exp @@ -21,7 +21,7 @@ require {is_any_target "x86_64-*-*" "i?86-*-*"} is_lp64_target require {!istarget "*-*-openbsd*"} -if [prepare_for_testing "failed to prepare" amd64-i386-address amd64-i386-address.S [list debug "additional_flags=-m32 -nostdlib"]] { +if {[prepare_for_testing "failed to prepare" amd64-i386-address amd64-i386-address.S [list debug "additional_flags=-m32 -nostdlib"]]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.exp b/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.exp index 451c84b..a499eae 100644 --- a/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.exp +++ b/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.exp @@ -35,7 +35,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {nopie}] } return -1 } -if ![runto breakpt] { +if {![runto breakpt]} { return -1 } @@ -47,7 +47,7 @@ gdb_test "bt" "^#0 +breakpt *\\(\\) \[^\r\n\]*\r\n#1 +0x\[0-9a-f\]+ in func5\[^\ clean_restart ${::testfile} -if ![runto breakpt] { +if {![runto breakpt]} { return -1 } @@ -61,7 +61,7 @@ gdb_test "interpreter-exec mi \"-stack-info-depth\"" \ clean_restart ${::testfile} -if ![runto breakpt] { +if {![runto breakpt]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/amd64-invalid-stack-top.exp b/gdb/testsuite/gdb.arch/amd64-invalid-stack-top.exp index b715ecf..7f1b806 100644 --- a/gdb/testsuite/gdb.arch/amd64-invalid-stack-top.exp +++ b/gdb/testsuite/gdb.arch/amd64-invalid-stack-top.exp @@ -36,7 +36,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } { return -1 } -if ![runto breakpt] { +if {![runto breakpt]} { return -1 } @@ -51,7 +51,7 @@ gdb_test "bt no-filters" "^#0 +$hex in func2 \\(\\)\r\nBacktrace stopped: Cannot clean_restart ${::testfile} -if ![runto breakpt] { +if {![runto breakpt]} { return -1 } @@ -65,7 +65,7 @@ gdb_test "interpreter-exec mi \"-stack-info-depth\"" \ clean_restart ${::testfile} -if ![runto breakpt] { +if {![runto breakpt]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/amd64-optimout-repeat.exp b/gdb/testsuite/gdb.arch/amd64-optimout-repeat.exp index 1b85e4e..38ce3ac 100644 --- a/gdb/testsuite/gdb.arch/amd64-optimout-repeat.exp +++ b/gdb/testsuite/gdb.arch/amd64-optimout-repeat.exp @@ -16,7 +16,7 @@ standard_testfile .S .c set opts {} -if [info exists COMPILE] { +if {[info exists COMPILE]} { # make check RUNTESTFLAGS="gdb.arch/amd64-optimout-repeat.exp COMPILE=1" set srcfile ${srcfile2} lappend opts debug optimize=-O2 @@ -28,7 +28,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/amd64-prologue-xmm.exp b/gdb/testsuite/gdb.arch/amd64-prologue-xmm.exp index 8447973..3a688ab 100644 --- a/gdb/testsuite/gdb.arch/amd64-prologue-xmm.exp +++ b/gdb/testsuite/gdb.arch/amd64-prologue-xmm.exp @@ -20,7 +20,7 @@ set csrcfile [file rootname $srcfile].c set csrcfile ${testfile}.c set opts {} -if [info exists COMPILE] { +if {[info exists COMPILE]} { # make check RUNTESTFLAGS='gdb.arch/amd64-prologue-xmm.exp COMPILE=1' set srcfile ${csrcfile} lappend opts debug optimize=-O0 @@ -32,7 +32,7 @@ if {[prepare_for_testing "failed to prepare" ${testfile} $srcfile $opts]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/amd64-shadow-stack-corefile.exp b/gdb/testsuite/gdb.arch/amd64-shadow-stack-corefile.exp index 039f528..82d68da 100644 --- a/gdb/testsuite/gdb.arch/amd64-shadow-stack-corefile.exp +++ b/gdb/testsuite/gdb.arch/amd64-shadow-stack-corefile.exp @@ -26,13 +26,13 @@ proc check_core_file {core_filename saved_pl3_ssp} { global decimal # Load the core file. - if [gdb_test "core $core_filename" \ - [multi_line \ - "Core was generated by .*\\." \ - "Program terminated with signal SIGSEGV, Segmentation fault.*" \ - "#0 function \\(\\) at .*amd64-shadow-stack-corefile.c:$decimal" \ - "$decimal.*__asm__ volatile \\(\"ret\\\\n\"\\);"] \ - "load core file"] { + if {[gdb_test "core $core_filename" \ + [multi_line \ + "Core was generated by .*\\." \ + "Program terminated with signal SIGSEGV, Segmentation fault.*" \ + "#0 function \\(\\) at .*amd64-shadow-stack-corefile.c:$decimal" \ + "$decimal.*__asm__ volatile \\(\"ret\\\\n\"\\);"] \ + "load core file"]} { return } @@ -52,7 +52,7 @@ save_vars { ::env(GLIBC_TUNABLES) } { set linespec ${srcfile}:[gdb_get_line_number "Break here"] - if ![runto $linespec] { + if {![runto $linespec]} { return } @@ -78,14 +78,14 @@ save_vars { ::env(GLIBC_TUNABLES) } { } } - if ![gcore_cmd_available] { + if {![gcore_cmd_available]} { unsupported "target does not support gcore command." return } clean_restart $::testfile - if ![runto $linespec] { + if {![runto $linespec]} { return } diff --git a/gdb/testsuite/gdb.arch/amd64-tailcall-cxx.exp b/gdb/testsuite/gdb.arch/amd64-tailcall-cxx.exp index 7e1df43..5fbdf8b 100644 --- a/gdb/testsuite/gdb.arch/amd64-tailcall-cxx.exp +++ b/gdb/testsuite/gdb.arch/amd64-tailcall-cxx.exp @@ -16,7 +16,7 @@ set opts {} standard_testfile amd64-tailcall-cxx1.S amd64-tailcall-cxx2.S -if [info exists COMPILE] { +if {[info exists COMPILE]} { # make check RUNTESTFLAGS="gdb.arch/amd64-tailcall-cxx.exp COMPILE=1" standard_testfile amd64-tailcall-cxx1.cc amd64-tailcall-cxx2.cc lappend opts debug @@ -30,7 +30,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} "${srcfile} ${srcfile2 return -1 } -if ![runto g] { +if {![runto g]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp b/gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp index fe65c4d..12abf58 100644 --- a/gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp +++ b/gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp @@ -16,7 +16,7 @@ set opts {} standard_testfile .S -if [info exists COMPILE] { +if {[info exists COMPILE]} { # make check RUNTESTFLAGS="gdb.arch/amd64-tailcall-noret.exp COMPILE=1" standard_testfile lappend opts debug optimize=-O2 @@ -30,7 +30,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } { return -1 } -if ![runto noret] { +if {![runto noret]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/amd64-tailcall-ret.exp b/gdb/testsuite/gdb.arch/amd64-tailcall-ret.exp index 51baf7b..e96b85b 100644 --- a/gdb/testsuite/gdb.arch/amd64-tailcall-ret.exp +++ b/gdb/testsuite/gdb.arch/amd64-tailcall-ret.exp @@ -16,7 +16,7 @@ set opts {} standard_testfile .S .c -if [info exists COMPILE] { +if {[info exists COMPILE]} { # make check RUNTESTFLAGS="gdb.arch/amd64-tailcall-ret.exp COMPILE=1" standard_testfile .c .c lappend opts debug optimize=-O2 @@ -25,7 +25,7 @@ if [info exists COMPILE] { } # Make .c available on the host. -if [is_remote host] { +if {[is_remote host]} { gdb_remote_download host $srcdir/$subdir/$srcfile2 } @@ -33,7 +33,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/amd64-tailcall-self.exp b/gdb/testsuite/gdb.arch/amd64-tailcall-self.exp index de3c606..e5f47eb 100644 --- a/gdb/testsuite/gdb.arch/amd64-tailcall-self.exp +++ b/gdb/testsuite/gdb.arch/amd64-tailcall-self.exp @@ -21,7 +21,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {}] } { return -1 } -if ![runto b] { +if {![runto b]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/arc-analyze-prologue.exp b/gdb/testsuite/gdb.arch/arc-analyze-prologue.exp index 1b084f9..dc1149c 100644 --- a/gdb/testsuite/gdb.arch/arc-analyze-prologue.exp +++ b/gdb/testsuite/gdb.arch/arc-analyze-prologue.exp @@ -29,7 +29,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile $options] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return 0 } @@ -85,7 +85,7 @@ proc prologue_test {funcname {savedregs ""} {fp_offset ""} } { } if { $fp_offset != "" } { set sp [get_integer_valueof \$sp -1 "get value of sp in $funcname"] - set fp_val [expr $sp + $fp_offset] + set fp_val [expr {$sp + $fp_offset}] set fp_real_val \ [get_integer_valueof \$fp 0 "get value of fp in $funcname"] if { $fp_real_val != $fp_val } { diff --git a/gdb/testsuite/gdb.arch/arc-dbnz.exp b/gdb/testsuite/gdb.arch/arc-dbnz.exp index 0563210..7f76aa2 100644 --- a/gdb/testsuite/gdb.arch/arc-dbnz.exp +++ b/gdb/testsuite/gdb.arch/arc-dbnz.exp @@ -37,7 +37,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return 0 } diff --git a/gdb/testsuite/gdb.arch/arc-decode-insn.exp b/gdb/testsuite/gdb.arch/arc-decode-insn.exp index 5e7f3c2..01b23eb 100644 --- a/gdb/testsuite/gdb.arch/arc-decode-insn.exp +++ b/gdb/testsuite/gdb.arch/arc-decode-insn.exp @@ -39,7 +39,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return 0 } @@ -53,7 +53,7 @@ proc test_branch_insn { test_name } { # Calculate instruction length, based on ${test_name}_end symbol. set end_pc [get_hexadecimal_valueof &${test_name}_end -1] - set length [expr $end_pc - $pc] + set length [expr {$end_pc - $pc}] set target_address [get_hexadecimal_valueof &${test_name}_target -1] diff --git a/gdb/testsuite/gdb.arch/arm-cmse-sgstubs.exp b/gdb/testsuite/gdb.arch/arm-cmse-sgstubs.exp index f3aca94..d01f817 100644 --- a/gdb/testsuite/gdb.arch/arm-cmse-sgstubs.exp +++ b/gdb/testsuite/gdb.arch/arm-cmse-sgstubs.exp @@ -22,7 +22,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile ]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/arm-neon.exp b/gdb/testsuite/gdb.arch/arm-neon.exp index b38a685..b29b9ca 100644 --- a/gdb/testsuite/gdb.arch/arm-neon.exp +++ b/gdb/testsuite/gdb.arch/arm-neon.exp @@ -25,7 +25,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug quie return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/avr-flash-qualifier.exp b/gdb/testsuite/gdb.arch/avr-flash-qualifier.exp index cafae60..ea58543 100644 --- a/gdb/testsuite/gdb.arch/avr-flash-qualifier.exp +++ b/gdb/testsuite/gdb.arch/avr-flash-qualifier.exp @@ -31,7 +31,7 @@ if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} { return -1 } -if ![runto [gdb_get_line_number "break here."]] { +if {![runto [gdb_get_line_number "break here."]]} { untested "could not run to \"break here.\"" return -1 } diff --git a/gdb/testsuite/gdb.arch/disp-step-insn-reloc.exp b/gdb/testsuite/gdb.arch/disp-step-insn-reloc.exp index a7cd5f3..6a08f70 100644 --- a/gdb/testsuite/gdb.arch/disp-step-insn-reloc.exp +++ b/gdb/testsuite/gdb.arch/disp-step-insn-reloc.exp @@ -21,12 +21,12 @@ require support_displaced_stepping # Some targets have leading underscores on assembly symbols. set additional_flags [gdb_target_symbol_prefix_flags] -if [prepare_for_testing "failed to prepare" $executable $srcfile \ - [list debug $additional_flags]] { +if {[prepare_for_testing "failed to prepare" $executable $srcfile \ + [list debug $additional_flags]]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/e500-prologue.exp b/gdb/testsuite/gdb.arch/e500-prologue.exp index b1eb865..b468e71 100644 --- a/gdb/testsuite/gdb.arch/e500-prologue.exp +++ b/gdb/testsuite/gdb.arch/e500-prologue.exp @@ -37,7 +37,7 @@ proc insert_breakpoint {function expected_location} { global gdb_prompt global expect_out global hex - + set address "" # Insert a breakpoint using the given function name, and extract diff --git a/gdb/testsuite/gdb.arch/e500-regs.exp b/gdb/testsuite/gdb.arch/e500-regs.exp index 6d69ccc..fa10b4f 100644 --- a/gdb/testsuite/gdb.arch/e500-regs.exp +++ b/gdb/testsuite/gdb.arch/e500-regs.exp @@ -1,5 +1,5 @@ # Copyright 2003-2025 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 @@ -155,11 +155,11 @@ gdb_test "continue" \ "Breakpoint 2, vector_fun .a=.-2, -2., b=.1, 1.*e500-regs.c.*ev_create_s32 .2, 2.;" \ "continue to vector_fun" -# Do a next over the assignment to vector 'a'. +# Do a next over the assignment to vector 'a'. gdb_test "next" ".*b = \\(vector int\\) __ev_create_s32 \\(3, 3\\);" \ "next (1)" -# Do a next over the assignment to vector 'b'. +# Do a next over the assignment to vector 'b'. gdb_test "next" "c = __ev_and \\(a, b\\);" \ "next (2)" diff --git a/gdb/testsuite/gdb.arch/ftrace-insn-reloc.exp b/gdb/testsuite/gdb.arch/ftrace-insn-reloc.exp index 80df6b9..d8b94f2 100644 --- a/gdb/testsuite/gdb.arch/ftrace-insn-reloc.exp +++ b/gdb/testsuite/gdb.arch/ftrace-insn-reloc.exp @@ -19,16 +19,16 @@ standard_testfile insn-reloc.c # Some targets have leading underscores on assembly symbols. set additional_flags [gdb_target_symbol_prefix_flags] -if [prepare_for_testing "failed to prepare" $testfile-no-ipa $srcfile \ - [list debug $additional_flags]] { +if {[prepare_for_testing "failed to prepare" $testfile-no-ipa $srcfile \ + [list debug $additional_flags]]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } -if ![gdb_target_supports_trace] { +if {![gdb_target_supports_trace]} { unsupported "target does not support trace" return -1 } @@ -48,7 +48,7 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \ clean_restart $testfile set remote_libipa [gdb_load_shlib $libipa] -if ![runto_main] { +if {![runto_main]} { return 0 } diff --git a/gdb/testsuite/gdb.arch/i386-avx.exp b/gdb/testsuite/gdb.arch/i386-avx.exp index ba41a8c..3a1d8e8 100644 --- a/gdb/testsuite/gdb.arch/i386-avx.exp +++ b/gdb/testsuite/gdb.arch/i386-avx.exp @@ -53,7 +53,7 @@ gdb_test "break [gdb_get_line_number "first breakpoint here"]" \ "set first breakpoint in main" gdb_continue_to_breakpoint "continue to first breakpoint in main" -if [is_amd64_regs_target] { +if {[is_amd64_regs_target]} { set nr_regs 16 } else { set nr_regs 8 @@ -79,7 +79,7 @@ gdb_continue_to_breakpoint "continue to second breakpoint in main" for { set r 0 } { $r < $nr_regs } { incr r } { gdb_test "print data\[$r\]" \ - ".. = \\{f = \\{[expr $r + 10], $r.125, $r.25, $r.375, $r.5, $r.625, $r.75, $r.875\\}\\}.*" \ + ".. = \\{f = \\{[expr {$r + 10}], $r.125, $r.25, $r.375, $r.5, $r.625, $r.75, $r.875\\}\\}.*" \ "check contents of data\[$r\]" } diff --git a/gdb/testsuite/gdb.arch/i386-avx512.exp b/gdb/testsuite/gdb.arch/i386-avx512.exp index dcd6cc9..675a3c7 100644 --- a/gdb/testsuite/gdb.arch/i386-avx512.exp +++ b/gdb/testsuite/gdb.arch/i386-avx512.exp @@ -31,7 +31,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } @@ -78,7 +78,7 @@ gdb_continue_to_breakpoint "continue to second breakpoint in main" set nr_regs 7 for { set r 0 } { $r < $nr_regs } { incr r } { - set val [expr $r + 1] + set val [expr {$r + 1}] gdb_test "print/x k_data\[$r\]" \ ".. = 0x$val$val$val$val" \ "check contents of k_data\[$r\]" @@ -89,7 +89,7 @@ gdb_test "break [gdb_get_line_number "third breakpoint here"]" \ "set third breakpoint in main" gdb_continue_to_breakpoint "continue to third breakpoint in main" -if [is_amd64_regs_target] { +if {[is_amd64_regs_target]} { set nr_regs 32 } else { set nr_regs 8 @@ -134,7 +134,7 @@ gdb_continue_to_breakpoint "continue to fourth breakpoint in main" for { set r 0 } { $r < $nr_regs } { incr r } { gdb_test "print zmm_data\[$r\]" \ - ".. = \\{f = \\{[expr $r + 10], [expr $r.125 + 10], [expr $r.25 + 10], [expr $r.375 + 10], [expr $r.5 + 10], [expr $r.625 + 10], [expr $r.75 + 10], [expr $r.875 + 10]\\}\\}.*" \ + ".. = \\{f = \\{[expr {$r + 10}], [expr {$r + 10.125}], [expr {$r + 10.25}], [expr {$r + 10.375}], [expr {$r + 10.5}], [expr {$r + 10.625}], [expr {$r +10.75}], [expr {$r + 10.875}]\\}\\}.*" \ "check contents of zmm_data\[$r\] after writing ZMM regs" } @@ -152,7 +152,7 @@ gdb_continue_to_breakpoint "continue to fifth breakpoint in main" for { set r 0 } { $r < $nr_regs } { incr r } { gdb_test "print zmm_data\[$r\]" \ - ".. = \\{f = \\{[expr $r + 20], [expr $r.125 + 20], [expr $r.25 + 20], [expr $r.375 + 20], [expr $r.5 + 10], [expr $r.625 + 10], [expr $r.75 + 10], [expr $r.875 + 10]\\}\\}.*" \ + ".. = \\{f = \\{[expr {$r + 20}], [expr {$r + 20.125}], [expr {$r + 20.25}], [expr {$r + 20.375}], [expr {$r + 10.5}], [expr {$r + 10.625}], [expr {$r + 10.75}], [expr {$r + 10.875}]\\}\\}.*" \ "check contents of zmm_data\[$r\] after writing YMM regs" } @@ -168,7 +168,7 @@ gdb_continue_to_breakpoint "continue to sixth breakpoint in main" for { set r 0 } { $r < $nr_regs } { incr r } { gdb_test "print zmm_data\[$r\]" \ - ".. = \\{f = \\{[expr $r + 30], [expr $r.125 + 30], [expr $r.25 + 20], [expr $r.375 + 20], [expr $r.5 + 10], [expr $r.625 + 10], [expr $r.75 + 10], [expr $r.875 + 10]\\}\\}.*" \ + ".. = \\{f = \\{[expr {$r + 30}], [expr {$r + 30.125}], [expr {$r + 20.25}], [expr {$r + 20.375}], [expr {$r + 10.5}], [expr {$r + 10.625}], [expr {$r + 10.75}], [expr {$r + 10.875}]\\}\\}.*" \ "check contents of zmm_data\[$r\] after writing XMM regs" } diff --git a/gdb/testsuite/gdb.arch/i386-biarch-core.exp b/gdb/testsuite/gdb.arch/i386-biarch-core.exp index 6e83939..c04b87d 100644 --- a/gdb/testsuite/gdb.arch/i386-biarch-core.exp +++ b/gdb/testsuite/gdb.arch/i386-biarch-core.exp @@ -54,7 +54,7 @@ set corefile [gdb_remote_download host $corefile] # First check if this particular GDB supports i386, otherwise we should not # expect the i386 core file to be loaded successfully. set archs [get_set_option_choices "set architecture" "i386"] -set supports_arch_i386 [expr [lsearch -exact $archs i386] != -1] +set supports_arch_i386 [expr {[lsearch -exact $archs i386] != -1}] # Wrongly built GDB complains by: # "..." is not a core dump: File format not recognized diff --git a/gdb/testsuite/gdb.arch/i386-byte.exp b/gdb/testsuite/gdb.arch/i386-byte.exp index 1eff977..12b57f3 100644 --- a/gdb/testsuite/gdb.arch/i386-byte.exp +++ b/gdb/testsuite/gdb.arch/i386-byte.exp @@ -51,7 +51,7 @@ with_test_prefix "at first bp" { gdb_test "print/x \$$byte_regs($r)" \ ".. = 0x[format %x $r]1" \ "check contents of %$byte_regs($r)" - set h [expr $r + 4] + set h [expr {$r + 4}] gdb_test "print/x \$$byte_regs($h)" \ ".. = 0x[format %x $r]2" \ "check contents of %$byte_regs($h)" @@ -59,7 +59,7 @@ with_test_prefix "at first bp" { for { set r 1 } { $r <= 4 } { incr r } { gdb_test "set var \$$byte_regs($r) = $r" "" "set %$byte_regs($r)" - set h [expr $r + 4] + set h [expr {$r + 4}] gdb_test "set var \$$byte_regs($h) = $h" "" "set %$byte_regs($h)" } } @@ -72,7 +72,7 @@ with_test_prefix "at second bp" { gdb_test "print \$$byte_regs($r)" \ ".. = $r" \ "check contents of %$byte_regs($r)" - set h [expr $r + 4] + set h [expr {$r + 4}] gdb_test "print \$$byte_regs($h)" \ ".. = $h" \ "check contents of %$byte_regs($h)" diff --git a/gdb/testsuite/gdb.arch/i386-cfi-notcurrent.exp b/gdb/testsuite/gdb.arch/i386-cfi-notcurrent.exp index 7291f02..661265b 100644 --- a/gdb/testsuite/gdb.arch/i386-cfi-notcurrent.exp +++ b/gdb/testsuite/gdb.arch/i386-cfi-notcurrent.exp @@ -21,11 +21,11 @@ require is_x86_like_target set testfile "i386-cfi-notcurrent" set srcfile ${testfile}.S -if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {nodebug}] { +if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {nodebug}]} { return -1 } -if ![runto f] { +if {![runto f]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/i386-disp-step-self-call.exp b/gdb/testsuite/gdb.arch/i386-disp-step-self-call.exp index 3e8ae1c..1d4c87e 100644 --- a/gdb/testsuite/gdb.arch/i386-disp-step-self-call.exp +++ b/gdb/testsuite/gdb.arch/i386-disp-step-self-call.exp @@ -59,7 +59,7 @@ gdb_test_multiple "x/2i \$pc" "get address of next insn" { } # Clear the slot on the stack and confirm it was set to zero. -set sp [expr $sp - 0x4] +set sp [expr {$sp - 0x4}] gdb_test_no_output "set {unsigned int} $sp = 0" \ "clear stack slot" set zero_val 0x[format %08x 0] @@ -73,7 +73,7 @@ gdb_test "stepi" \ # Check stack pointer was updated to the expected value. set new_sp [get_hexadecimal_valueof "\$sp" "*UNKNOWN*" \ "get stack pointer after step"] -gdb_assert {[expr $sp == $new_sp]} \ +gdb_assert {[expr {$sp == $new_sp}]} \ "check stack pointer was updated as expected" # Check the contents of the stack were updated to the expected value. diff --git a/gdb/testsuite/gdb.arch/i386-dr3-watch.exp b/gdb/testsuite/gdb.arch/i386-dr3-watch.exp index 11b4773..16d2872 100644 --- a/gdb/testsuite/gdb.arch/i386-dr3-watch.exp +++ b/gdb/testsuite/gdb.arch/i386-dr3-watch.exp @@ -23,7 +23,7 @@ require {is_any_target "i?86-*-*" "x86_64-*-*"} standard_testfile -if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug $additional_flags}] { +if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug $additional_flags}]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/i386-pkru.exp b/gdb/testsuite/gdb.arch/i386-pkru.exp index 7262b8b..6355c43 100644 --- a/gdb/testsuite/gdb.arch/i386-pkru.exp +++ b/gdb/testsuite/gdb.arch/i386-pkru.exp @@ -34,7 +34,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } @@ -63,8 +63,8 @@ set v [linux_kernel_version] if { $v != {} } { set have_xfail \ [expr \ - [version_compare [list 5 14 0] <= $v] \ - && [version_compare $v < [list 6 2 0]]] + {[version_compare [list 5 14 0] <= $v] \ + && [version_compare $v < [list 6 2 0]]}] } # Test pkru register at startup diff --git a/gdb/testsuite/gdb.arch/i386-prologue-skip-cf-protection.exp b/gdb/testsuite/gdb.arch/i386-prologue-skip-cf-protection.exp index b289b84..ac2be79 100644 --- a/gdb/testsuite/gdb.arch/i386-prologue-skip-cf-protection.exp +++ b/gdb/testsuite/gdb.arch/i386-prologue-skip-cf-protection.exp @@ -38,7 +38,7 @@ proc test_run {} { set bp_addr $expect_out(1,string) # Convert to decimal. - set bp_addr [expr $bp_addr] + set bp_addr [expr {$bp_addr}] pass $gdb_test_name } diff --git a/gdb/testsuite/gdb.arch/i386-sse-stack-align.exp b/gdb/testsuite/gdb.arch/i386-sse-stack-align.exp index af0b56d..6b9260b 100644 --- a/gdb/testsuite/gdb.arch/i386-sse-stack-align.exp +++ b/gdb/testsuite/gdb.arch/i386-sse-stack-align.exp @@ -22,7 +22,7 @@ set executable ${testfile} set binfile [standard_output_file ${executable}] set opts {} -if [info exists COMPILE] { +if {[info exists COMPILE]} { set srcfile ${csrcfile} lappend opts debug optimize=-O2 additional_flags=-msse } @@ -53,5 +53,5 @@ foreach i {0 1 2 3 4} { if {$args != ""} { set args "$args, " } - set args "$args[expr $i + 1]" + set args "$args[expr {$i + 1}]" } diff --git a/gdb/testsuite/gdb.arch/i386-sse.exp b/gdb/testsuite/gdb.arch/i386-sse.exp index 154f5ea..ee22b62 100644 --- a/gdb/testsuite/gdb.arch/i386-sse.exp +++ b/gdb/testsuite/gdb.arch/i386-sse.exp @@ -68,7 +68,7 @@ gdb_test "break [gdb_get_line_number "first breakpoint here"]" \ "set first breakpoint in main" gdb_continue_to_breakpoint "continue to first breakpoint in main" -if [is_amd64_regs_target] { +if {[is_amd64_regs_target]} { set nr_regs 16 } else { set nr_regs 8 @@ -94,6 +94,6 @@ gdb_continue_to_breakpoint "continue to second breakpoint in main" for { set r 0 } { $r < $nr_regs } { incr r } { gdb_test "print data\[$r\]" \ - ".. = \\{f = \\{[expr $r + 10], $r.25, $r.5, $r.75\\}\\}.*" \ + ".. = \\{f = \\{[expr {$r + 10}], $r.25, $r.5, $r.75\\}\\}.*" \ "check contents of data\[$r\]" } diff --git a/gdb/testsuite/gdb.arch/ia64-breakpoint-shadow.exp b/gdb/testsuite/gdb.arch/ia64-breakpoint-shadow.exp index d6fd14c..ed617fc 100644 --- a/gdb/testsuite/gdb.arch/ia64-breakpoint-shadow.exp +++ b/gdb/testsuite/gdb.arch/ia64-breakpoint-shadow.exp @@ -27,7 +27,7 @@ clean_restart gdb_load $binfile # We need to start the inferior to place the breakpoints in the memory at all. -if ![runto_main] { +if {![runto_main]} { return -1 } @@ -54,7 +54,7 @@ gdb_test_multiple "b bundle" $test { } } -if ![info exists bpt2address] { +if {![info exists bpt2address]} { return -1 } @@ -65,7 +65,7 @@ set test "disassembly with breakpoints" gdb_test_multiple "disass main" $test { -re $match { set got $expect_out(1,string) - if [string equal -nocase $orig $got] { + if {[string equal -nocase $orig $got]} { pass $test } else { fail $test diff --git a/gdb/testsuite/gdb.arch/mips-fcr.exp b/gdb/testsuite/gdb.arch/mips-fcr.exp index b47c371..6fe332a 100644 --- a/gdb/testsuite/gdb.arch/mips-fcr.exp +++ b/gdb/testsuite/gdb.arch/mips-fcr.exp @@ -25,7 +25,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile}] } { return } -if ![runto_main] { +if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.arch/mips-octeon-bbit.exp b/gdb/testsuite/gdb.arch/mips-octeon-bbit.exp index f43127d..1921578 100644 --- a/gdb/testsuite/gdb.arch/mips-octeon-bbit.exp +++ b/gdb/testsuite/gdb.arch/mips-octeon-bbit.exp @@ -4,16 +4,16 @@ # 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 single-step on bbit. +# Test single-step on bbit. require {istarget "*octeon*"} @@ -48,7 +48,7 @@ proc single_step_until { match } { set insn [current_insn] set start [timestamp] while { $insn != "" && [timestamp] - $start < 3*$timeout } { - if [regexp $match $insn] { + if {[regexp $match $insn]} { return 1 } if {![single_step]} { @@ -66,7 +66,7 @@ proc test_bbit { name taken } { } pass "$name single-step until bbit" gdb_test "si" "" "$name single-step on bbit" - if [regexp "li\\s+\[sv\]0,$taken" [current_insn]] { + if {[regexp "li\\s+\[sv\]0,$taken" [current_insn]]} { pass "$name check insn after bbit" } else { send_log "expected: li\\s+\[sv\]0,$taken found [current_insn]\n" diff --git a/gdb/testsuite/gdb.arch/pa-nullify.exp b/gdb/testsuite/gdb.arch/pa-nullify.exp index ad246ca..cb8eeeb 100644 --- a/gdb/testsuite/gdb.arch/pa-nullify.exp +++ b/gdb/testsuite/gdb.arch/pa-nullify.exp @@ -43,7 +43,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {}] ! clean_restart gdb_load $binfile -# In the first test, we do a "step" on a function whose last instruction +# In the first test, we do a "step" on a function whose last instruction # contains a branch-with-nullify. The instruction in the delay slot belongs # to the next function. We verify that when we step off the first function # that we end up back at the caller and not at the second instruction. @@ -65,9 +65,9 @@ gdb_test_multiple "stepi" "${test}" { } } -# In the second test, we verify that we can get a proper backtrace +# In the second test, we verify that we can get a proper backtrace # even when we are in a nullified instruction that belongs to the next function. -# We also verify that when stepping over a branch-with-nullify insn that we +# We also verify that when stepping over a branch-with-nullify insn that we # stay on the same insn for two steps. proc get_addr_of_sym { sym } { @@ -127,7 +127,7 @@ if {![runto_main]} { } gdb_breakpoint "*$foo_last" gdb_test "continue" "Breakpoint \[0-9\]*,.* in foo.*" "$test: continue to breakpoint" -if [gen_core $test] { +if {[gen_core $test]} { test_core_bt $test } @@ -138,6 +138,6 @@ if {![runto_main]} { gdb_breakpoint "*$foo_last" gdb_test "continue" "Breakpoint \[0-9\]*,.* in foo.*" "$test: continue to breakpoint" gdb_test "stepi" ".*in foo.*" "$test: step to nullified instruction" -if [gen_core $test] { +if {[gen_core $test]} { test_core_bt $test } diff --git a/gdb/testsuite/gdb.arch/powerpc-addpcis.exp b/gdb/testsuite/gdb.arch/powerpc-addpcis.exp index 5a6d38e..9d88c78 100644 --- a/gdb/testsuite/gdb.arch/powerpc-addpcis.exp +++ b/gdb/testsuite/gdb.arch/powerpc-addpcis.exp @@ -86,25 +86,25 @@ set check_r9 [get_hexadecimal_valueof "\$r9" "default0"] # addpcis 8,+0x10 # /* set r8 */ # addpcis 9,+0x100 # /* set r9 */ -if [expr $check_r3 + 0x1000000 != $check_r6 - 0xc ] { +if {$check_r3 + 0x1000000 != $check_r6 - 0xc} { fail "unexpected value r3 + 0x1,000,000 != r6 + 0xc ; r3: $check_r3 r6: $check_r6 " } -if [expr $check_r4 + 0x100000 != $check_r6 - 0x8 ] { +if {$check_r4 + 0x100000 != $check_r6 - 0x8} { fail "unexpected value r4 + 0x100,000 != r6 - 0x8 ; r4: $check_r4 r6: $check_r6 " } -if [expr $check_r5 + 0x10000 != $check_r6 - 0x4 ] { +if {$check_r5 + 0x10000 != $check_r6 - 0x4} { fail "unexpected value r5 + 0x10,000 != r6 , r5: $check_r5 r6: $check_r6 " } -if [expr $check_r6 != $check_r6] { +if {$check_r6 != $check_r6} { fail "unexpected value r6 != r6 , r6: $check_r6 r6: $check_r6 " } -if [expr $check_r7 - 0x10000 != $check_r6 + 0x4] { +if {$check_r7 - 0x10000 != $check_r6 + 0x4} { fail "unexpected value r7 - 0x10,000 != r6 + 0x4 , r7: $check_r7 r7: $check_r6 " } -if [expr $check_r8 - 0x100000 != $check_r6 + 0x8 ] { +if {$check_r8 - 0x100000 != $check_r6 + 0x8} { fail "unexpected value r8 - 0x100,000 != r6 , r8: $check_r8 r8: $check_r6 " } -if [expr $check_r9 - 0x1000000 != $check_r6 + 0xc ] { +if {$check_r9 - 0x1000000 != $check_r6 + 0xc} { fail "unexpected value r9 - 0x1,000,000 != r6 + 0xc , r9: $check_r9 r6: $check_r6 " } diff --git a/gdb/testsuite/gdb.arch/powerpc-aix-prologue.exp b/gdb/testsuite/gdb.arch/powerpc-aix-prologue.exp index f95bddf..4e6ee78 100644 --- a/gdb/testsuite/gdb.arch/powerpc-aix-prologue.exp +++ b/gdb/testsuite/gdb.arch/powerpc-aix-prologue.exp @@ -38,7 +38,7 @@ proc insert_breakpoint {function expected_location} { global gdb_prompt global expect_out global hex - + set address "" # Insert a breakpoint using the given function name, and extract diff --git a/gdb/testsuite/gdb.arch/powerpc-altivec.exp b/gdb/testsuite/gdb.arch/powerpc-altivec.exp index bc8ff7a..0084ffe 100644 --- a/gdb/testsuite/gdb.arch/powerpc-altivec.exp +++ b/gdb/testsuite/gdb.arch/powerpc-altivec.exp @@ -53,7 +53,7 @@ proc func_check {instr} { set test "found: '$instr'" set peb [instr_to_patt $instr] - if [regexp -nocase -line [instr_to_patt $instr] $func] { + if {[regexp -nocase -line [instr_to_patt $instr] $func]} { pass $test } else { fail $peb diff --git a/gdb/testsuite/gdb.arch/powerpc-altivec2.exp b/gdb/testsuite/gdb.arch/powerpc-altivec2.exp index 6fddd34..cd2240a 100644 --- a/gdb/testsuite/gdb.arch/powerpc-altivec2.exp +++ b/gdb/testsuite/gdb.arch/powerpc-altivec2.exp @@ -52,7 +52,7 @@ proc func_check {instr} { global func set test "found: $instr" - if [regexp -nocase -line [instr_to_patt $instr] $func] { + if {[regexp -nocase -line [instr_to_patt $instr] $func]} { pass $test } else { fail $test diff --git a/gdb/testsuite/gdb.arch/powerpc-altivec3.exp b/gdb/testsuite/gdb.arch/powerpc-altivec3.exp index 7b1d0c3..c7d1a2b 100644 --- a/gdb/testsuite/gdb.arch/powerpc-altivec3.exp +++ b/gdb/testsuite/gdb.arch/powerpc-altivec3.exp @@ -52,7 +52,7 @@ proc func_check {instr} { global func set test "found: $instr" - if [regexp -nocase -line [instr_to_patt $instr] $func] { + if {[regexp -nocase -line [instr_to_patt $instr] $func]} { pass $test } else { fail $test diff --git a/gdb/testsuite/gdb.arch/powerpc-d128-regs.exp b/gdb/testsuite/gdb.arch/powerpc-d128-regs.exp index cb5a371..904c758 100644 --- a/gdb/testsuite/gdb.arch/powerpc-d128-regs.exp +++ b/gdb/testsuite/gdb.arch/powerpc-d128-regs.exp @@ -35,7 +35,7 @@ if {![runto_main]} { return } -if [gdb_test "show arch" ".*powerpc:common.*" "checking for PPC arch"] { +if {[gdb_test "show arch" ".*powerpc:common.*" "checking for PPC arch"]} { return -1 } @@ -50,12 +50,12 @@ gdb_test "info reg dl$i" \ "dl$i\[ \]*1\.2345678910\[ \t\]*\\(raw 0x2205800000000000000000049c5de09c\\)" \ "print dl$i register with the info reg command" -gdb_test "info reg f[expr 2*$i]" \ - "f[expr 2*$i]\[ \]*8\.608957309287334e\-145\[ \t\]*\\(raw 0x2205800000000000\\)" \ +gdb_test "info reg f[expr {2*$i}]" \ + "f[expr {2*$i}]\[ \]*8\.608957309287334e\-145\[ \t\]*\\(raw 0x2205800000000000\\)" \ "testing lower half of dl$i register" -gdb_test "info reg f[expr 2*$i+1]" \ - "f[expr 2*$i+1]\[ \]*9\.7841140127686122e\-314\[ \t\]*\\(raw 0x000000049c5de09c\\)" \ +gdb_test "info reg f[expr {2*$i+1}]" \ + "f[expr {2*$i+1}]\[ \]*9\.7841140127686122e\-314\[ \t\]*\\(raw 0x000000049c5de09c\\)" \ "testing upper half of dl$i register" } diff --git a/gdb/testsuite/gdb.arch/powerpc-htm-regs.exp b/gdb/testsuite/gdb.arch/powerpc-htm-regs.exp index 5e2923f..456833e 100644 --- a/gdb/testsuite/gdb.arch/powerpc-htm-regs.exp +++ b/gdb/testsuite/gdb.arch/powerpc-htm-regs.exp @@ -159,7 +159,7 @@ gdb_test_no_output "set \$xer = 0xc0000000" # FPRs gdb_test_no_output "set \$f0 = 0.5" for {set i 1} {$i < 32} {incr i 1} { - gdb_test_no_output "set \$f$i = \$f[expr $i - 1] + 1.0" + gdb_test_no_output "set \$f$i = \$f[expr {$i - 1}] + 1.0" } gdb_test_no_output "set \$fpscr = 0x84005000" @@ -213,7 +213,7 @@ proc test_register_match {reg_name reg_var_name hex} { # In some infrequent cases CXER doesn't match the # pre-transactional XER, possibly due to a linux kernel bug. set should_xfail 0 - if [istarget "powerpc*-*-linux*" && reg_name == "cxer"] { + if {[istarget "powerpc*-*-linux*" && reg_name == "cxer"]} { set should_xfail 1 } @@ -268,7 +268,7 @@ test_register_match "ctar" "tar" 1 # Support for writing to the checkpointed registers is not # currently available in the gdbserver stub. -if [target_is_gdbserver] { +if {[target_is_gdbserver]} { unsupported "write to checkpointed registers" return } @@ -282,7 +282,7 @@ for {set i 0} {$i < 32} {incr i 1} { gdb_test_no_output "set \$cf0 = 0.25" for {set i 1} {$i < 32} {incr i 1} { - gdb_test_no_output "set \$cf$i = \$cf[expr $i - 1] + 1.0" + gdb_test_no_output "set \$cf$i = \$cf[expr {$i - 1}] + 1.0" } for {set i 0} {$i < 32} {incr i 1} { diff --git a/gdb/testsuite/gdb.arch/powerpc-lnia.exp b/gdb/testsuite/gdb.arch/powerpc-lnia.exp index 357ec7a..c317465 100644 --- a/gdb/testsuite/gdb.arch/powerpc-lnia.exp +++ b/gdb/testsuite/gdb.arch/powerpc-lnia.exp @@ -82,22 +82,22 @@ set check_r9 [get_hexadecimal_valueof "\$r9" "default0"] # Specifically that the values loaded by the lnia instruction # reflect the value of the PC as if the instruction was # not displaced. -if [expr $check_r3 + 4 != $check_r4] { +if {$check_r3 + 4 != $check_r4} { fail "unexpected value r3+4 != r4 , r3: $check_r3 r4: $check_r4 " } -if [expr $check_r4 + 4 != $check_r5] { +if {$check_r4 + 4 != $check_r5} { fail "unexpected value r4+4 != r5 , r4: $check_r4 r5: $check_r5 " } -if [expr $check_r5 + 4 != $check_r6] { +if {$check_r5 + 4 != $check_r6} { fail "unexpected value r5+4 != r6 , r5: $check_r5 r6: $check_r6 " } -if [expr $check_r6 + 4 != $check_r7] { +if {$check_r6 + 4 != $check_r7} { fail "unexpected value r6+4 != r7 , r6: $check_r6 r7: $check_r7 " } -if [expr $check_r7 + 4 != $check_r8] { +if {$check_r7 + 4 != $check_r8} { fail "unexpected value r7+4 != r8 , r7: $check_r7 r8: $check_r8 " } -if [expr $check_r8 + 4 != $check_r9] { +if {$check_r8 + 4 != $check_r9} { fail "unexpected value r8+4 != r9 , r8: $check_r8 r9: $check_r9 " } diff --git a/gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.exp b/gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.exp index f4a3fdb..ef6e1ff 100644 --- a/gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.exp +++ b/gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.exp @@ -109,16 +109,16 @@ set vs5_expected 0xa7b7c7d7a6b6c6d6a5b5c5d5a4b4c4d4 set vs6_expected 0xa9b9c9d9a8b8c8d8a7b7c7d7a6b6c6d6 set vs7_expected 0xabbbcbdbaabacadaa9b9c9d9a8b8c8d8 -if [expr $check_vs4 != $vs4_expected] { +if {$check_vs4 != $vs4_expected} { fail "unexpected value vs4; actual:$check_vs4 expected:$vs4_expected" } -if [expr $check_vs5 != $vs5_expected ] { +if {$check_vs5 != $vs5_expected} { fail "unexpected value vs5; actual:$check_vs5 expected:$vs5_expected" } -if [expr $check_vs6 != $vs6_expected ] { +if {$check_vs6 != $vs6_expected} { fail "unexpected value vs6; actual:$check_vs6 expected:$vs6_expected" } -if [expr $check_vs7 != $vs7_expected ] { +if {$check_vs7 != $vs7_expected} { fail "unexpected value vs7; actual:$check_vs7 expected:$vs7_expected" } diff --git a/gdb/testsuite/gdb.arch/powerpc-power10.exp b/gdb/testsuite/gdb.arch/powerpc-power10.exp index 124baaf..089ca73 100644 --- a/gdb/testsuite/gdb.arch/powerpc-power10.exp +++ b/gdb/testsuite/gdb.arch/powerpc-power10.exp @@ -52,7 +52,7 @@ proc func_check {instr} { global func set test "found: $instr" - if [regexp -nocase -line [instr_to_patt $instr] $func] { + if {[regexp -nocase -line [instr_to_patt $instr] $func]} { pass $test } else { fail $test diff --git a/gdb/testsuite/gdb.arch/powerpc-power7.exp b/gdb/testsuite/gdb.arch/powerpc-power7.exp index 8885a91..4d85fd9 100644 --- a/gdb/testsuite/gdb.arch/powerpc-power7.exp +++ b/gdb/testsuite/gdb.arch/powerpc-power7.exp @@ -52,7 +52,7 @@ proc func_check {instr} { global func set test "found: $instr" - if [regexp -nocase -line [instr_to_patt $instr] $func] { + if {[regexp -nocase -line [instr_to_patt $instr] $func]} { pass $test } else { fail $test diff --git a/gdb/testsuite/gdb.arch/powerpc-power8.exp b/gdb/testsuite/gdb.arch/powerpc-power8.exp index f740ae8..f679253 100644 --- a/gdb/testsuite/gdb.arch/powerpc-power8.exp +++ b/gdb/testsuite/gdb.arch/powerpc-power8.exp @@ -52,7 +52,7 @@ proc func_check {instr} { global func set test "found: $instr" - if [regexp -nocase -line [instr_to_patt $instr] $func] { + if {[regexp -nocase -line [instr_to_patt $instr] $func]} { pass $test } else { fail $test diff --git a/gdb/testsuite/gdb.arch/powerpc-power9.exp b/gdb/testsuite/gdb.arch/powerpc-power9.exp index 8dcf536..784ba9b 100644 --- a/gdb/testsuite/gdb.arch/powerpc-power9.exp +++ b/gdb/testsuite/gdb.arch/powerpc-power9.exp @@ -52,7 +52,7 @@ proc func_check {instr} { global func set test "found: $instr" - if [regexp -nocase -line [instr_to_patt $instr] $func] { + if {[regexp -nocase -line [instr_to_patt $instr] $func]} { pass $test } else { fail $test diff --git a/gdb/testsuite/gdb.arch/powerpc-ppr-dscr.exp b/gdb/testsuite/gdb.arch/powerpc-ppr-dscr.exp index 1b4c608..1b70535 100644 --- a/gdb/testsuite/gdb.arch/powerpc-ppr-dscr.exp +++ b/gdb/testsuite/gdb.arch/powerpc-ppr-dscr.exp @@ -68,7 +68,7 @@ proc ppr_dscr_available {} { with_test_prefix "check PPR/DSCR access" { clean_restart $::testfile - if ![runto_main] { + if {![runto_main]} { return } @@ -88,7 +88,7 @@ with_test_prefix "check PPR/DSCR access" { # Now do the actual test clean_restart $::testfile -if ![runto_main] { +if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.arch/powerpc-prologue-frame.exp b/gdb/testsuite/gdb.arch/powerpc-prologue-frame.exp index 156a70e..4682cb9 100644 --- a/gdb/testsuite/gdb.arch/powerpc-prologue-frame.exp +++ b/gdb/testsuite/gdb.arch/powerpc-prologue-frame.exp @@ -28,7 +28,7 @@ if {[gdb_compile \ clean_restart $testfile -if ![runto bar] { +if {![runto bar]} { untested "could not run to bar" return -1 } diff --git a/gdb/testsuite/gdb.arch/powerpc-tar.exp b/gdb/testsuite/gdb.arch/powerpc-tar.exp index a060ec8..917d759 100644 --- a/gdb/testsuite/gdb.arch/powerpc-tar.exp +++ b/gdb/testsuite/gdb.arch/powerpc-tar.exp @@ -70,7 +70,7 @@ proc tar_available {} { with_test_prefix "check TAR access" { clean_restart $::testfile - if ![runto_main] { + if {![runto_main]} { return } @@ -86,7 +86,7 @@ with_test_prefix "check TAR access" { # Now do the actual test clean_restart $::testfile -if ![runto_main] { +if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.arch/powerpc-vsx.exp b/gdb/testsuite/gdb.arch/powerpc-vsx.exp index 73a0fdc..27f2bd0 100644 --- a/gdb/testsuite/gdb.arch/powerpc-vsx.exp +++ b/gdb/testsuite/gdb.arch/powerpc-vsx.exp @@ -52,7 +52,7 @@ proc func_check {instr} { global func set test "found: $instr" - if [regexp -nocase -line [instr_to_patt $instr] $func] { + if {[regexp -nocase -line [instr_to_patt $instr] $func]} { pass $test } else { fail $test diff --git a/gdb/testsuite/gdb.arch/powerpc-vsx2.exp b/gdb/testsuite/gdb.arch/powerpc-vsx2.exp index dfee7a3..ec09815 100644 --- a/gdb/testsuite/gdb.arch/powerpc-vsx2.exp +++ b/gdb/testsuite/gdb.arch/powerpc-vsx2.exp @@ -52,7 +52,7 @@ proc func_check {instr} { global func set test "found: $instr" - if [regexp -nocase -line [instr_to_patt $instr] $func] { + if {[regexp -nocase -line [instr_to_patt $instr] $func]} { pass $test } else { fail $test diff --git a/gdb/testsuite/gdb.arch/powerpc-vsx3.exp b/gdb/testsuite/gdb.arch/powerpc-vsx3.exp index fd725f9..5aeed8e 100644 --- a/gdb/testsuite/gdb.arch/powerpc-vsx3.exp +++ b/gdb/testsuite/gdb.arch/powerpc-vsx3.exp @@ -52,7 +52,7 @@ proc func_check {instr} { global func set test "found: $instr" - if [regexp -nocase -line [instr_to_patt $instr] $func] { + if {[regexp -nocase -line [instr_to_patt $instr] $func]} { pass $test } else { fail $test diff --git a/gdb/testsuite/gdb.arch/ppc-dfp.exp b/gdb/testsuite/gdb.arch/ppc-dfp.exp index 20145ae..3c3b030 100644 --- a/gdb/testsuite/gdb.arch/ppc-dfp.exp +++ b/gdb/testsuite/gdb.arch/ppc-dfp.exp @@ -20,7 +20,7 @@ require {istarget "powerpc*"} standard_testfile -if ![test_compiler_info gcc*] { +if {![test_compiler_info gcc*]} { # We use GCC's extended asm syntax warning "unknown compiler" return -1 diff --git a/gdb/testsuite/gdb.arch/ppc-fp.exp b/gdb/testsuite/gdb.arch/ppc-fp.exp index c8342bb..b8b3f00 100644 --- a/gdb/testsuite/gdb.arch/ppc-fp.exp +++ b/gdb/testsuite/gdb.arch/ppc-fp.exp @@ -20,7 +20,7 @@ require {istarget "powerpc*"} standard_testfile -if ![test_compiler_info gcc*] { +if {![test_compiler_info gcc*]} { # We use GCC's extended asm syntax warning "unknown compiler" return -1 diff --git a/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.exp b/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.exp index 17bbdb4..35b442f 100644 --- a/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.exp +++ b/gdb/testsuite/gdb.arch/ppc64-break-on-_exit.exp @@ -26,7 +26,7 @@ require {istarget "powerpc*"} is_lp64_target set flags { nodebug } -if [info exists COMPILE] { +if {[info exists COMPILE]} { standard_testfile .c -main.c lappend flags optimize=-O2 lappend flags additional_flags=-fno-stack-protector diff --git a/gdb/testsuite/gdb.arch/riscv-bp-infcall.exp b/gdb/testsuite/gdb.arch/riscv-bp-infcall.exp index 62d4c44..39aa793 100644 --- a/gdb/testsuite/gdb.arch/riscv-bp-infcall.exp +++ b/gdb/testsuite/gdb.arch/riscv-bp-infcall.exp @@ -31,7 +31,7 @@ if {![runto_main]} { # Figure out where the breakpoint will be placed taking account for # stack alignment, and allocation of the dummy code area. set bp_addr [get_valueof "/x" "\$sp" 0] -set bp_addr [format 0x%x [expr ($bp_addr & ~0xf) - 0x20]] +set bp_addr [format 0x%x [expr {($bp_addr & ~0xf) - 0x20}]] # Fill the region we know will be used as the scratch area with the # compressed nop instruction. If GDB fails to overwrite this with an diff --git a/gdb/testsuite/gdb.arch/riscv-info-fcsr.exp b/gdb/testsuite/gdb.arch/riscv-info-fcsr.exp index 4b3baae..358544f 100644 --- a/gdb/testsuite/gdb.arch/riscv-info-fcsr.exp +++ b/gdb/testsuite/gdb.arch/riscv-info-fcsr.exp @@ -32,7 +32,7 @@ if {![runto_main]} { # that can be written to the fcsr register. The two arguments should # be the value of each of the two fields within the fcsr register. proc merge_fflags_and_frm { fflags_value frm_value } { - set fcsr_value 0x[format %x [expr $fflags_value | ($frm_value << 5)]] + set fcsr_value 0x[format %x [expr {$fflags_value | ($frm_value << 5)}]] return $fcsr_value } @@ -48,11 +48,11 @@ proc check_fcsr { fflags_value frm_value frm_string } { set frm_str_re [string_to_regexp "$frm_string"] set frm_val_re [format %d ${frm_value}] - set nv [format %d [expr ($fflags_value >> 4) & 0x1]] - set dz [format %d [expr ($fflags_value >> 3) & 0x1]] - set of [format %d [expr ($fflags_value >> 2) & 0x1]] - set uf [format %d [expr ($fflags_value >> 1) & 0x1]] - set nx [format %d [expr ($fflags_value >> 0) & 0x1]] + set nv [format %d [expr {($fflags_value >> 4) & 0x1}]] + set dz [format %d [expr {($fflags_value >> 3) & 0x1}]] + set of [format %d [expr {($fflags_value >> 2) & 0x1}]] + set uf [format %d [expr {($fflags_value >> 1) & 0x1}]] + set nx [format %d [expr {($fflags_value >> 0) & 0x1}]] set fflags_pattern "NV:${nv} DZ:${dz} OF:${of} UF:${uf} NX:${nx}" set frm_pattern "FRM:${frm_val_re} \\\[${frm_str_re}\\\]" diff --git a/gdb/testsuite/gdb.arch/s390-vregs.exp b/gdb/testsuite/gdb.arch/s390-vregs.exp index 3e47cac..9ee959b 100644 --- a/gdb/testsuite/gdb.arch/s390-vregs.exp +++ b/gdb/testsuite/gdb.arch/s390-vregs.exp @@ -19,7 +19,7 @@ require {is_any_target s390-*-* s390x-*-*} standard_testfile .S -if [isnative] { +if {[isnative]} { # Create a temporary directory, to take a core dump there later. set coredir [standard_output_file ${testfile}.d] remote_exec build "rm -rf $coredir" @@ -31,7 +31,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } @@ -71,7 +71,7 @@ gdb_test_multiple "x/i \$pc" "get PC after vector insn" { } } -if [expr $before_pc + 6 != $after_pc] { +if {$before_pc + 6 != $after_pc} { fail "stepping first vector insn" } @@ -93,17 +93,17 @@ set a_low 2 set b_high 3 set b_low 5 -set a [expr ($a_high << 32) | $a_low] -set b [expr ($b_high << 32) | $b_low] +set a [expr {($a_high << 32) | $a_low}] +set b [expr {($b_high << 32) | $b_low}] for {set j 0} {$j < 32} {incr j 1} { - set i [expr 17 * $j % 32] + set i [expr {17 * $j % 32}] gdb_test_no_output \ - "set \$v$i.v2_int64\[0\] = [expr $a * ($i + 1)]" \ + "set \$v$i.v2_int64\[0\] = [expr {$a * ($i + 1)}]" \ "set v$i left" - set i [expr 19 * (31 - $j) % 32] + set i [expr {19 * (31 - $j) % 32}] gdb_test_no_output \ - "set \$v$i.v2_int64\[1\] = [expr $b * (32 - $i)]" \ + "set \$v$i.v2_int64\[1\] = [expr {$b * (32 - $i)}]" \ "set v$i right" } @@ -121,7 +121,7 @@ set vregs [capture_command_output "x/64xg &save_area" ""] set i 0 foreach {- left right} [regexp -all -inline -line {^.*:\s+(\w+)\s+(\w+)} $vregs] { - if [expr $left != $a * ($i + 1) || $right != $b * (32 - $i)] { + if {$left != $a * ($i + 1) || $right != $b * (32 - $i)} { fail "verify \$v$i after set" } if { $i < 16 } { @@ -157,10 +157,10 @@ foreach {- r i val} [regexp -all -inline -line \ if { $r ne "v" } { fail "info registers vector: bad line $j" } elseif { $val ne [hex128 \ - [expr $a_high * ($i + 1) * $a_high ] \ - [expr $a_low * ($i + 1) * $a_low ] \ - [expr $b_high * (32 - $i) * $b_high * 32] \ - [expr $b_low * (32 - $i) * $b_low * 32] ] } { + [expr {$a_high * ($i + 1) * $a_high }] \ + [expr {$a_low * ($i + 1) * $a_low }] \ + [expr {$b_high * (32 - $i) * $b_high * 32}] \ + [expr {$b_low * (32 - $i) * $b_low * 32}] ] } { fail "compare \$v$i" } incr j 1 diff --git a/gdb/testsuite/gdb.arch/skip-prologue.exp b/gdb/testsuite/gdb.arch/skip-prologue.exp index ec04dad..26fd022 100644 --- a/gdb/testsuite/gdb.arch/skip-prologue.exp +++ b/gdb/testsuite/gdb.arch/skip-prologue.exp @@ -48,7 +48,7 @@ proc do_test { f } { } set test {$bp_addr == $prologue_end_addr} - if { [expr $test] } { + if {$bp_addr == $prologue_end_addr} { pass $test } elseif { $bp_addr < $prologue_end_addr } { # We'll allow this. For instance, amd64 has a prologue diff --git a/gdb/testsuite/gdb.arch/sparc-sysstep.exp b/gdb/testsuite/gdb.arch/sparc-sysstep.exp index 4dfc514..2a5c194 100644 --- a/gdb/testsuite/gdb.arch/sparc-sysstep.exp +++ b/gdb/testsuite/gdb.arch/sparc-sysstep.exp @@ -32,7 +32,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {additional_flag return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/sparc64-adi.exp b/gdb/testsuite/gdb.arch/sparc64-adi.exp index 25c3ce6..40a8eab 100644 --- a/gdb/testsuite/gdb.arch/sparc64-adi.exp +++ b/gdb/testsuite/gdb.arch/sparc64-adi.exp @@ -15,7 +15,7 @@ # This file is part of the gdb testsuite. -# Basic tests of examining/assigning ADI version tags, and reporting +# Basic tests of examining/assigning ADI version tags, and reporting # precise mismatch. require {istarget "sparc64*-*-linux*"} diff --git a/gdb/testsuite/gdb.arch/thumb-bx-pc.exp b/gdb/testsuite/gdb.arch/thumb-bx-pc.exp index 13622eb..e5699d7 100644 --- a/gdb/testsuite/gdb.arch/thumb-bx-pc.exp +++ b/gdb/testsuite/gdb.arch/thumb-bx-pc.exp @@ -21,7 +21,7 @@ set testfile "thumb-bx-pc" set srcfile ${testfile}.S set opts {} -if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] { +if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/thumb-singlestep.exp b/gdb/testsuite/gdb.arch/thumb-singlestep.exp index f4f695a..88fe49b 100644 --- a/gdb/testsuite/gdb.arch/thumb-singlestep.exp +++ b/gdb/testsuite/gdb.arch/thumb-singlestep.exp @@ -21,7 +21,7 @@ set testfile "thumb-singlestep" set srcfile ${testfile}.S set additional_flags "additional_flags=-mthumb" -if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} [list debug $additional_flags]] { +if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} [list debug $additional_flags]]} { return -1 } diff --git a/gdb/testsuite/gdb.arch/vsx-regs.exp b/gdb/testsuite/gdb.arch/vsx-regs.exp index df74ef3..a6ecbfd 100644 --- a/gdb/testsuite/gdb.arch/vsx-regs.exp +++ b/gdb/testsuite/gdb.arch/vsx-regs.exp @@ -24,9 +24,9 @@ require {istarget "powerpc*"} allow_vsx_tests standard_testfile set compile_flags {debug nowarnings quiet} -if [test_compiler_info gcc*] { +if {[test_compiler_info gcc*]} { set compile_flags "$compile_flags additional_flags=-maltivec additional_flags=-mabi=altivec" -} elseif [test_compiler_info xlc*] { +} elseif {[test_compiler_info xlc*]} { set compile_flags "$compile_flags additional_flags=-qaltivec" } else { warning "unknown compiler" diff --git a/gdb/testsuite/gdb.arch/vsx-vsr-float28.exp b/gdb/testsuite/gdb.arch/vsx-vsr-float28.exp index e40d52c..76c38ff 100644 --- a/gdb/testsuite/gdb.arch/vsx-vsr-float28.exp +++ b/gdb/testsuite/gdb.arch/vsx-vsr-float28.exp @@ -23,9 +23,9 @@ require {istarget "powerpc*"} allow_vsx_tests standard_testfile set compile_flags {debug nowarnings quiet} -if [test_compiler_info gcc*] { +if {[test_compiler_info gcc*]} { set compile_flags "$compile_flags additional_flags=-maltivec additional_flags=-mabi=altivec" -} elseif [test_compiler_info xlc*] { +} elseif {[test_compiler_info xlc*]} { set compile_flags "$compile_flags additional_flags=-qaltivec" } else { warning "unknown compiler" diff --git a/gdb/testsuite/gdb.base/a2-run.exp b/gdb/testsuite/gdb.base/a2-run.exp index 966e12a..0df7558 100644 --- a/gdb/testsuite/gdb.base/a2-run.exp +++ b/gdb/testsuite/gdb.base/a2-run.exp @@ -155,7 +155,7 @@ gdb_test_stdio "" "usage: factorial <number>" "" "run after setting args to nil # work with stub targets, where GDB connects to debug an already started # process. -if [use_gdb_stub] { +if {[use_gdb_stub]} { verbose "Skipping rest of a2-run.exp because target is a stub." return } diff --git a/gdb/testsuite/gdb.base/access-mem-running.exp b/gdb/testsuite/gdb.base/access-mem-running.exp index 280e89b..ca30ec2 100644 --- a/gdb/testsuite/gdb.base/access-mem-running.exp +++ b/gdb/testsuite/gdb.base/access-mem-running.exp @@ -36,7 +36,7 @@ proc test { non_stop } { gdb_load $binfile } - if ![runto_main] { + if {![runto_main]} { return -1 } @@ -114,7 +114,7 @@ proc test { non_stop } { } foreach non_stop { "off" "on" } { - set stop_mode [expr ($non_stop=="off")?"all-stop":"non-stop"] + set stop_mode [expr {($non_stop=="off")?"all-stop":"non-stop"}] with_test_prefix "$stop_mode" { test $non_stop } diff --git a/gdb/testsuite/gdb.base/advance-until-multiple-locations.exp b/gdb/testsuite/gdb.base/advance-until-multiple-locations.exp index 768500c..86b8e0d 100644 --- a/gdb/testsuite/gdb.base/advance-until-multiple-locations.exp +++ b/gdb/testsuite/gdb.base/advance-until-multiple-locations.exp @@ -33,14 +33,14 @@ set lineno [gdb_get_line_number "multiple locations here"] proc_with_prefix until_advance_lineno_from_inlined {cmd} { global lineno - if ![runto test] { + if {![runto test]} { return } gdb_breakpoint $lineno gdb_continue_to_breakpoint "break here" - set lineno2 [expr $lineno + 1] + set lineno2 [expr {$lineno + 1}] gdb_test "$cmd $lineno2" \ "inline_func .* at .*:$lineno2.*return i.*" \ @@ -53,7 +53,7 @@ proc_with_prefix until_advance_lineno_from_inlined {cmd} { proc_with_prefix until_advance_lineno_from_non_inlined {cmd} { global lineno - if ![runto test] { + if {![runto test]} { return } @@ -68,7 +68,7 @@ proc_with_prefix until_advance_lineno_from_non_inlined {cmd} { proc_with_prefix until_advance_inline_func {cmd} { global lineno - if ![runto test] { + if {![runto test]} { return } @@ -83,7 +83,7 @@ proc_with_prefix until_advance_inline_func {cmd} { proc_with_prefix advance_overload {} { global lineno - if ![runto test] { + if {![runto test]} { return } @@ -117,7 +117,7 @@ proc_with_prefix advance_overload {} { proc_with_prefix until_overload {} { global lineno - if ![runto test] { + if {![runto test]} { return } diff --git a/gdb/testsuite/gdb.base/advance.exp b/gdb/testsuite/gdb.base/advance.exp index d4e23ee..2051e9f 100644 --- a/gdb/testsuite/gdb.base/advance.exp +++ b/gdb/testsuite/gdb.base/advance.exp @@ -63,7 +63,7 @@ gdb_test "continue" \ ".*Breakpoint ${decimal}, main.*func3.*break here.*" \ "continue to call to func3 in main" -# Verify that "advance <funcname>" when funcname is called as parameter to +# Verify that "advance <funcname>" when funcname is called as parameter to # another function works. # gdb_test "advance foo" \ diff --git a/gdb/testsuite/gdb.base/all-architectures.exp.tcl b/gdb/testsuite/gdb.base/all-architectures.exp.tcl index 767b02d..5892ab7 100644 --- a/gdb/testsuite/gdb.base/all-architectures.exp.tcl +++ b/gdb/testsuite/gdb.base/all-architectures.exp.tcl @@ -187,7 +187,7 @@ proc gdb_test_no_output_osabi {cmd test} { set num_slices 8 set num_archs [llength $supported_archs] -set archs_per_slice [expr (($num_archs + $num_slices - 1) / $num_slices)] +set archs_per_slice [expr {(($num_archs + $num_slices - 1) / $num_slices)}] with_test_prefix "tests" { foreach_with_prefix osabi $supported_osabis { @@ -201,10 +201,10 @@ with_test_prefix "tests" { incr arch_count # Skip architectures outside our slice. - if {$arch_count < [expr $test_slice * $archs_per_slice]} { + if {$arch_count < $test_slice * $archs_per_slice} { continue } - if {$arch_count >= [expr ($test_slice + 1) * $archs_per_slice]} { + if {$arch_count >= ($test_slice + 1) * $archs_per_slice} { continue } @@ -312,7 +312,7 @@ with_test_prefix "tests" { foreach v $options { with_test_prefix "$var=$v" { gdb_test_no_output_osabi "$cmd $v" "$cmd" - run_axis $all_axes [expr $cur_axis + 1] $arch + run_axis $all_axes [expr {$cur_axis + 1}] $arch } } } diff --git a/gdb/testsuite/gdb.base/all-bin.exp b/gdb/testsuite/gdb.base/all-bin.exp index 847bcb9..d910965 100644 --- a/gdb/testsuite/gdb.base/all-bin.exp +++ b/gdb/testsuite/gdb.base/all-bin.exp @@ -19,7 +19,7 @@ # # tests for arithmetic, logical and relational operators # with mixed types -# +# diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp index 744d825..0da5a09 100644 --- a/gdb/testsuite/gdb.base/annota1.exp +++ b/gdb/testsuite/gdb.base/annota1.exp @@ -60,7 +60,7 @@ set old_gdb_prompt $gdb_prompt set gdb_prompt "\r\n\032\032pre-prompt\r\n$gdb_prompt \r\n\032\032prompt\r\n" # -# Escape all the characters in the path that need it. For instance +# Escape all the characters in the path that need it. For instance # the directory name could contain '+'. # set escapedsrcfile [string_to_regexp ${srcdir}/${subdir}/${srcfile}] @@ -244,7 +244,7 @@ gdb_test_multiple "break handle_USR1" "break handle_USR1" { } # -# break at printf. When we are stopped at printf, we can test +# break at printf. When we are stopped at printf, we can test # gdb_test_multiple "break printf" "break printf" { -re "\r\n\032\032post-prompt\r\nBreakpoint.*at $hex.*\032\032breakpoints-invalid\r\n.*$gdb_prompt$" { @@ -336,14 +336,14 @@ gdb_test_multiple "backtrace" "backtrace from shlibrary" { # -# test printing a frame with some arguments: +# test printing a frame with some arguments: # annotate-arg-begin # annotate-arg-name-end # annotate-arg-value # annotate-arg-end # -if [target_info exists gdb,nosignals] { +if {[target_info exists gdb,nosignals]} { unsupported "send SIGUSR1" unsupported "backtrace @ signal handler" } else { @@ -507,10 +507,10 @@ gdb_test_multiple "info inferior 1" "get inferior pid" { # annotate-signal-name-end # annotate-signal-string # annotate-signal-string-end -# FIXME: annotate-signal not tested (requires that the inferior be +# FIXME: annotate-signal not tested (requires that the inferior be # stopped by a "random" signal) -if [target_info exists gdb,nosignals] { +if {[target_info exists gdb,nosignals]} { unsupported "signal sent" } else { gdb_test_multiple "signal SIGTRAP" "signal sent" { diff --git a/gdb/testsuite/gdb.base/annota3.exp b/gdb/testsuite/gdb.base/annota3.exp index e8ac305..9d94be9 100644 --- a/gdb/testsuite/gdb.base/annota3.exp +++ b/gdb/testsuite/gdb.base/annota3.exp @@ -85,7 +85,7 @@ gdb_test_multiple "end" "end if construct" { # # info break: # -send_gdb "info break\n" +send_gdb "info break\n" gdb_expect_list "breakpoint info" "$gdb_prompt$" [concat { "\r\n\032\032post-prompt\r\n" "Num Type Disp Enb Address +What\r\n" } [list \ @@ -114,7 +114,7 @@ gdb_expect_list "run until main breakpoint" "$gdb_prompt$" [concat { # We don't care about the annotated output for this operation, it is the same as # the one produced by run above # -send_gdb "next\n" +send_gdb "next\n" gdb_expect_list "go after array init line" "$gdb_prompt$" { "\r\n\032\032post-prompt\r\n" "\r\n\032\032starting\r\n" @@ -183,10 +183,10 @@ gdb_expect_list "backtrace from shlibrary" "$gdb_prompt$" { # -# test printing a frame with some arguments: +# test printing a frame with some arguments: # -if [target_info exists gdb,nosignals] { +if {[target_info exists gdb,nosignals]} { unsupported "send SIGUSR1" unsupported "backtrace @ signal handler" } else { @@ -345,7 +345,7 @@ gdb_test_multiple "info inferior 1" "$test" { # Send a signal that is not handled -if [target_info exists gdb,nosignals] { +if {[target_info exists gdb,nosignals]} { unsupported "signal sent" } else { send_gdb "signal SIGTRAP\n" diff --git a/gdb/testsuite/gdb.base/args.exp b/gdb/testsuite/gdb.base/args.exp index 3930059..07101da 100644 --- a/gdb/testsuite/gdb.base/args.exp +++ b/gdb/testsuite/gdb.base/args.exp @@ -21,7 +21,7 @@ require {!target_info exists noargs} # This test requires starting new inferior processes, skip it if the target # board is a stub. require !use_gdb_stub -require {expr [have_startup_shell] != -1} +require {expr {[have_startup_shell] != -1}} standard_testfile @@ -115,7 +115,7 @@ proc args_test { name arglist {re_esc_list {}} {re_no_esc_list {}} } { set re_list $re_no_esc_list } - set expected_len [expr 1 + [llength $re_list]] + set expected_len [expr {1 + [llength $re_list]}] gdb_test "print argc" \ "\\\$$::decimal = $expected_len" "argc for $name" @@ -144,7 +144,7 @@ proc args_test { name arglist {re_esc_list {}} {re_no_esc_list {}} } { gdb_test "print argv\[$i\]" \ "\\\$$::decimal = $::hex \"$arg\"" \ "argv\[$i\] for $name" - set i [expr $i + 1] + set i [expr {$i + 1}] } } } diff --git a/gdb/testsuite/gdb.base/argv0-symlink.exp b/gdb/testsuite/gdb.base/argv0-symlink.exp index daabe74..6edaea8 100644 --- a/gdb/testsuite/gdb.base/argv0-symlink.exp +++ b/gdb/testsuite/gdb.base/argv0-symlink.exp @@ -17,7 +17,7 @@ # command expanding symlinks in the name of the program being run. # This test uses pathnames on build to create symbolic links on host and # expects the test program running on target to see those symbolic links. -# Therefore, it can't work reliably on anything other than configurations +# Therefore, it can't work reliably on anything other than configurations # where build/host/target are all the same. require isnative @@ -47,7 +47,7 @@ with_test_prefix "file symlink" { clean_restart "$filelink" - if ![runto_main] { + if {![runto_main]} { return -1 } @@ -87,7 +87,7 @@ with_test_prefix "dir symlink" { clean_restart "$dirlink/$filelink" - if ![runto_main] { + if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/arithmet.exp b/gdb/testsuite/gdb.base/arithmet.exp index 9f9234b..4e0ea12 100644 --- a/gdb/testsuite/gdb.base/arithmet.exp +++ b/gdb/testsuite/gdb.base/arithmet.exp @@ -20,7 +20,7 @@ # # tests for correctness of arithmetic operators, associativity and precedence # with integer type variables -# +# # # test running programs @@ -54,7 +54,7 @@ gdb_test "print x" "14" gdb_test "print y" "2" gdb_test "print z" "2" gdb_test "print w" "3" - + gdb_test "print x+y" "16" gdb_test "print x-y" "12" gdb_test "print x*y" "28" diff --git a/gdb/testsuite/gdb.base/asmlabel.exp b/gdb/testsuite/gdb.base/asmlabel.exp index c4a3f0c..6a4d2a2 100644 --- a/gdb/testsuite/gdb.base/asmlabel.exp +++ b/gdb/testsuite/gdb.base/asmlabel.exp @@ -37,7 +37,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return 0 } diff --git a/gdb/testsuite/gdb.base/assign.exp b/gdb/testsuite/gdb.base/assign.exp index aaee796..b96588c 100644 --- a/gdb/testsuite/gdb.base/assign.exp +++ b/gdb/testsuite/gdb.base/assign.exp @@ -19,7 +19,7 @@ # # tests for all the assignemnt operators # with mixed types and with int type variables -# +# # # test running programs diff --git a/gdb/testsuite/gdb.base/async.exp b/gdb/testsuite/gdb.base/async.exp index cae10f7..2f3ee9f 100644 --- a/gdb/testsuite/gdb.base/async.exp +++ b/gdb/testsuite/gdb.base/async.exp @@ -109,7 +109,7 @@ gdb_test_multiple {x/2i $pc} "$test" { } } set next_insn_is_stmt \ - [expr [lsearch -regexp $is_stmt 0x0*$next_insn_addr] != -1] + [expr {[lsearch -regexp $is_stmt 0x0*$next_insn_addr] != -1}] if { $next_insn_is_stmt } { set prefix "" diff --git a/gdb/testsuite/gdb.base/attach-pie-misread.exp b/gdb/testsuite/gdb.base/attach-pie-misread.exp index 04fe951..5f85d00 100644 --- a/gdb/testsuite/gdb.base/attach-pie-misread.exp +++ b/gdb/testsuite/gdb.base/attach-pie-misread.exp @@ -39,18 +39,18 @@ proc read_phdr {binfile test} { set readelf_program [gdb_find_readelf] set command "exec $readelf_program -Wl $binfile" verbose -log "command is $command" - set result [catch $command output] + set result [catch {{*}$command} output] verbose -log "result is $result" verbose -log "output is $output" if {$result != 0} { fail $test return } - if ![regexp {\nProgram Headers:\n *Type [^\n]* Align\n(.*?)\n\n} $output trash phdr] { + if {![regexp {\nProgram Headers:\n *Type [^\n]* Align\n(.*?)\n\n} $output trash phdr]} { fail "$test (no Program Headers)" return } - if ![regexp -line {^ *DYNAMIC +0x[0-9a-f]+ +(0x[0-9a-f]+) } $phdr trash dynamic_vaddr] { + if {![regexp -line {^ *DYNAMIC +0x[0-9a-f]+ +(0x[0-9a-f]+) } $phdr trash dynamic_vaddr]} { fail "$test (no DYNAMIC found)" return } @@ -74,7 +74,7 @@ set phdr [read_phdr $binfile "readelf initial scan"] set dynamic_vaddr [lindex $phdr 0] set align_max [lindex $phdr 1] -set stub_size [format 0x%x [expr "2 * $align_max - ($dynamic_vaddr & ($align_max - 1))"]] +set stub_size [format 0x%x [expr {2 * $align_max - ($dynamic_vaddr & ($align_max - 1))}]] verbose -log "stub_size is $stub_size" # On x86_64 it is commonly about 4MB. @@ -86,7 +86,7 @@ if {$stub_size > 25000000} { set test "generate stub" set command "exec $binfile $stub_size >$genfile" verbose -log "command is $command" -set result [catch $command output] +set result [catch {{*}$command} output] verbose -log "result is $result" verbose -log "output is $output" if {$result == 0} { @@ -109,14 +109,14 @@ file delete -- $genfile set phdr [read_phdr $binfile "readelf rebuilt with stub_size"] set dynamic_vaddr_prelinkno [lindex $phdr 0] -if ![prelink_yes $prelink_args] { +if {![prelink_yes $prelink_args]} { return -1 } set phdr [read_phdr $binfile "readelf with prelink -R"] set dynamic_vaddr_prelinkyes [lindex $phdr 0] -set first_offset [format 0x%x [expr $dynamic_vaddr_prelinkyes - $dynamic_vaddr_prelinkno]] +set first_offset [format 0x%x [expr {$dynamic_vaddr_prelinkyes - $dynamic_vaddr_prelinkno}]] verbose -log "first_offset is $first_offset" set test "first offset is non-zero" @@ -156,7 +156,7 @@ gdb_expect { foreach align_mult {1 2} { with_test_prefix "shift-by-$align_mult" { # FIXME: We believe there is enough room under FIRST_OFFSET. - set shifted_offset [format 0x%x [expr "$first_offset - $align_mult * $align_max"]] + set shifted_offset [format 0x%x [expr {$first_offset - $align_mult * $align_max}]] verbose -log "shifted_offset is $shifted_offset" # For normal prelink (prelink_yes call), we need to supply $prelink_args. @@ -165,7 +165,7 @@ foreach align_mult {1 2} { with_test_prefix "shift-by-$align_mult" { # as the libraries would also get relocated. set command "exec /usr/sbin/prelink -q -N --no-exec-shield -r $shifted_offset $binfile" verbose -log "command is $command" - set result [catch $command output] + set result [catch {{*}$command} output] verbose -log "result is $result" verbose -log "output is $output" diff --git a/gdb/testsuite/gdb.base/attach-pie-noexec.exp b/gdb/testsuite/gdb.base/attach-pie-noexec.exp index 877cb4a..58f1890 100644 --- a/gdb/testsuite/gdb.base/attach-pie-noexec.exp +++ b/gdb/testsuite/gdb.base/attach-pie-noexec.exp @@ -30,7 +30,7 @@ gdb_test_multiple $test $test { pass $test } } -if ![runto_main] { +if {![runto_main]} { return 0 } set test "sanity check info shared" diff --git a/gdb/testsuite/gdb.base/attach.exp b/gdb/testsuite/gdb.base/attach.exp index d0a29f2..c4e27a1 100644 --- a/gdb/testsuite/gdb.base/attach.exp +++ b/gdb/testsuite/gdb.base/attach.exp @@ -84,7 +84,7 @@ proc_with_prefix do_attach_failure_tests {} { } -re "Attaching to.*, process .*couldn't open /proc file.*$gdb_prompt $" { # Response expected from /proc-based systems. - pass "$test" + pass "$test" } -re "Can't attach to process..*$gdb_prompt $" { # Response expected on Cygwin @@ -105,7 +105,7 @@ proc_with_prefix do_attach_failure_tests {} { } -re "Attaching to.*, process .*couldn't open /proc file.*$gdb_prompt $" { # Response expected from /proc-based systems. - pass "$test" + pass "$test" } -re "Can't attach to process..*$gdb_prompt $" { # Response expected on Cygwin @@ -157,7 +157,7 @@ proc_with_prefix do_attach_failure_tests {} { pass "$test" } } - + # Verify that we can't double attach to the process. set test "first attach" @@ -242,7 +242,7 @@ proc_with_prefix do_attach_tests {} { # (Actually, the test system appears to do this automatically for # us. So, we must also be prepared to be asked if we want to # discard an existing set of symbols.) - + set test "set file, before attach1" gdb_test_multiple "file $binfile" "$test" { -re "Load new symbol table from.*y or n. $" { @@ -267,25 +267,25 @@ proc_with_prefix do_attach_tests {} { # Verify that we can "see" the variable "should_exit" in the # program, and that it is zero. - + gdb_test "print should_exit" " = 0" "after attach1, print should_exit" # Detach the process. - + gdb_test "detach" \ "Detaching from program: .*$escapedbinfile, process $testpid\r\n\\\[Inferior $decimal \\(.*\\) detached\\\]" \ "attach1 detach" # Wait a bit for gdb to finish detaching - + exec sleep 5 # Purge the symbols from gdb's brain. (We want to be certain the # next attach, which won't be preceded by a "file" command, is # really getting the executable file without our help.) - + set old_timeout $timeout - set timeout 15 + set timeout 15 set test "attach1, purging symbols after detach" gdb_test_multiple "file" "$test" { -re "No executable file now.*Discard symbol table.*y or n. $" { @@ -296,7 +296,7 @@ proc_with_prefix do_attach_tests {} { # Verify that we can attach to the process just by giving the # process ID. - + set test "attach2, with no file" set found_exec_file 0 gdb_test_multiple "attach $testpid" "$test" { @@ -356,7 +356,7 @@ proc_with_prefix do_attach_tests {} { # Verify that we can attach to the process, and find its a.out # when we're cd'd to some directory that doesn't contain the # a.out. (We use the source path set by the "dir" command.) - + gdb_test "dir [standard_output_file {}]" "Source directories searched: .*" \ "set source path" @@ -389,7 +389,7 @@ proc_with_prefix do_attach_tests {} { "$test" \ "Kill the program being debugged.*y or n. $" \ "y" - + # Another "don't leave a process around" kill_wait_spawned_process $test_spawn_id } @@ -406,7 +406,7 @@ proc_with_prefix do_call_attach_tests {} { set testpid [spawn_id_get_pid $test_spawn_id] # Attach - + gdb_test "file $binfile2" ".*" "load file" set test "attach call" gdb_test_multiple "attach $testpid" "$test" { @@ -422,7 +422,7 @@ proc_with_prefix do_call_attach_tests {} { } # See if other registers are problems - + set test "info other register" gdb_test_multiple "i r r3" "$test" { -re "warning: reading register.*$gdb_prompt $" { @@ -434,12 +434,12 @@ proc_with_prefix do_call_attach_tests {} { } # Get rid of the process - + gdb_test "p should_exit = 1" gdb_continue_to_end - + # Be paranoid - + kill_wait_spawned_process $test_spawn_id } @@ -591,7 +591,7 @@ proc_with_prefix do_attach_exec_mismatch_handling_tests {} { gdb_test "y" "Reading symbols from .*attach.*" $gdb_test_name } } - + gdb_test "detach" "Detaching from program: .* detached\\\]" "$test detach attach initial exec-file" diff --git a/gdb/testsuite/gdb.base/auxv.exp b/gdb/testsuite/gdb.base/auxv.exp index 38efa45..0bb4c36 100644 --- a/gdb/testsuite/gdb.base/auxv.exp +++ b/gdb/testsuite/gdb.base/auxv.exp @@ -37,7 +37,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \ # Make it the working directory for the inferior. set coredir [standard_output_file coredir.[getpid]] file mkdir $coredir -set core_works [expr [isnative] && ! [is_remote target]] +set core_works [expr {[isnative] && ! [is_remote target]}] # Run GDB on the test program up to where it will dump core. diff --git a/gdb/testsuite/gdb.base/basic-edit-cmd.exp b/gdb/testsuite/gdb.base/basic-edit-cmd.exp index 7ad8ab9..ad5c9a5 100644 --- a/gdb/testsuite/gdb.base/basic-edit-cmd.exp +++ b/gdb/testsuite/gdb.base/basic-edit-cmd.exp @@ -42,7 +42,7 @@ if {![runto_main]} { # Are we using DWARF debug format? get_debug_format -set non_dwarf [expr ! [test_debug_format "DWARF \[0-9\]"]] +set non_dwarf [expr {! [test_debug_format "DWARF \[0-9\]"]}] # Find line numbers for use in tests. set line_0 [gdb_get_line_number "prologue location"] diff --git a/gdb/testsuite/gdb.base/batch-exit-status.exp b/gdb/testsuite/gdb.base/batch-exit-status.exp index a2c3dea..86e5fdd 100644 --- a/gdb/testsuite/gdb.base/batch-exit-status.exp +++ b/gdb/testsuite/gdb.base/batch-exit-status.exp @@ -29,7 +29,7 @@ proc _test_exit_status {expect_status cmdline_opts {re ""}} { return } - set has_re [expr ![string equal $re ""]] + set has_re [expr {![string equal $re ""]}] if { ! $has_re } { set re "\$FOOBAR^" } diff --git a/gdb/testsuite/gdb.base/batch-preserve-term-settings.exp b/gdb/testsuite/gdb.base/batch-preserve-term-settings.exp index 8995997..52b546c 100644 --- a/gdb/testsuite/gdb.base/batch-preserve-term-settings.exp +++ b/gdb/testsuite/gdb.base/batch-preserve-term-settings.exp @@ -23,7 +23,7 @@ if {[build_executable "failed to prepare" $testfile $srcfile debug] == -1} { } set file_arg $binfile -if [is_remote host] { +if {[is_remote host]} { set file_arg [remote_download host $file_arg] } @@ -46,11 +46,11 @@ proc spawn_shell {} { # Try to match: # PS1="gdb-subshell$ "^M - # $ gdb-subshell$ + # $ gdb-subshell$ # or: # PS1="gdb-subshell$ "^M # sh-4.4$ PS1="gdb-subshell$ "^M - # gdb-subshell$ + # gdb-subshell$ set gotit 0 set test "spawn shell" gdb_expect { @@ -88,7 +88,7 @@ proc exit_shell {} { pass "$test" } } - if ![is_remote host] { + if {![is_remote host]} { remote_close host } } @@ -131,7 +131,7 @@ proc test_terminal_settings_preserved {} { global gdb_prompt global shell_prompt_re - if ![spawn_shell] { + if {![spawn_shell]} { return } @@ -176,7 +176,7 @@ proc test_terminal_settings_preserved {} { } set test "terminal settings preserved" - if $stty_supported { + if {$stty_supported} { run_stty "stty after" stty_after gdb_assert [string equal $stty_before $stty_after] $test @@ -224,7 +224,7 @@ proc test_terminal_settings_preserved_after_cli_exit { cmds } { global gdb_prompt global shell_prompt_re - if ![spawn_shell] { + if {![spawn_shell]} { return } @@ -263,7 +263,7 @@ proc test_terminal_settings_preserved_after_cli_exit { cmds } { send_quit_command "quit gdb" set test "terminal settings preserved" - if $stty_supported { + if {$stty_supported} { run_stty "stty after" stty_after gdb_assert [string equal $stty_before $stty_after] $test @@ -286,11 +286,11 @@ proc test_terminal_settings_preserved_after_sigterm { } { # On Windows, GDB's "shell" command spawns cmd.exe, which does not # understand PPID. So we're out of luck even if the test harness # uses a remote_exec shell with a working "kill" command. - if [ishost *-*-mingw*] { + if {[ishost *-*-mingw*]} { return } - if ![spawn_shell] { + if {![spawn_shell]} { return } @@ -347,13 +347,13 @@ proc test_terminal_settings_preserved_after_sigterm { } { } } - if !$gdb_killed { + if {!$gdb_killed} { send_quit_command "quit gdb" } } set test "terminal settings preserved" - if $stty_supported { + if {$stty_supported} { run_stty "stty after" stty_after gdb_assert [string equal $stty_before $stty_after] $test diff --git a/gdb/testsuite/gdb.base/bfd-errors.exp b/gdb/testsuite/gdb.base/bfd-errors.exp index 8e51f09..f298247 100644 --- a/gdb/testsuite/gdb.base/bfd-errors.exp +++ b/gdb/testsuite/gdb.base/bfd-errors.exp @@ -39,7 +39,7 @@ # # This test then loads the shared library's symbol table (and other # debug info) using the 'add-symbol-file' command. While doing this, -# the test observes and records the BFD errors that were output. +# the test observes and records the BFD errors that were output. # Finally, data collected while adding the shared library symbols are # examined to make sure that identical messages were suppressed while # also making sure that at least two messages have been printed. @@ -87,10 +87,10 @@ close $solib_fp set objcopy_program [gdb_find_objcopy] # Extract the .dynsym and .dynstr section from the shared object. -if { [catch "exec $objcopy_program \ - --dump-section .dynsym=${binfile_lib}.dynsym \ - --dump-section .dynstr=${binfile_lib}.dynstr \ - ${binfile_lib}" output] } { +if { [catch {exec $objcopy_program \ + --dump-section .dynsym=${binfile_lib}.dynsym \ + --dump-section .dynstr=${binfile_lib}.dynstr \ + ${binfile_lib}} output] } { untested "failed objcopy dump-section" verbose -log "objcopy output: $output" return -1 @@ -119,29 +119,29 @@ if { $is_elf64 } { } else { set sz 16 } -set cnt [expr $dynsym_len / $sz] +set cnt [expr {$dynsym_len / $sz}] # Create 32-bit patterns (bad offsets) to write into the st_name area. if { $is_big_endian } { - set pat(0) [binary format I [expr $dynstr_len + 1000]] - set pat(1) [binary format I [expr $dynstr_len + 2000]] + set pat(0) [binary format I [expr {$dynstr_len + 1000}]] + set pat(1) [binary format I [expr {$dynstr_len + 2000}]] } else { - set pat(0) [binary format i [expr $dynstr_len + 1000]] - set pat(1) [binary format i [expr $dynstr_len + 2000]] + set pat(0) [binary format i [expr {$dynstr_len + 1000}]] + set pat(1) [binary format i [expr {$dynstr_len + 2000}]] } # Mangle st_name for the symbols following the first (STN_UNDEF) entry. while { [incr cnt -1] > 0 } { seek $dynsym_fp [incr off $sz] - puts $dynsym_fp $pat([expr $cnt % 2]) + puts $dynsym_fp $pat([expr {$cnt % 2}]) } close $dynsym_fp # Replace .dynsym section in shared object with the mangled version. -if { [catch "exec $objcopy_program \ - --update-section .dynsym=${binfile_lib}.dynsym \ - ${binfile_lib}" output] } { +if { [catch {exec $objcopy_program \ + --update-section .dynsym=${binfile_lib}.dynsym \ + ${binfile_lib}} output] } { untested "failed objcopy update-section" verbose -log "objcopy output: $output" return -1 diff --git a/gdb/testsuite/gdb.base/bfp-test.exp b/gdb/testsuite/gdb.base/bfp-test.exp index 53d274f..1251868 100644 --- a/gdb/testsuite/gdb.base/bfp-test.exp +++ b/gdb/testsuite/gdb.base/bfp-test.exp @@ -39,7 +39,7 @@ gdb_test "print b32" ".*1 = 1\.5.*" "the original value of b32 is 1.5" gdb_test "print b64" ".*2 = 2\.25.*" "the original value of b64 is 2.25" gdb_test "print b128" ".*3 = 3\.375.*" "the original value of b128 is 3.375" -# Test that gdb could correctly recognize float constant expression with a suffix. +# Test that gdb could correctly recognize float constant expression with a suffix. gdb_test "print b32=-1.5f" ".*4 = -1\.5.*" "try to change b32 to -1.5 with 'print b32=-1.5f'" gdb_test "print b64=-2.25f" ".*5 = -2\.25.*" "try to change b64 to -2.25 with 'print b64=-2.25f'" gdb_test "print b128=-3.375l" ".*6 = -3\.375.*" "try to change b128 to -3.375 with 'print b128=-3.375l'" diff --git a/gdb/testsuite/gdb.base/bg-execution-repeat.exp b/gdb/testsuite/gdb.base/bg-execution-repeat.exp index e7bdf49..923092b 100644 --- a/gdb/testsuite/gdb.base/bg-execution-repeat.exp +++ b/gdb/testsuite/gdb.base/bg-execution-repeat.exp @@ -36,7 +36,7 @@ proc test {continue_cmd} { clean_restart gdb_load $binfile - if ![runto_main] { + if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.base/bigcore.exp b/gdb/testsuite/gdb.base/bigcore.exp index f917eb8..7066a63 100644 --- a/gdb/testsuite/gdb.base/bigcore.exp +++ b/gdb/testsuite/gdb.base/bigcore.exp @@ -28,8 +28,8 @@ require isnative # I/O bandwidth. if { [istarget "*-*-*bsd*"] - || [istarget "*-*-solaris*"] - || [istarget "*-*-darwin*"] + || [istarget "*-*-solaris*"] + || [istarget "*-*-darwin*"] || [istarget "*-*-cygwin*"] } { untested "kernel lacks sparse corefile support (PR gdb/1551)" return diff --git a/gdb/testsuite/gdb.base/bitfields.exp b/gdb/testsuite/gdb.base/bitfields.exp index c463865..9a5eaff 100644 --- a/gdb/testsuite/gdb.base/bitfields.exp +++ b/gdb/testsuite/gdb.base/bitfields.exp @@ -165,7 +165,7 @@ proc bitfield_at_offset {} { global srcfile gdb_breakpoint break5 - if [gdb_test "cont" "Break.*break5 \\(\\) at .*$srcfile:$decimal.*" "continuing to break5"] { + if {[gdb_test "cont" "Break.*break5 \\(\\) at .*$srcfile:$decimal.*" "continuing to break5"]} { return } diff --git a/gdb/testsuite/gdb.base/bitfields2.exp b/gdb/testsuite/gdb.base/bitfields2.exp index 3e981dd..124f9c2 100644 --- a/gdb/testsuite/gdb.base/bitfields2.exp +++ b/gdb/testsuite/gdb.base/bitfields2.exp @@ -13,11 +13,11 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -# This file was adapted from bitfields.exp by Paul Hilfinger +# This file was adapted from bitfields.exp by Paul Hilfinger # (Hilfinger@gnat.com) # -# Tests for bit-fields that do not fit in type (unsigned) int, but do fit +# Tests for bit-fields that do not fit in type (unsigned) int, but do fit # in type (unsigned) long long. We perform essentially the same tests as # in bitfields.c, which considers only bit-fields that are <= 9 bits long. # @@ -33,7 +33,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb set has_signed_bitfields 1 # -# Continue to expected breakpoint at FUNCTION. Append TAG to make pass/fail +# Continue to expected breakpoint at FUNCTION. Append TAG to make pass/fail # messages (to make them unique). Suppress tests on failure. # proc continue_test { function tag } { @@ -54,7 +54,7 @@ proc start_test { function } { gdb_breakpoint $function continue_test $function "#0" } - + # # Test bitfield locating and uniqueness. diff --git a/gdb/testsuite/gdb.base/bitops.exp b/gdb/testsuite/gdb.base/bitops.exp index 6bd8675..0bf6b20 100644 --- a/gdb/testsuite/gdb.base/bitops.exp +++ b/gdb/testsuite/gdb.base/bitops.exp @@ -20,7 +20,7 @@ # tests expressions with bitwise operators, and some # logical operators # Does not use a target program -# +# # diff --git a/gdb/testsuite/gdb.base/bitshift.exp b/gdb/testsuite/gdb.base/bitshift.exp index 8cc2514..1e308f2 100644 --- a/gdb/testsuite/gdb.base/bitshift.exp +++ b/gdb/testsuite/gdb.base/bitshift.exp @@ -158,6 +158,7 @@ foreach signed {0 1} { set sign_prefix "u" } foreach bits {8 16 32 64} { + # tclint-disable-next-line command-args proc make_${sign_prefix}int${bits} {lang val} \ "make_val_cast \$lang $signed $bits \$val" } diff --git a/gdb/testsuite/gdb.base/bp-permanent.exp b/gdb/testsuite/gdb.base/bp-permanent.exp index 3ae5efe..df51126 100644 --- a/gdb/testsuite/gdb.base/bp-permanent.exp +++ b/gdb/testsuite/gdb.base/bp-permanent.exp @@ -103,7 +103,7 @@ proc test {always_inserted sw_watchpoint} { # We now have the breakpoint instruction stored in 'buffer'. Poke it # to memory manually. - set count [expr $address_after_bp - $address_bp] + set count [expr {$address_after_bp - $address_bp}] for {set i 0} {$i < $count} {incr i} { set test "p /x addr_bp\[$i\] = buffer\[$i\]" gdb_test_multiple $test $test { @@ -216,7 +216,7 @@ proc test {always_inserted sw_watchpoint} { gdb_test "next" "after next .*" } - if ![target_info exists gdb,nosignals] { + if {![target_info exists gdb,nosignals]} { with_test_prefix "continue trips on nested permanent bp" { delete_breakpoints @@ -242,7 +242,7 @@ proc test {always_inserted sw_watchpoint} { gdb_test "p counter" " = 2" } - if [can_single_step_to_signal_handler] { + if {[can_single_step_to_signal_handler]} { with_test_prefix "stepi signal with handler" { delete_breakpoints diff --git a/gdb/testsuite/gdb.base/branch-to-self.exp b/gdb/testsuite/gdb.base/branch-to-self.exp index 8f8e8ad..3f09786 100644 --- a/gdb/testsuite/gdb.base/branch-to-self.exp +++ b/gdb/testsuite/gdb.base/branch-to-self.exp @@ -27,7 +27,7 @@ with_test_prefix "single-step" { global testfile clean_restart ${testfile} - if ![runto_main] { + if {![runto_main]} { return -1 } set line_num [gdb_get_line_number "loop-line" ${testfile}.c] @@ -60,7 +60,7 @@ with_test_prefix "break-cond" { clean_restart ${testfile} - if ![runto_main] { + if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/break-caller-line.exp b/gdb/testsuite/gdb.base/break-caller-line.exp index bc3604e..9925a1d 100644 --- a/gdb/testsuite/gdb.base/break-caller-line.exp +++ b/gdb/testsuite/gdb.base/break-caller-line.exp @@ -19,7 +19,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile}] } { return -1 } -if ![runto callee] { +if {![runto callee]} { return 0 } diff --git a/gdb/testsuite/gdb.base/break-entry.exp b/gdb/testsuite/gdb.base/break-entry.exp index 4ea1158..584ddaf 100644 --- a/gdb/testsuite/gdb.base/break-entry.exp +++ b/gdb/testsuite/gdb.base/break-entry.exp @@ -56,7 +56,7 @@ if {[istarget powerpc64-*] && [is_lp64_target]} { } } -if ![runto "*$entry"] { +if {![runto "*$entry"]} { return } gdb_test {p/x $pc} " = $entry" diff --git a/gdb/testsuite/gdb.base/break-idempotent.exp b/gdb/testsuite/gdb.base/break-idempotent.exp index 3b32c89..842ce42 100644 --- a/gdb/testsuite/gdb.base/break-idempotent.exp +++ b/gdb/testsuite/gdb.base/break-idempotent.exp @@ -165,7 +165,7 @@ foreach_with_prefix pie { "nopie" "pie" } { continue } - if [is_remote host] { + if {[is_remote host]} { set arg [remote_download host $binfile] if { $arg == "" } { untested "download failed" diff --git a/gdb/testsuite/gdb.base/break-interp.exp b/gdb/testsuite/gdb.base/break-interp.exp index 038c3ea..f06c15f 100644 --- a/gdb/testsuite/gdb.base/break-interp.exp +++ b/gdb/testsuite/gdb.base/break-interp.exp @@ -49,19 +49,19 @@ proc system_debug_get {exec} { # isfile returns 1 even for symlinks to files. set retval $debug_root/$exec_build_id_debug - if [file isfile $retval] { + if {[file isfile $retval]} { return $retval } set retval $exec_dir/$debug_base - if [file isfile $retval] { + if {[file isfile $retval]} { return $retval } set retval $exec_dir/.debug/$debug_base - if [file isfile $retval] { + if {[file isfile $retval]} { return $retval } set retval $debug_root/$exec_dir/$debug_base - if [file isfile $retval] { + if {[file isfile $retval]} { return $retval } return "" @@ -108,7 +108,7 @@ proc strip_debug {dest} { set strip_program [transform strip] set command "exec $strip_program --strip-debug $dest" verbose -log "command is $command" - if [catch $command] { + if {[catch {{*}$command}]} { fail $test return 0 } else { @@ -186,7 +186,7 @@ proc reach_1 {func command displacement} { } } } - if ![regexp {^(NONE|FOUND-.*)$} $displacement] { + if {![regexp {^(NONE|FOUND-.*)$} $displacement]} { fail $test_displacement } @@ -257,7 +257,7 @@ proc test_core {file displacement} { pass $test } } - if ![regexp {^(NONE|FOUND-.*)$} $displacement] { + if {![regexp {^(NONE|FOUND-.*)$} $displacement]} { fail $test_displacement } gdb_test_no_output "set verbose off" @@ -308,7 +308,7 @@ proc test_attach_gdb {file pid displacement prefix} { pass $test } } - if ![regexp {^(NONE|FOUND-.*)$} $displacement] { + if {![regexp {^(NONE|FOUND-.*)$} $displacement]} { fail $test_displacement } gdb_test_no_output "set verbose off" @@ -381,7 +381,7 @@ proc test_attach {file displacement {relink_args ""}} { # `libfunc' is present in the backtrace and therefore the # displacement has been guessed right. - if [prelink$relink $relink_args [file tail $exec]] { + if {[prelink$relink $relink_args [file tail $exec]]} { # /proc/PID/exe cannot be loaded as it is "EXECNAME (deleted)". test_attach_gdb $exec $pid $displacement "attach-relink$relink" } @@ -411,7 +411,7 @@ proc test_ld {file ifmain trynosym displacement} { # prevents that from happening. So turn it off. gdb_test "set disable-randomization off" - if $ifmain { + if {$ifmain} { gdb_test_no_output "set args segv" } else { global binfile_test @@ -450,7 +450,7 @@ proc test_ld {file ifmain trynosym displacement} { gdb_test_no_output "set verbose on" } - if $ifmain { + if {$ifmain} { reach "main" continue "NONE" reach "libfunc" continue "NONE" @@ -467,13 +467,13 @@ proc test_ld {file ifmain trynosym displacement} { reach $solib_bp "run" $displacement 2 gdb_test_no_output "set verbose off" - if $ifmain { + if {$ifmain} { test_core $file $displacement test_attach $file $displacement } - if !$trynosym { + if {!$trynosym} { return } @@ -494,7 +494,7 @@ proc test_ld {file ifmain trynosym displacement} { set escapedfile [string_to_regexp $file] gdb_test "exec-file $file" "exec-file $escapedfile" "load" - if $ifmain { + if {$ifmain} { reach $solib_bp run $displacement 3 set entrynohex "" @@ -550,7 +550,7 @@ proc test_ld {file ifmain trynosym displacement} { pass $test } } - if ![regexp {^(NONE|FOUND-.*)$} $displacement] { + if {![regexp {^(NONE|FOUND-.*)$} $displacement]} { fail $test_displacement } } @@ -589,7 +589,7 @@ foreach_with_prefix ldprelink {NO YES} { file_copy $interp_system $interp # Never call strip-debug before unprelink: # prelink: ...: Section .note.gnu.build-id created after prelinking - if ![prelinkNO $interp] { + if {![prelinkNO $interp]} { continue } strip_debug $interp @@ -605,7 +605,7 @@ foreach_with_prefix ldprelink {NO YES} { set test "eu-unstrip unprelinked:[file tail $interp_system] + [file tail $interp_system_debug] to [file tail $interp]" set command "exec eu-unstrip -o $interp $interp ${interp}.debug" verbose -log "command is $command" - if [catch $command] { + if {[catch {{*}$command}]} { setup_xfail *-*-* fail $test continue @@ -615,7 +615,7 @@ foreach_with_prefix ldprelink {NO YES} { } elseif {$ldsepdebug == "SEP" && $interp_system_debug == ""} { file_copy $interp_system $interp # eu-unstrip: DWARF data in '...' not adjusted for prelinking bias; consider prelink -u - if ![prelinkNO $interp] { + if {![prelinkNO $interp]} { continue } gdb_gnu_strip_debug $interp @@ -625,14 +625,14 @@ foreach_with_prefix ldprelink {NO YES} { } if {$ldsepdebug == "SEP"} { - if ![prelinkNO "${interp}.debug"] { + if {![prelinkNO "${interp}.debug"]} { continue } } else { file delete "${interp}.debug" } - if ![prelink$ldprelink $interp "[file tail $interp], second time"] { + if {![prelink$ldprelink $interp "[file tail $interp], second time"]} { continue } @@ -647,7 +647,7 @@ foreach_with_prefix ldprelink {NO YES} { } test_ld $interp 0 [expr {$ldsepdebug == "NO"}] $displacement - if ![file_copy $interp $interp_saved] { + if {![file_copy $interp $interp_saved]} { continue } diff --git a/gdb/testsuite/gdb.base/break-main-file-remove-fail.exp b/gdb/testsuite/gdb.base/break-main-file-remove-fail.exp index 19b2446..4dd88cd 100644 --- a/gdb/testsuite/gdb.base/break-main-file-remove-fail.exp +++ b/gdb/testsuite/gdb.base/break-main-file-remove-fail.exp @@ -55,7 +55,7 @@ proc test_remove_bp { initial_load } { gdb_reload } - if ![runto start] { + if {![runto start]} { return } @@ -86,7 +86,7 @@ proc test_remove_bp { initial_load } { # remove the memory breakpoint afterwards should fail, and GDB # should warn the user about it. set pagesize [get_integer_valueof "pg_size" 0] - set align_addr [expr $bp_addr - $bp_addr % $pagesize] + set align_addr [expr {$bp_addr - $bp_addr % $pagesize}] set munmap_prototype "int (*) (void *, size_t)" set munmap_expr "(($munmap_prototype) munmap) ($align_addr, $pagesize)" diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp index 1eec984..e1f4860 100644 --- a/gdb/testsuite/gdb.base/break.exp +++ b/gdb/testsuite/gdb.base/break.exp @@ -765,7 +765,7 @@ proc_with_prefix test_next_with_recursion {} { delete_breakpoints - if [istarget "mips*tx39-*"] { + if {[istarget "mips*tx39-*"]} { set timeout 60 } # We used to set timeout here for all other targets as well. This diff --git a/gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp b/gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp index 4b060b8..7c6b1cb 100644 --- a/gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp +++ b/gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp @@ -25,7 +25,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } @@ -139,7 +139,7 @@ proc get_next_insn {} { set hw_step [probe_target_hardware_step] -if ![get_function_bounds "main" main_lo main_hi] { +if {![get_function_bounds "main" main_lo main_hi]} { # Can't do the following tests if main's bounds are unknown. return -1 } diff --git a/gdb/testsuite/gdb.base/breakpoint-shadow.exp b/gdb/testsuite/gdb.base/breakpoint-shadow.exp index a662016..8e74ec2 100644 --- a/gdb/testsuite/gdb.base/breakpoint-shadow.exp +++ b/gdb/testsuite/gdb.base/breakpoint-shadow.exp @@ -20,7 +20,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { } # We need to start the inferior to place the breakpoints in the memory at all. -if ![runto_main] { +if {![runto_main]} { return -1 } @@ -51,7 +51,7 @@ proc test_disassembly {test} { gdb_test_multiple "disass main" $test { -re $match { set got $expect_out(1,string) - if [string equal -nocase $orig $got] { + if {[string equal -nocase $orig $got]} { pass $test } else { fail $test diff --git a/gdb/testsuite/gdb.base/bt-on-fatal-signal.exp b/gdb/testsuite/gdb.base/bt-on-fatal-signal.exp index 63428a1..1ef9774 100644 --- a/gdb/testsuite/gdb.base/bt-on-fatal-signal.exp +++ b/gdb/testsuite/gdb.base/bt-on-fatal-signal.exp @@ -126,7 +126,7 @@ foreach test_data {{SEGV "Segmentation fault"} \ gdb_assert { $saw_fatal_msg } gdb_assert { $saw_bt_start } gdb_assert { $saw_bt_end } - gdb_assert { [expr $internal_error_msg_count == 2] } + gdb_assert { [expr {$internal_error_msg_count == 2}] } } -re "$gdb_prompt $" { # GDB should terminate, we should never get back to diff --git a/gdb/testsuite/gdb.base/call-ar-st.exp b/gdb/testsuite/gdb.base/call-ar-st.exp index 8b27d8d..fd1f1a0 100644 --- a/gdb/testsuite/gdb.base/call-ar-st.exp +++ b/gdb/testsuite/gdb.base/call-ar-st.exp @@ -38,7 +38,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile $flags]} { set oldtimeout $timeout -set timeout [expr "$timeout + 60"] +set timeout [expr {$timeout + 60}] gdb_test_no_output "set print sevenbit-strings" gdb_test_no_output "set print address off" @@ -86,7 +86,7 @@ set array_c_re \ "aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ" \ "aZaZaZaZaZaZaZaZaZa"] -if ![gdb_skip_stdio_test "print_char_array(char_array)"] { +if {![gdb_skip_stdio_test "print_char_array(char_array)"]} { gdb_test_stdio "print print_char_array(char_array)" $array_c_re } @@ -95,7 +95,7 @@ gdb_test "tbreak $stop_line" \ "Temporary breakpoint.*file.*$srcfile, line $stop_line.*" \ "tbreakpoint at tbreak2" -if ![gdb_skip_stdio_test "continue to tbreak2"] { +if {![gdb_skip_stdio_test "continue to tbreak2"]} { set gdb_re \ [multi_line \ "main.*at.*:\[0-9\]+" \ @@ -106,7 +106,7 @@ if ![gdb_skip_stdio_test "continue to tbreak2"] { } # I am disabling this test, because it takes too long. I verified by -# hand that it works, feel free to check for yourself. +# hand that it works, feel free to check for yourself. #call print_all_arrays(integer_array, char_array, float_array, double_array) #send_gdb "print print_all_arrays(integer_array, char_array, float_array, double_array)\n" #gdb_expect { @@ -165,7 +165,7 @@ gdb_test "step" \ "step inside print_all_arrays" #step -over -if ![gdb_skip_stdio_test "next over print_int_array in print_all_arrays"] { +if {![gdb_skip_stdio_test "next over print_int_array in print_all_arrays"]} { set stop_line [gdb_get_line_number "-next1-"] gdb_test_stdio "next" \ "array_i :" \ @@ -214,7 +214,7 @@ if {$allow_float_test && \ #call sum_array_print(10, *list1, *list2, *list3, *list4) -if ![gdb_skip_stdio_test "print sum_array_print(...)"] { +if {![gdb_skip_stdio_test "print sum_array_print(...)"]} { gdb_test_stdio "print sum_array_print(10, *list1, *list2, *list3, *list4)" \ [multi_line \ @@ -239,7 +239,7 @@ if ![gdb_skip_stdio_test "print sum_array_print(...)"] { #step over set stop_line [gdb_get_line_number "-next2-"] -if ![gdb_skip_stdio_test "next to next2"] { +if {![gdb_skip_stdio_test "next to next2"]} { gdb_test_stdio "next" \ "BYE BYE FOR NOW" \ "$stop_line.*printf\\(.VERY GREEN GRASS.n.\\);.*" \ @@ -250,7 +250,7 @@ if ![gdb_skip_stdio_test "next to next2"] { #call print_array_rep(\*list1, \*list2, \*list3) -if ![gdb_skip_stdio_test "print print_array_rep(...)"] { +if {![gdb_skip_stdio_test "print print_array_rep(...)"]} { gdb_test_stdio "print print_array_rep(\*list1, \*list2, \*list3)" \ "Contents of linked list3:" } @@ -300,7 +300,7 @@ gdb_test "tbreak $stop_line" \ "Temporary breakpoint.* file .*$srcfile, line $stop_line.*" \ "tbreakpoint at tbreak6" -if ![gdb_skip_stdio_test "continuing to tbreak6"] { +if {![gdb_skip_stdio_test "continuing to tbreak6"]} { gdb_test_stdio "continue" \ "Sum of 4 arrays.*Contents of linked list1.*Contents of two_floats_t" \ "main \\(\\) at .*$srcfile:$stop_line.*c = 0.*" \ @@ -309,8 +309,8 @@ if ![gdb_skip_stdio_test "continuing to tbreak6"] { gdb_test "continue" ".*" "" } -#call print_small_structs(*struct1, *struct2, *struct3, *struct4, -# *flags, *flags_combo, *three_char, *five_char, +#call print_small_structs(*struct1, *struct2, *struct3, *struct4, +# *flags, *flags_combo, *three_char, *five_char, # *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3) if {$allow_float_test && \ @@ -373,7 +373,7 @@ gdb_test "print compute_with_small_structs(20)" \ "\[0-9\]+ = void" -#call print_ten_doubles(123.456, 123.456, -0.12, -1.23, 343434.8, 89.098, +#call print_ten_doubles(123.456, 123.456, -0.12, -1.23, 343434.8, 89.098, # 3.14, -5678.12345, -0.11111111, 216.97065) if {$allow_float_test && \ @@ -422,8 +422,8 @@ if {$allow_float_test} { set ws "\[\n\r\t \]+" -#call print_small_structs(struct1, struct2, struct3, struct4, flags, -# flags_combo, three_char, five_char, int_char_combo, +#call print_small_structs(struct1, struct2, struct3, struct4, flags, +# flags_combo, three_char, five_char, int_char_combo, # d1, d2, d3, f1, f2, f3) if {$allow_float_test && \ @@ -495,7 +495,7 @@ gdb_test "tbreak $stop_line" \ "Temporary breakpoint.* file .*$srcfile, line $stop_line.*" \ "tbreakpoint at tbreak8" -if ![gdb_skip_stdio_test "continuing to tbreak8"] { +if {![gdb_skip_stdio_test "continuing to tbreak8"]} { gdb_test_stdio "continue" \ "Contents of two_floats_t:" \ ".*main \\(\\) at.*$srcfile:$stop_line.*$stop_line.*init_bit_flags_combo\\(flags_combo, \\(unsigned\\)1, \\(unsigned\\)0, .y.,.*" \ @@ -511,7 +511,7 @@ gdb_test "step" \ "step into init_bit_flags_combo" #call print_bit_flags_combo(*bit_flags_combo) -if ![gdb_skip_stdio_test "continuing at step3"] { +if {![gdb_skip_stdio_test "continuing at step3"]} { gdb_test_stdio "print print_bit_flags_combo(*bit_flags_combo)" \ "alpha.*gamma.*epsilon.*ch1: y.*ch2: n" } @@ -600,14 +600,14 @@ gdb_test continue "Continuing\\..*main \\(\\) at .*$srcfile:$stop_line\[ \t\n\r\ #call sum_struct_print(10, *struct1, *struct2, *struct3, *struct4) -if ![gdb_skip_stdio_test "print sum_struct_print(...)"] { +if {![gdb_skip_stdio_test "print sum_struct_print(...)"]} { gdb_test_stdio "print sum_struct_print(10,*struct1,*struct2,*struct3,*struct4)" \ "Sum of the 4 struct values and seed :\[ \t\n\r\]+218" } #call print_struct_rep(*struct1, *struct2, *struct3) -if ![gdb_skip_stdio_test "print print_struct_rep(...)"] { +if {![gdb_skip_stdio_test "print print_struct_rep(...)"]} { gdb_test_stdio "print print_struct_rep(*struct1, *struct2, *struct3)" \ [multi_line \ "Contents of struct1: " \ @@ -622,7 +622,7 @@ if ![gdb_skip_stdio_test "print print_struct_rep(...)"] { ] } -if ![gdb_skip_stdio_test "print print_one_large_struct(...)"] { +if {![gdb_skip_stdio_test "print print_one_large_struct(...)"]} { gdb_test_stdio "print print_one_large_struct(*list1)" \ " 4 1" } diff --git a/gdb/testsuite/gdb.base/call-rt-st.exp b/gdb/testsuite/gdb.base/call-rt-st.exp index 511e209..4ce686b 100644 --- a/gdb/testsuite/gdb.base/call-rt-st.exp +++ b/gdb/testsuite/gdb.base/call-rt-st.exp @@ -109,13 +109,13 @@ proc print_struct_call { expr inf_result gdb_result } { } -if ![gdb_skip_stdio_test "print print_struct_rep(*struct1)"] { +if {![gdb_skip_stdio_test "print print_struct_rep(*struct1)"]} { print_struct_call "print_struct_rep(*struct1)" \ ".*Contents of struct1:\[ \t\n\r\]+22\[ \t\]+0\[ \t\n\r\]+" \ ".\[0-9\]+ = \\{value = 5, head = 0\\}" } -if ![gdb_skip_stdio_test "print print_one_large_struct(...)"] { +if {![gdb_skip_stdio_test "print print_one_large_struct(...)"]} { print_struct_call "print_one_large_struct(*list1)" \ ".*\[ \t\]+4\[ \t\]+1\[ \r\n\]+" \ ".\[0-9\]+ = \\{next_index = \\{1, 2, 3, 4, 5, 6, 7, 8, 9, 10\\}, values = \\{4, 6, 8, 10, 12, 14, 16, 18, 20, 22\\}, head = 0\\}" @@ -135,43 +135,43 @@ if {$allow_float_test && \ ".\[0-9\]+ = \\{float1 = -2\\.34500003, float2 = 1\\}" } -if ![gdb_skip_stdio_test "print print_bit_flags_char(*cflags)"] { +if {![gdb_skip_stdio_test "print print_bit_flags_char(*cflags)"]} { print_struct_call "print_bit_flags_char(*cflags)" \ ".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+" \ ".\[0-9\]+ = \\{alpha = 1 '\\\\001', beta = 0 '\\\\000', gamma = 1 '\\\\001', delta = 0 '\\\\000', epsilon = 1 '\\\\001', omega = 0 '\\\\000'\\}" } -if ![gdb_skip_stdio_test "print print_bit_flags_short(*sflags)"] { +if {![gdb_skip_stdio_test "print print_bit_flags_short(*sflags)"]} { print_struct_call "print_bit_flags_short(*sflags)" \ ".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+" \ ".\[0-9\]+ = \\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\\}" } -if ![gdb_skip_stdio_test "print print_bit_flags(*flags)"] { +if {![gdb_skip_stdio_test "print print_bit_flags(*flags)"]} { print_struct_call "print_bit_flags(*flags)" \ ".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+" \ ".\[0-9\]+ = \\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\\}" } -if ![gdb_skip_stdio_test "print print_bit_flags_combo(*flags_combo)"] { +if {![gdb_skip_stdio_test "print print_bit_flags_combo(*flags_combo)"]} { print_struct_call "print_bit_flags_combo(*flags_combo)" \ ".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+ch1: y\[ \t\]+ch2: n\[ \r\n\]+" \ ".\[0-9\]+ = \\{alpha = 1, beta = 0, ch1 = 121 'y', gamma = 1, delta = 0, ch2 = 110 'n', epsilon = 1, omega = 0\\}" } -if ![gdb_skip_stdio_test "print print_three_chars(*three_chars)"] { +if {![gdb_skip_stdio_test "print print_three_chars(*three_chars)"]} { print_struct_call "print_three_chars(*three_char)" \ ".*Contents of three_char_t:\[ \r\n\]+x\[ \t\]+y\[ \t\]+z\[ \r\n\]+" \ ".\[0-9\]+ = \\{ch1 = 120 'x', ch2 = 121 'y', ch3 = 122 'z'\\}" } -if ![gdb_skip_stdio_test "print print_five_chars(*five_chars)"] { +if {![gdb_skip_stdio_test "print print_five_chars(*five_chars)"]} { print_struct_call "print_five_chars(*five_char)" \ ".*Contents of five_char_t:\[ \r\n\]+h\[ \t\]+e\[ \t\]+l\[ \t\]+l\[ \t\]+o\[ \r\n\]+" \ ".\[0-9\]+ = \\{ch1 = 104 'h', ch2 = 101 'e', ch3 = 108 'l', ch4 = 108 'l', ch5 = 111 'o'\\}" } -if ![gdb_skip_stdio_test "print print_int_char_combo(*int_char_combo)"] { +if {![gdb_skip_stdio_test "print print_int_char_combo(*int_char_combo)"]} { print_struct_call "print_int_char_combo(*int_char_combo)" \ ".*Contents of int_char_combo_t:\[ \r\n\]+13\[ \t\]+!\[ \r\n\]+" \ ".\[0-9\]+ = \\{int1 = 13, ch1 = 33 '!'\\}" diff --git a/gdb/testsuite/gdb.base/call-sc.exp b/gdb/testsuite/gdb.base/call-sc.exp index f67670d..ff4e7ac 100644 --- a/gdb/testsuite/gdb.base/call-sc.exp +++ b/gdb/testsuite/gdb.base/call-sc.exp @@ -107,7 +107,7 @@ proc test_scalar_calls { } { # Check that GDB can always extract a scalar-return value from an # inferior function call. Since GDB always knows the location of # an inferior function call's return value these should never fail - + # Implemented by calling the parameterless function "fun" and then # examining the return value printed by GDB. @@ -250,7 +250,7 @@ proc test_scalar_returns { } { set test "value foo returned; ${tests}" gdb_test_multiple "p/c L" "${test}" { -re " = 49 '1'.*${gdb_prompt} $" { - if $return_value_unknown { + if {$return_value_unknown} { # This contradicts the above claim that GDB didn't # know the location of the return-value. fail "${test}" @@ -259,7 +259,7 @@ proc test_scalar_returns { } { } } -re " = 90 .*${gdb_prompt} $" { - if $return_value_unknown { + if {$return_value_unknown} { # The struct return case. Since any modification # would be by reference, and that can't happen, the # value should be unmodified and hence Z is expected. @@ -272,7 +272,7 @@ proc test_scalar_returns { } { } } -re " = 57 .*${gdb_prompt} $" { - if $return_value_unknown { + if {$return_value_unknown} { # The struct return case. # The return value is stored on the stack, and since GDB # didn't override it, it still has value that was stored @@ -285,7 +285,7 @@ proc test_scalar_returns { } { } } -re ".*${gdb_prompt} $" { - if $return_value_unimplemented { + if {$return_value_unimplemented} { # What a surprise. The architecture hasn't implemented # return_value, and hence has to fail. kfail "$test" gdb/1444 @@ -293,8 +293,8 @@ proc test_scalar_returns { } { fail "$test" } } - } - + } + # Check that a "finish" works. # This is almost but not quite the same as "call struct funcs". @@ -334,7 +334,7 @@ proc test_scalar_returns { } { set test "value foo finished; ${tests}" gdb_test_multiple "p/c" "${test}" { -re " = 49 '1'\[\r\n\]+${gdb_prompt} $" { - if $finish_value_unknown { + if {$finish_value_unknown} { # This contradicts the above claim that GDB didn't # know the location of the return-value. fail "${test}" @@ -344,7 +344,7 @@ proc test_scalar_returns { } { } -re " = 90 'Z'\[\r\n\]+${gdb_prompt} $" { # The value didn't get found. This is "expected". - if $finish_value_unknown { + if {$finish_value_unknown} { pass "${test}" } else { # This contradicts the above claim that GDB did diff --git a/gdb/testsuite/gdb.base/call-strs.exp b/gdb/testsuite/gdb.base/call-strs.exp index 43e4712..02eecb6 100644 --- a/gdb/testsuite/gdb.base/call-strs.exp +++ b/gdb/testsuite/gdb.base/call-strs.exp @@ -67,70 +67,70 @@ gdb_test "print s" \ " = \"test string\".*" #print str_func1(s) -if ![gdb_skip_stdio_test "print str_func1(s)"] { +if {![gdb_skip_stdio_test "print str_func1(s)"]} { gdb_test_stdio "print str_func1(s)" \ "first string arg is: test string" \ "\"test string\".*" } #print str_func1("test string") -if ![gdb_skip_stdio_test "print str_func1(teststring)"] { +if {![gdb_skip_stdio_test "print str_func1(teststring)"]} { gdb_test_stdio "print str_func1(\"test string\")" \ "first string arg is: test string" \ "\"test string\".*" } #call str_func1(s) -if ![gdb_skip_stdio_test "call str_func1(s)"] { +if {![gdb_skip_stdio_test "call str_func1(s)"]} { gdb_test_stdio "call str_func1(s)" \ "first string arg is: test string" \ "\"test string\".*" } #call str_func1("test string") -if ![gdb_skip_stdio_test "call str_func1 (...)"] { +if {![gdb_skip_stdio_test "call str_func1 (...)"]} { gdb_test_stdio "call str_func1(\"test string\")" \ "first string arg is: test string" \ "\"test string\".*" } #print str_func1(buf) -if ![gdb_skip_stdio_test "print str_func1(buf)"] { +if {![gdb_skip_stdio_test "print str_func1(buf)"]} { gdb_test_stdio "print str_func1(buf)" \ "first string arg is: test string" \ "\"test string\".*" } #call str_func1(buf) -if ![gdb_skip_stdio_test "call str_func1(buf)"] { +if {![gdb_skip_stdio_test "call str_func1(buf)"]} { gdb_test_stdio "call str_func1(buf)" \ "first string arg is: test string" \ "\"test string\".*" } #print str_func("a","b","c","d","e","f","g") -if ![gdb_skip_stdio_test "print str_func(a,b,c,d,e,f,g)"] { +if {![gdb_skip_stdio_test "print str_func(a,b,c,d,e,f,g)"]} { gdb_test_stdio "print str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")" \ "first string arg is: a\[ \t\r\n\]+second string arg is: b\[ \t\r\n\]+third string arg is: c\[ \t\r\n\]+fourth string arg is: d\[ \t\r\n\]+fifth string arg is: e\[ \t\r\n\]+sixth string arg is: f\[ \t\r\n\]+seventh string arg is: g\[ \t\r\n\]+" \ "= \"abcdefg\".*" } #call str_func("a","b","c","d","e","f","g") -if ![gdb_skip_stdio_test "call str_func(a,b,c,d,e,f,g)"] { +if {![gdb_skip_stdio_test "call str_func(a,b,c,d,e,f,g)"]} { gdb_test_stdio "call str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")" \ "first string arg is: a\[ \t\r\n\]+second string arg is: b\[ \t\r\n\]+third string arg is: c\[ \t\r\n\]+fourth string arg is: d\[ \t\r\n\]+fifth string arg is: e\[ \t\r\n\]+sixth string arg is: f\[ \t\r\n\]+seventh string arg is: g\[ \t\r\n\]+" \ "= \"abcdefg\".*" } #print str_func(s,s,s,s,s,s,s) -if ![gdb_skip_stdio_test "print str_func(s,s,s,s,s,s,s,s)"] { +if {![gdb_skip_stdio_test "print str_func(s,s,s,s,s,s,s,s)"]} { gdb_test_stdio "print str_func(s,s,s,s,s,s,s)" \ "first string arg is: test string\[ \t\r\n\]+second string arg is: test string\[ \t\r\n\]+third string arg is: test string\[ \t\r\n\]+fourth string arg is: test string\[ \t\r\n\]+fifth string arg is: test string\[ \t\r\n\]+sixth string arg is: test string\[ \t\r\n\]+seventh string arg is: test string\[ \t\r\n\]+" \ "\"test stringtest stringtest stringtest stringtest stringtest stringtest string\".*" } #call str_func(s,s,s,s,s,s,s) -if ![gdb_skip_stdio_test "call str_func(s,s,s,s,s,s,s,s)"] { +if {![gdb_skip_stdio_test "call str_func(s,s,s,s,s,s,s,s)"]} { gdb_test_stdio "call str_func(s,s,s,s,s,s,s)" \ "first string arg is: test string\[ \t\r\n\]+second string arg is: test string\[ \t\r\n\]+third string arg is: test string\[ \t\r\n\]+fourth string arg is: test string\[ \t\r\n\]+fifth string arg is: test string\[ \t\r\n\]+sixth string arg is: test string\[ \t\r\n\]+seventh string arg is: test string\[ \t\r\n\]+" \ "\"test stringtest stringtest stringtest stringtest stringtest stringtest string\".*" diff --git a/gdb/testsuite/gdb.base/callfuncs.exp b/gdb/testsuite/gdb.base/callfuncs.exp index 0e1997a..59306d4 100644 --- a/gdb/testsuite/gdb.base/callfuncs.exp +++ b/gdb/testsuite/gdb.base/callfuncs.exp @@ -21,7 +21,7 @@ standard_testfile # We still want to test non-prototype functions for now, which is why # we disable compilers warning about them. set compile_flags {debug additional_flags=-Wno-deprecated-non-prototype} -if [support_complex_tests] { +if {[support_complex_tests]} { lappend compile_flags "additional_flags=-DTEST_COMPLEX" } @@ -132,7 +132,7 @@ proc do_function_calls {prototypes} { gdb_test "p t_int_double(99, 99.0)" " = 1" } - if [support_complex_tests] { + if {[support_complex_tests]} { gdb_test "p t_float_complex_values(fc1, fc2)" " = 1" gdb_test "p t_float_complex_values(fc3, fc4)" " = 0" @@ -221,7 +221,7 @@ proc do_function_calls {prototypes} { "call inferior func with struct - returns double" } - if [support_complex_tests] { + if {[support_complex_tests]} { gdb_test "p t_structs_fc(struct_val1)" ".*= 3 \\+ 3i" \ "call inferior func with struct - returns float _Complex" @@ -257,7 +257,7 @@ proc fetch_all_registers {test} { exp_continue } -re "^bspstore\[ \t\]+\[^\r\n\]+\r\n" { - if [istarget "ia64-*-*"] { + if {[istarget "ia64-*-*"]} { # Filter out bspstore which is specially tied to bsp, # giving spurious differences. } else { @@ -266,7 +266,7 @@ proc fetch_all_registers {test} { exp_continue } -re "^pstate\[ \t\]+\[^\r\n\]+\r\n" { - if [istarget "sparc64-*-linux-gnu"] { + if {[istarget "sparc64-*-linux-gnu"]} { # Filter out the pstate register, since in sparc64 # targets the Linux kernel disables pstate.PEF when # returning from traps, giving spurious differences. @@ -276,7 +276,7 @@ proc fetch_all_registers {test} { exp_continue } -re "^last_break\[ \t\]+\[^\r\n\]+\r\n" { - if [istarget "s390*-*-*"] { + if {[istarget "s390*-*-*"]} { # Filter out last_break which is read-only, # giving spurious differences. } else { @@ -285,7 +285,7 @@ proc fetch_all_registers {test} { exp_continue } -re "^\(?:cycle\|instret\)\[ \t\]+\[^\r\n\]+\r\n" { - if [istarget "riscv*-*-*"] { + if {[istarget "riscv*-*-*"]} { # Filter out the cycle counter and instructions # retired counter CSRs which are read-only, giving # spurious differences. @@ -386,9 +386,9 @@ proc perform_all_tests {prototypes} { "The program being debugged stopped while.*" \ "stop at breakpoint in call dummy function" gdb_test "continue" "Continuing.*" "continue from call dummy breakpoint" - if ![gdb_test "bt 2" \ - "#0 main.*" \ - "bt after continuing from call dummy breakpoint"] then { + if {![gdb_test "bt 2" \ + "#0 main.*" \ + "bt after continuing from call dummy breakpoint"]} then { set new_reg_content [fetch_all_registers \ "register contents after stop in call dummy"] if {$old_reg_content == $new_reg_content} { @@ -412,9 +412,9 @@ proc perform_all_tests {prototypes} { gdb_test "finish" \ "Value returned is .* = 9" \ "finish from call dummy breakpoint returns correct value" - if ![gdb_test "bt 2" \ - "#0 main.*" \ - "bt after finishing from call dummy breakpoint"] then { + if {![gdb_test "bt 2" \ + "#0 main.*" \ + "bt after finishing from call dummy breakpoint"]} then { set new_reg_content [fetch_all_registers \ "register contents after finish in call dummy"] if {$old_reg_content == $new_reg_content} { @@ -435,11 +435,11 @@ proc perform_all_tests {prototypes} { # with a value, make sure we are back at main with the same register contents. gdb_test "print add(4,5)" "The program being debugged stopped while.*" \ "call function causing a breakpoint and then do a return" - if ![gdb_test "return 7" \ - "#0 main.*" \ - "back at main after return from call dummy breakpoint" \ - "Make add return now. .y or n.*" \ - "y"] then { + if {![gdb_test "return 7" \ + "#0 main.*" \ + "back at main after return from call dummy breakpoint" \ + "Make add return now. .y or n.*" \ + "y"]} then { set new_reg_content [fetch_all_registers \ "register contents after return in call dummy"] if {$old_reg_content == $new_reg_content} { diff --git a/gdb/testsuite/gdb.base/cast-indirection.exp b/gdb/testsuite/gdb.base/cast-indirection.exp index ce828db..198b0aa 100644 --- a/gdb/testsuite/gdb.base/cast-indirection.exp +++ b/gdb/testsuite/gdb.base/cast-indirection.exp @@ -22,7 +22,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/catch-fork-kill.exp b/gdb/testsuite/gdb.base/catch-fork-kill.exp index 224a8df..e851d66 100644 --- a/gdb/testsuite/gdb.base/catch-fork-kill.exp +++ b/gdb/testsuite/gdb.base/catch-fork-kill.exp @@ -59,7 +59,7 @@ proc do_test {fork_kind exit_kind} { with_test_prefix "$fork_kind" { clean_restart $testfile - if ![runto_main] { + if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/catch-gdb-caused-signals.exp b/gdb/testsuite/gdb.base/catch-gdb-caused-signals.exp index aa62972..862cae4 100644 --- a/gdb/testsuite/gdb.base/catch-gdb-caused-signals.exp +++ b/gdb/testsuite/gdb.base/catch-gdb-caused-signals.exp @@ -36,7 +36,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile $flags]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } @@ -47,7 +47,7 @@ gdb_test "handle SIGILL nostop noprint" \ gdb_test "print return_one()" " = 1" -if ![target_info exists gdb,noinferiorio] { +if {![target_info exists gdb,noinferiorio]} { # Clean up the breakpoint state. delete_breakpoints diff --git a/gdb/testsuite/gdb.base/catch-syscall.exp b/gdb/testsuite/gdb.base/catch-syscall.exp index 9c5839c..0a1a4f3 100644 --- a/gdb/testsuite/gdb.base/catch-syscall.exp +++ b/gdb/testsuite/gdb.base/catch-syscall.exp @@ -348,7 +348,7 @@ proc test_catch_syscall_execve {} { # Check for entry/return across the execve, making sure that the # syscall_state isn't lost when turning into a new process. insert_catch_syscall_with_arg "execve" - if [check_continue "execve"] { + if {[check_continue "execve"]} { # The check_continue test generates an XFAIL on Powerpc. In # that case, gdb is already at main so don't do the continue. diff --git a/gdb/testsuite/gdb.base/charset.exp b/gdb/testsuite/gdb.base/charset.exp index 75fb9f09..80fbf4a 100644 --- a/gdb/testsuite/gdb.base/charset.exp +++ b/gdb/testsuite/gdb.base/charset.exp @@ -391,7 +391,7 @@ foreach target_charset $charset_subset { set var_name [string tolower "${target_charset}_string"] regsub -all -- "\[^a-z0-9_\]" $var_name "_" var_name } - + # Compute a regexp matching the results we expect. This is static, # but it's easier than writing it out. regsub -all "." "abfnrtv" "(\\\\&|x)" escapes @@ -492,7 +492,7 @@ foreach target_charset $charset_subset { } } - # Try printing a character escape that doesn't exist. We should + # Try printing a character escape that doesn't exist. We should # get the unescaped character, in the target character set. gdb_test "print $L'\\q'" " = \[0-9-\]+ $L'q'" \ "print escape that doesn't exist in $target_charset" @@ -549,7 +549,7 @@ if {$wchar_ok} { set ucs2_ok [expr {[get_sizeof char16_t 99] == 2}] -if ![valid_host_charset "UTF-16"] { +if {![valid_host_charset "UTF-16"]} { verbose -log "Disabling UTF-16 tests." set ucs2_ok 0 } @@ -640,4 +640,4 @@ foreach name {short int long} { } -gdb_exit +gdb_exit diff --git a/gdb/testsuite/gdb.base/chng-syms.exp b/gdb/testsuite/gdb.base/chng-syms.exp index dbc523d..0f7be07 100644 --- a/gdb/testsuite/gdb.base/chng-syms.exp +++ b/gdb/testsuite/gdb.base/chng-syms.exp @@ -15,8 +15,8 @@ # Author: Paul N. Hilfinger (Hilfinger@gnat.com) -# Test that GDB cleans up properly after errors that result when a -# breakpoint is reset. +# Test that GDB cleans up properly after errors that result when a +# breakpoint is reset. standard_testfile .c @@ -45,21 +45,21 @@ gdb_test "break stop_here if (var1 == 42)" \ gdb_run_cmd expect_to_stop_here "first time" - + gdb_continue_to_end "breakpoint first time through" # Now we recompile the executable, but without a variable named "var1", first # waiting to insure that even on fast machines, the file modification times -# are distinct. This will force GDB to reload the file on the -# next "run" command, causing an error when GDB tries to tries to reset +# are distinct. This will force GDB to reload the file on the +# next "run" command, causing an error when GDB tries to tries to reset # the breakpoint. sleep 2 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DVARIABLE=var2}] != "" } { -# Complication: Since GDB generally holds an open file descriptor on the -# executable at this point, there are some systems in which the -# re-compilation will fail. In such cases, we'll consider the test +# Complication: Since GDB generally holds an open file descriptor on the +# executable at this point, there are some systems in which the +# re-compilation will fail. In such cases, we'll consider the test # (vacuously) passed providing that re-running it succeeds as before. gdb_run_cmd diff --git a/gdb/testsuite/gdb.base/code-expr.exp b/gdb/testsuite/gdb.base/code-expr.exp index 8af2ee6..38f238c 100644 --- a/gdb/testsuite/gdb.base/code-expr.exp +++ b/gdb/testsuite/gdb.base/code-expr.exp @@ -275,7 +275,7 @@ gdb_test "whatis (enum misordered @data) v_misordered" \ "type = @data enum misordered" \ "(enum misordered @data)" -# +# # Pointers # diff --git a/gdb/testsuite/gdb.base/commands.exp b/gdb/testsuite/gdb.base/commands.exp index aa5ed56..c21be23 100644 --- a/gdb/testsuite/gdb.base/commands.exp +++ b/gdb/testsuite/gdb.base/commands.exp @@ -255,7 +255,7 @@ proc_with_prefix infrun_breakpoint_command_test {} { delete_breakpoints gdb_test "break factorial if value == 5" "Breakpoint.*at.*" -# infrun_breakpoint_command_test - This test was broken into two parts +# infrun_breakpoint_command_test - This test was broken into two parts # to get around a synchronization problem in expect. # part1: issue the gdb command "commands" # part2: send the list of commands @@ -547,7 +547,7 @@ proc_with_prefix user_defined_command_manyargs_test {} { set expected "nargs=$nargs:" for {set i 1} {$i <= $nargs} {incr i} { - append expected " " [expr 2 * $i] + append expected " " [expr {2 * $i}] } gdb_test $cmd $expected "execute command" @@ -658,7 +658,7 @@ proc_with_prefix test_command_prompt_position {} { gdb_test_multiple "printf \"Now the value is %d\\n\", value" $test { -re "^printf.*value\r\n>$" { gdb_test_multiple "end" $test { - -re "^end\r\n$gdb_prompt $" { + -re "^end\r\n$gdb_prompt $" { pass $test } } @@ -681,7 +681,7 @@ proc_with_prefix deprecated_command_test {} { gdb_test "p 5" ".\[0-9\]* = 5.*" "deprecated warning goes away /1/" gdb_test_no_output "maintenance deprecate p \"new_p\"" "maintenance deprecate p \"new_p\" /2/" - gdb_test_no_output "maintenance deprecate print \"new_print\"" + gdb_test_no_output "maintenance deprecate print \"new_print\"" gdb_test "p 5" \ "Warning: command 'print' \\(p\\) is deprecated.*Use 'new_print'.*" \ "both alias and command are deprecated" @@ -751,7 +751,7 @@ proc_with_prefix bp_deleted_in_command_test {} { # one command that deletes this breakpoint. gdb_test "break factorial" \ "Breakpoint \[0-9\]+ at .*: file .*run.c, line \[0-9\]+\." - + gdb_test_multiple "commands" "begin commands" { -re "Type commands for breakpoint.*>$" { pass "begin commands" diff --git a/gdb/testsuite/gdb.base/compare-sections.exp b/gdb/testsuite/gdb.base/compare-sections.exp index 981fa7b..b95149e 100644 --- a/gdb/testsuite/gdb.base/compare-sections.exp +++ b/gdb/testsuite/gdb.base/compare-sections.exp @@ -136,7 +136,7 @@ with_test_prefix "read-only" { } # Come up with different value. - set patch [expr 255 - $orig] + set patch [expr {255 - $orig}] # Write PATCH to memory. set written -1 diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp index ca37559..59a6c57 100644 --- a/gdb/testsuite/gdb.base/completion.exp +++ b/gdb/testsuite/gdb.base/completion.exp @@ -20,7 +20,7 @@ # # tests for command completion # -# Here are some useful test cases for completion. +# Here are some useful test cases for completion. # They should be tested with both M-? and TAB. # # "show output-" "radix" @@ -676,7 +676,7 @@ with_cwd $srcdir { } # If the directory name contains a '+' we must escape it, adding a backslash. -# If not, the test below will fail because it will interpret the '+' as a +# If not, the test below will fail because it will interpret the '+' as a # regexp operator. We use string_to_regexp for this purpose. gdb_test "cd ${fullsrcdir}" \ diff --git a/gdb/testsuite/gdb.base/comprdebug.exp b/gdb/testsuite/gdb.base/comprdebug.exp index 686178d..d8859c5 100644 --- a/gdb/testsuite/gdb.base/comprdebug.exp +++ b/gdb/testsuite/gdb.base/comprdebug.exp @@ -25,7 +25,7 @@ if {[gdb_compile $srcdir/$subdir/$srcfile $ofile \ set objcopy_program [gdb_find_objcopy] set cmd "$objcopy_program --compress-debug-sections $ofile" verbose "invoking $cmd" -set result [catch "exec $cmd" output] +set result [catch {exec {*}$cmd} output] verbose "result is $result" verbose "output is $output" diff --git a/gdb/testsuite/gdb.base/cond-eval-mode.exp b/gdb/testsuite/gdb.base/cond-eval-mode.exp index ea43683..9f49801 100644 --- a/gdb/testsuite/gdb.base/cond-eval-mode.exp +++ b/gdb/testsuite/gdb.base/cond-eval-mode.exp @@ -58,7 +58,7 @@ gdb_test_multiple $test_target $test_target { # We now know that the target supports target-side conditional # evaluation. Now make sure we can force-disable the # ConditionalBreakpoints RSP feature. -if [gdb_protocol_is_remote] { +if {[gdb_protocol_is_remote]} { gdb_test \ "set remote conditional-breakpoints-packet off" \ "Support for the 'ConditionalBreakpoints' packet on the current remote target is set to \"off\"." diff --git a/gdb/testsuite/gdb.base/cond-expr.exp b/gdb/testsuite/gdb.base/cond-expr.exp index 2080937..31c2545 100644 --- a/gdb/testsuite/gdb.base/cond-expr.exp +++ b/gdb/testsuite/gdb.base/cond-expr.exp @@ -18,7 +18,7 @@ # This file is part of the gdb testsuite # -# test of evaluation of conditional expressions, with constants and +# test of evaluation of conditional expressions, with constants and # variables. Using the print and the whatis command # written with the only purpose in mind to cover the holes in the # eval.c file diff --git a/gdb/testsuite/gdb.base/condbreak-bad.exp b/gdb/testsuite/gdb.base/condbreak-bad.exp index 19c16dc..578478d 100644 --- a/gdb/testsuite/gdb.base/condbreak-bad.exp +++ b/gdb/testsuite/gdb.base/condbreak-bad.exp @@ -94,7 +94,7 @@ with_test_prefix "with continue 2" { set bpnum [get_integer_valueof "\$bpnum" 0 "get bpnum"] gdb_test_no_output "cond $bpnum a == 999" - + gdb_test "cond $bpnum gibberish" \ "No symbol \"gibberish\" in current context." \ "attempt a bad condition" diff --git a/gdb/testsuite/gdb.base/condbreak.exp b/gdb/testsuite/gdb.base/condbreak.exp index 81b1a36..6392dbc 100644 --- a/gdb/testsuite/gdb.base/condbreak.exp +++ b/gdb/testsuite/gdb.base/condbreak.exp @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -# This test was written by Rich Title. +# This test was written by Rich Title. # Purpose is to test conditional breakpoints. # Modeled after "break.exp". @@ -42,7 +42,7 @@ gdb_test "break -q main" \ "Breakpoint.*at.* file .*$srcfile, line.*" \ "breakpoint function" -# +# # test conditional break at function # gdb_test "break marker1 if 1==1" \ @@ -58,7 +58,7 @@ gdb_test "break $srcfile:$bp_location1 if 1==1" \ gdb_test_no_output "delete 3" -# +# # test conditional break at function # gdb_test "break marker1 if (1==1)" \ @@ -139,7 +139,7 @@ gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=. # user instruction, GDB's search finds the second line entry, decides # that the PC is indeed at the beginning of a source line, and doesn't # print an address in the breakpoint hit message. -# +# # GCC's Dwarf2 writer, on the other hand, squeezes out duplicate line # entries, so GDB considers the source line to begin at the start of # the function's prologue. Thus, if the program stops at the diff --git a/gdb/testsuite/gdb.base/consecutive-step-over.exp b/gdb/testsuite/gdb.base/consecutive-step-over.exp index 1116478..65379cc 100644 --- a/gdb/testsuite/gdb.base/consecutive-step-over.exp +++ b/gdb/testsuite/gdb.base/consecutive-step-over.exp @@ -39,7 +39,7 @@ set n_insns 3 # Extract addresses of a few consecutive instructions. set test "get breakpoint addresses" -if { [gdb_test_multiple "x /[expr $n_insns + 1]i \$pc" $test { +if { [gdb_test_multiple "x /[expr {$n_insns + 1}]i \$pc" $test { -re "=> $hex${up_to_nl} ($hex)${up_to_nl} ($hex)${up_to_nl} ($hex)${up_to_nl}$gdb_prompt $" { for {set i 1} {$i <= $n_insns} {incr i} { set bp_addrs($i) $expect_out($i,string) diff --git a/gdb/testsuite/gdb.base/constvars.exp b/gdb/testsuite/gdb.base/constvars.exp index dcc8d1b..4abd745 100644 --- a/gdb/testsuite/gdb.base/constvars.exp +++ b/gdb/testsuite/gdb.base/constvars.exp @@ -54,7 +54,7 @@ proc local_compiler_xfail_check { } { if {[test_compiler_info gcc-2-*]} { if { ![test_debug_format "HP"] \ && ![test_debug_format "DWARF \[0-9\]"] } then { - setup_xfail "*-*-*" + setup_xfail "*-*-*" } } } @@ -69,7 +69,7 @@ proc local_compiler_xfail_check_2 { } { } } -gdb_test "break marker1" "Breakpoint $decimal at .*" +gdb_test "break marker1" "Breakpoint $decimal at .*" gdb_test_multiple "cont" "up from marker1" { -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" { diff --git a/gdb/testsuite/gdb.base/continue-after-aborted-step-over.exp b/gdb/testsuite/gdb.base/continue-after-aborted-step-over.exp index 8ba1f61..2bac000 100644 --- a/gdb/testsuite/gdb.base/continue-after-aborted-step-over.exp +++ b/gdb/testsuite/gdb.base/continue-after-aborted-step-over.exp @@ -51,7 +51,7 @@ proc do_test {displaced breakpoint_always_inserted} { gdb_test_no_output "set displaced-stepping $displaced" gdb_test_no_output "set breakpoint always-inserted $breakpoint_always_inserted" - if ![runto_main] { + if {![runto_main]} { return -1 } @@ -59,7 +59,7 @@ proc do_test {displaced breakpoint_always_inserted} { # any kind of breakpoint insertion failure. If we can examine # what's at memory address 0, it is possible that we could also # execute it. - if [is_address_zero_readable] { + if {[is_address_zero_readable]} { untested "memory at address 0 is possibly executable" return } diff --git a/gdb/testsuite/gdb.base/continue-all-already-running.exp b/gdb/testsuite/gdb.base/continue-all-already-running.exp index 5d59f8d..a3e8c27 100644 --- a/gdb/testsuite/gdb.base/continue-all-already-running.exp +++ b/gdb/testsuite/gdb.base/continue-all-already-running.exp @@ -25,7 +25,7 @@ save_vars { GDBFLAGS } { } } -if ![runto_main] { +if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.base/coredump-filter-build-id.exp b/gdb/testsuite/gdb.base/coredump-filter-build-id.exp index eb5b489..75ba07d 100644 --- a/gdb/testsuite/gdb.base/coredump-filter-build-id.exp +++ b/gdb/testsuite/gdb.base/coredump-filter-build-id.exp @@ -48,7 +48,7 @@ if { ![gdb_gcore_cmd "$corefilename" "save corefile"] } { # Determine if GDB dumped the mapping containing the build-id. This # is done by invoking an external program (eu-unstrip). -if { [catch "exec [gdb_find_eu-unstrip] -n --core $corefilename" output] == 0 } { +if { [catch {exec [gdb_find_eu-unstrip] -n --core $corefilename} output] == 0 } { set line [lindex [split $output "\n"] 0] set test "gcore dumped mapping with build-id" diff --git a/gdb/testsuite/gdb.base/corefile-buildid.exp b/gdb/testsuite/gdb.base/corefile-buildid.exp index 88d989d..de0b295 100644 --- a/gdb/testsuite/gdb.base/corefile-buildid.exp +++ b/gdb/testsuite/gdb.base/corefile-buildid.exp @@ -36,7 +36,7 @@ proc create_core_file { progname } { verbose -log "corefile is $corefile" # Check the corefile has a build-id for the executable. - if { [catch "exec [gdb_find_eu-unstrip] -n --core $corefile" output] == 0 } { + if { [catch {exec [gdb_find_eu-unstrip] -n --core $corefile} output] == 0 } { set line [lindex [split $output "\n"] 0] set binfile_re (?:[string_to_regexp $progname]|\\\[(?:exe|pie)\\\]) if { ![regexp "^${::hex}\\+${::hex} \[a-f0-9\]+@${::hex}.*$binfile_re$" $line] } { diff --git a/gdb/testsuite/gdb.base/corefile-exec-context.exp b/gdb/testsuite/gdb.base/corefile-exec-context.exp index 23fd964..f6085f7 100644 --- a/gdb/testsuite/gdb.base/corefile-exec-context.exp +++ b/gdb/testsuite/gdb.base/corefile-exec-context.exp @@ -32,7 +32,7 @@ if {[build_executable $testfile.exp $testfile $srcfile] == -1} { # length then lets try to make it longer. set binfile_len [string length $binfile] if { $binfile_len <= 80 } { - set extra_len [expr 80 - $binfile_len + 1] + set extra_len [expr {80 - $binfile_len + 1}] set extra_str [string repeat "x" $extra_len] set new_binfile $binfile$extra_str remote_exec build "mv $binfile $new_binfile" diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefile.exp index c34dfb5..ae1e8bf 100644 --- a/gdb/testsuite/gdb.base/corefile.exp +++ b/gdb/testsuite/gdb.base/corefile.exp @@ -265,7 +265,7 @@ proc corefile_test_run {} { "run: sanity check we see the core file" set test "run: with core" - if [runto_main] { + if {[runto_main]} { pass $test } else { fail $test @@ -327,7 +327,7 @@ proc corefile_test_attach {} { return } - if [can_spawn_for_attach] { + if {[can_spawn_for_attach]} { set test "attach: spawn sleep" set res [remote_spawn host "$binfile sleep"] if { $res < 0 || $res == "" } { diff --git a/gdb/testsuite/gdb.base/ctf-ptype.exp b/gdb/testsuite/gdb.base/ctf-ptype.exp index 6d55cb2..1aaa48c 100644 --- a/gdb/testsuite/gdb.base/ctf-ptype.exp +++ b/gdb/testsuite/gdb.base/ctf-ptype.exp @@ -279,7 +279,7 @@ ptype_maybe_prototyped "fffptr" "int (*(*(*)(char))(short int))(long int)" \ if {[runto_main]} { - if [target_info exists gdb,cannot_call_functions] { + if {[target_info exists gdb,cannot_call_functions]} { unsupported "this target can not call functions" return } diff --git a/gdb/testsuite/gdb.base/ctxobj.exp b/gdb/testsuite/gdb.base/ctxobj.exp index 1d03e0d..4a50ab6 100644 --- a/gdb/testsuite/gdb.base/ctxobj.exp +++ b/gdb/testsuite/gdb.base/ctxobj.exp @@ -56,7 +56,7 @@ clean_restart $executable gdb_load_shlib $libobj1 gdb_load_shlib $libobj2 -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/dcache-flush.exp b/gdb/testsuite/gdb.base/dcache-flush.exp index 8e713f5..0bd034b 100644 --- a/gdb/testsuite/gdb.base/dcache-flush.exp +++ b/gdb/testsuite/gdb.base/dcache-flush.exp @@ -21,7 +21,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile}] } { return -1 } -if ![runto func] { +if {![runto func]} { return -1 } diff --git a/gdb/testsuite/gdb.base/dcache-line-read-error.exp b/gdb/testsuite/gdb.base/dcache-line-read-error.exp index bc8f47e..62d561c 100644 --- a/gdb/testsuite/gdb.base/dcache-line-read-error.exp +++ b/gdb/testsuite/gdb.base/dcache-line-read-error.exp @@ -21,7 +21,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile}] } { return -1 } -if ![runto breakpt] { +if {![runto breakpt]} { return -1 } @@ -45,7 +45,7 @@ proc delete_mem {} { # Make the dcache line size bigger than the pagesize. set pagesize [get_integer_valueof "pg_size" -1] -set linesize [expr $pagesize * 2] +set linesize [expr {$pagesize * 2}] gdb_test_no_output "set dcache line-size $linesize" \ "set dcache line size to twice the pagesize" diff --git a/gdb/testsuite/gdb.base/debug-expr.exp b/gdb/testsuite/gdb.base/debug-expr.exp index f22af24..0775d23 100644 --- a/gdb/testsuite/gdb.base/debug-expr.exp +++ b/gdb/testsuite/gdb.base/debug-expr.exp @@ -25,7 +25,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug}]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/debug-frame.exp b/gdb/testsuite/gdb.base/debug-frame.exp index b2b944d..eee65ae 100644 --- a/gdb/testsuite/gdb.base/debug-frame.exp +++ b/gdb/testsuite/gdb.base/debug-frame.exp @@ -23,7 +23,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfiles]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/default.exp b/gdb/testsuite/gdb.base/default.exp index b5e64c2..aab074c 100644 --- a/gdb/testsuite/gdb.base/default.exp +++ b/gdb/testsuite/gdb.base/default.exp @@ -31,14 +31,14 @@ set timeout 60 gdb_test "add-symbol-file" "add-symbol-file takes a file name and an address" # test append -gdb_test "append" "List of \"append\" subcommands:.*" -gdb_test "append binary" "List of \"append binary\" subcommands:.*" -gdb_test "append memory" "Missing filename\." -gdb_test "append value" "Missing filename\." -gdb_test "append binary memory" "Missing filename\." -gdb_test "append binary value" "Missing filename\." - -if !$use_gdb_stub { +gdb_test "append" "List of \"append\" subcommands:.*" +gdb_test "append binary" "List of \"append binary\" subcommands:.*" +gdb_test "append memory" "Missing filename\." +gdb_test "append value" "Missing filename\." +gdb_test "append binary memory" "Missing filename\." +gdb_test "append binary value" "Missing filename\." + +if {!$use_gdb_stub} { gdb_test_multiple "attach" "attach" { -re "Argument required .(process-id|program) to attach.*$gdb_prompt $"\ { pass "attach" } @@ -59,7 +59,7 @@ if !$use_gdb_stub { gdb_test $i "No default breakpoint address now." "break \"$i\" abbreviation" } - + gdb_test "backtrace" "No stack." # ba and bac are no longer unique command prefixes. So these tests @@ -148,21 +148,21 @@ gdb_test "down" "No stack.*" #test down-silently gdb_test "down-silently" "No stack." # test dump -gdb_test "dump" "List of \"dump\" subcommands:.*" -gdb_test "dump binary" "List of \"dump binary\" subcommands:.*" -gdb_test "dump ihex" "List of \"dump ihex\" subcommands:.*" -gdb_test "dump memory" "Missing filename\." -gdb_test "dump srec" "List of \"dump srec\" subcommands:.*" -gdb_test "dump tekhex" "List of \"dump tekhex\" subcommands:.*" -gdb_test "dump value" "Missing filename\." -gdb_test "dump binary memory" "Missing filename\." -gdb_test "dump binary value" "Missing filename\." -gdb_test "dump ihex memory" "Missing filename\." -gdb_test "dump ihex value" "Missing filename\." -gdb_test "dump srec memory" "Missing filename\." -gdb_test "dump srec value" "Missing filename\." -gdb_test "dump tekhex memory" "Missing filename\." -gdb_test "dump tekhex value" "Missing filename\." +gdb_test "dump" "List of \"dump\" subcommands:.*" +gdb_test "dump binary" "List of \"dump binary\" subcommands:.*" +gdb_test "dump ihex" "List of \"dump ihex\" subcommands:.*" +gdb_test "dump memory" "Missing filename\." +gdb_test "dump srec" "List of \"dump srec\" subcommands:.*" +gdb_test "dump tekhex" "List of \"dump tekhex\" subcommands:.*" +gdb_test "dump value" "Missing filename\." +gdb_test "dump binary memory" "Missing filename\." +gdb_test "dump binary value" "Missing filename\." +gdb_test "dump ihex memory" "Missing filename\." +gdb_test "dump ihex value" "Missing filename\." +gdb_test "dump srec memory" "Missing filename\." +gdb_test "dump srec value" "Missing filename\." +gdb_test "dump tekhex memory" "Missing filename\." +gdb_test "dump tekhex value" "Missing filename\." #test echo gdb_test_no_output "echo" "echo" #test enable breakpoints delete @@ -527,7 +527,7 @@ gdb_test "ptype" "The history is empty." gdb_test "pwd" "Working directory .*" #test run "r" abbreviation -if $use_gdb_stub { +if {$use_gdb_stub} { # Only extended-remote supports "run". } else { gdb_test_multiple "r" "run \"r\" abbreviation" { @@ -549,7 +549,7 @@ if $use_gdb_stub { } #test run -if $use_gdb_stub { +if {$use_gdb_stub} { # Only extended-remote supports "run". } else { gdb_test_multiple "run" "run" { @@ -771,7 +771,7 @@ set show_conv_list \ {$_linker_namespace_count = 0} \ {$_linker_namespace = <error: No registers.>}\ } -if [allow_python_tests] { +if {[allow_python_tests]} { append show_conv_list \ { {$_memeq = <internal function _memeq>} \ diff --git a/gdb/testsuite/gdb.base/detach-sysroot-target.exp b/gdb/testsuite/gdb.base/detach-sysroot-target.exp index c7466c0..b6a9da1 100644 --- a/gdb/testsuite/gdb.base/detach-sysroot-target.exp +++ b/gdb/testsuite/gdb.base/detach-sysroot-target.exp @@ -48,7 +48,7 @@ gdb_test_multiple "show sysroot" "" { } } -if ![runto_main] { +if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.base/disasm-end-cu.exp b/gdb/testsuite/gdb.base/disasm-end-cu.exp index d863e9f..34f25be 100644 --- a/gdb/testsuite/gdb.base/disasm-end-cu.exp +++ b/gdb/testsuite/gdb.base/disasm-end-cu.exp @@ -21,7 +21,7 @@ if { [prepare_for_testing "failed to prepare" "disasm-end-cu" {disasm-end-cu-1.c return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/disasm-optim.exp b/gdb/testsuite/gdb.base/disasm-optim.exp index abb2a23..9b81a4c 100644 --- a/gdb/testsuite/gdb.base/disasm-optim.exp +++ b/gdb/testsuite/gdb.base/disasm-optim.exp @@ -23,7 +23,7 @@ if { [prepare_for_testing "failed to prepare" $testfile ${testfile}.S {nodebug}] return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/displaced-step-closure.exp b/gdb/testsuite/gdb.base/displaced-step-closure.exp index 0803e44..bbdd207 100644 --- a/gdb/testsuite/gdb.base/displaced-step-closure.exp +++ b/gdb/testsuite/gdb.base/displaced-step-closure.exp @@ -24,7 +24,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/display.exp b/gdb/testsuite/gdb.base/display.exp index 2fb6e07..d635982 100644 --- a/gdb/testsuite/gdb.base/display.exp +++ b/gdb/testsuite/gdb.base/display.exp @@ -35,7 +35,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile \ # Preserve the old timeout, and set a new one that should be # sufficient to avoid timing out during this test. set oldtimeout $timeout -set timeout [expr "$timeout + 60"] +set timeout [expr {$timeout + 60}] verbose "Timeout is now $timeout seconds" 2 # use this to debug: @@ -43,7 +43,7 @@ verbose "Timeout is now $timeout seconds" 2 # Some coverage stuff # -if !$use_gdb_stub { +if {!$use_gdb_stub} { gdb_test "kill" ".*The program is not being run.*" gdb_test "detach" ".*" gdb_test "run" ".*" diff --git a/gdb/testsuite/gdb.base/dlmopen.exp b/gdb/testsuite/gdb.base/dlmopen.exp index c4eb7cd..f8c4f6c 100644 --- a/gdb/testsuite/gdb.base/dlmopen.exp +++ b/gdb/testsuite/gdb.base/dlmopen.exp @@ -118,7 +118,7 @@ proc check_dso_count { dso num } { gdb_test_multiple "info shared" "info shared" { -re "$hex $hex \($::decimal\\s+\)\?Yes \[^\r\n\]*$dso\r\n" { # use longer form so debug remote does not interfere - set count [expr $count + 1] + set count [expr {$count + 1}] exp_continue } -re "$gdb_prompt " { diff --git a/gdb/testsuite/gdb.base/dprintf-bp-same-addr.exp b/gdb/testsuite/gdb.base/dprintf-bp-same-addr.exp index 11a8310..5d8ffa3 100644 --- a/gdb/testsuite/gdb.base/dprintf-bp-same-addr.exp +++ b/gdb/testsuite/gdb.base/dprintf-bp-same-addr.exp @@ -17,8 +17,8 @@ standard_testfile -if [build_executable "failed to prepare" \ - ${testfile} ${srcfile} {debug}] { +if {[build_executable "failed to prepare" \ + ${testfile} ${srcfile} {debug}]} { return -1 } @@ -31,7 +31,7 @@ proc test { style } { clean_restart gdb_load $binfile - if ![runto_main] { + if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/dprintf-detach.exp b/gdb/testsuite/gdb.base/dprintf-detach.exp index 431037c..573aa0a 100644 --- a/gdb/testsuite/gdb.base/dprintf-detach.exp +++ b/gdb/testsuite/gdb.base/dprintf-detach.exp @@ -26,8 +26,8 @@ require can_spawn_for_attach standard_testfile set escapedbinfile [string_to_regexp ${binfile}] -if [build_executable "failed to prepare for dprintf-detach" \ - ${testfile} ${srcfile} {debug}] { +if {[build_executable "failed to prepare for dprintf-detach" \ + ${testfile} ${srcfile} {debug}]} { return -1 } @@ -44,7 +44,7 @@ proc dprintf_detach_test { breakpoint_always_inserted dprintf_style disconnected gdb_test_no_output "set dprintf-style ${dprintf_style}" gdb_test_no_output "set disconnected-dprintf ${disconnected_dprintf}" - if ![runto_main] { + if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/dprintf-next.exp b/gdb/testsuite/gdb.base/dprintf-next.exp index b28f565..d8ba03d 100644 --- a/gdb/testsuite/gdb.base/dprintf-next.exp +++ b/gdb/testsuite/gdb.base/dprintf-next.exp @@ -19,12 +19,12 @@ set expfile $testfile.exp set dp_location [gdb_get_line_number "Set dprintf here"] -if [prepare_for_testing "failed to prepare for dprintf with next" \ - ${testfile} ${srcfile} {debug}] { +if {[prepare_for_testing "failed to prepare for dprintf with next" \ + ${testfile} ${srcfile} {debug}]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/dprintf-non-stop.exp b/gdb/testsuite/gdb.base/dprintf-non-stop.exp index 7386ac6..538f703 100644 --- a/gdb/testsuite/gdb.base/dprintf-non-stop.exp +++ b/gdb/testsuite/gdb.base/dprintf-non-stop.exp @@ -16,8 +16,8 @@ standard_testfile set executable ${testfile} -if [build_executable "failed to prepare for dprintf with non-stop" \ - ${testfile} ${srcfile} {debug}] { +if {[build_executable "failed to prepare for dprintf with non-stop" \ + ${testfile} ${srcfile} {debug}]} { return -1 } @@ -26,7 +26,7 @@ save_vars { GDBFLAGS } { clean_restart ${executable} } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/dprintf.exp b/gdb/testsuite/gdb.base/dprintf.exp index 262ccc1..6fb2085 100644 --- a/gdb/testsuite/gdb.base/dprintf.exp +++ b/gdb/testsuite/gdb.base/dprintf.exp @@ -26,7 +26,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile $flags] } { set bp_location1 [gdb_get_line_number "set breakpoint 1 here"] set dp_location1 [gdb_get_line_number "set dprintf 1 here"] -if ![runto_main] { +if {![runto_main]} { return -1 } @@ -77,7 +77,7 @@ proc restart {} { clean_restart gdb_load $binfile - if ![runto_main] { + if {![runto_main]} { return -1 } @@ -142,7 +142,7 @@ proc test_call {} { # The "call" style depends on having I/O functions available. -if ![target_info exists gdb,noinferiorio] { +if {![target_info exists gdb,noinferiorio]} { with_test_prefix "call" { test_call } @@ -171,7 +171,7 @@ proc test_agent {} { } } - if !$target_can_dprintf { + if {!$target_can_dprintf} { return } @@ -191,7 +191,7 @@ proc test_agent {} { } } - if $target_can_dprintf { + if {$target_can_dprintf} { gdb_test "continue" "Breakpoint \[0-9\]+, foo .*" "2nd dprintf" gdb_test_sequence "info breakpoints" "dprintf info" { @@ -218,7 +218,7 @@ gdb_test "set dprintf-style foobar" "Undefined item: \"foobar\"." \ # Test that force-disabling the BreakpointCommands RSP feature works # as expected. dprintf relies on support for target-side breakpoint # commands --- use it as proxy. -if [gdb_protocol_is_remote] { +if {[gdb_protocol_is_remote]} { gdb_test \ "set remote breakpoint-commands-packet off" \ "Support for the 'BreakpointCommands' packet on the current remote target is set to \"off\"." diff --git a/gdb/testsuite/gdb.base/dtrace-probe.exp b/gdb/testsuite/gdb.base/dtrace-probe.exp index 5d4b9df..a91e31f 100644 --- a/gdb/testsuite/gdb.base/dtrace-probe.exp +++ b/gdb/testsuite/gdb.base/dtrace-probe.exp @@ -21,7 +21,7 @@ proc dtrace_test {} { global testfile hex srcfile binfile standard_testfile - + if {[dtrace_build_usdt_test_program] == -1} { untested "failed to compile" return -1 @@ -29,8 +29,8 @@ proc dtrace_test {} { clean_restart gdb_load $binfile - - if ![runto_main] { + + if {![runto_main]} { return -1 } @@ -71,7 +71,7 @@ proc dtrace_test {} { # test:progress-counter probe. Set a breakpoint on it and see # that it gets reached. - if ![runto_main] { + if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/dump.exp b/gdb/testsuite/gdb.base/dump.exp index 64d897b..67f3195 100644 --- a/gdb/testsuite/gdb.base/dump.exp +++ b/gdb/testsuite/gdb.base/dump.exp @@ -192,7 +192,7 @@ proc capture_pointer_with_type { pointer } { # Expected output of "p ${pointer}" is like "$7 = (int (*)[32]) 0x804a0e0", # and we want to extract "(int (*)[32]) 0x804a0e0" from it via # following regexp. - if [regexp " \\(.*\\).* 0x\[0-9a-fA-F\]+" $expect_out(0,string) output_string] { + if {[regexp " \\(.*\\).* 0x\[0-9a-fA-F\]+" $expect_out(0,string) output_string]} { # OUTPUT_STRING is expected to be like "(int (*)[32]) 0x804a0e0". pass "$test" } else { @@ -261,12 +261,12 @@ make_dump_file \ proc test_restore_saved_value { restore_args msg oldval newval } { global gdb_prompt - + gdb_test "restore $restore_args" \ "Restoring .*" \ "$msg; file restored ok" if { ![string compare $oldval \ - [capture_value $newval "$msg"]] } then { + [capture_value $newval "$msg"]] } then { pass "$msg; value restored ok" } else { fail "$msg; value restored ok" @@ -398,7 +398,7 @@ test_restore_saved_value "[set intstr1.bin] binary $struct2_start" \ # # test restore with start/stop addresses. # -# For this purpose, we will restore just the third element of the array, +# For this purpose, we will restore just the third element of the array, # and check to see that adjacent elements are not modified. # # We will need the address and offset of the third and fourth elements. @@ -449,7 +449,7 @@ gdb_test "print intarray\[4\] == 0" " = 1" "element 4 not changed - 4" if {![string compare $is64bitonly "no"]} { print_zero_all - # restore with expressions + # restore with expressions test_restore_saved_value \ "[set intarr3.srec] (char*)${array2_start}-(char*)${array_start} &intarray\[3\] &intarray\[4\]" \ "array partial with expressions" 4 "intarray2\[3\]" @@ -475,7 +475,7 @@ gdb_file_cmd ${binfile} # Now fix the endianness at the correct state. gdb_test_multiple "set endian $endian" "set endianness" { - -re ".* (big|little) endian.*$gdb_prompt $" { + -re ".* (big|little) endian.*$gdb_prompt $" { pass "setting $endian endianness" } } @@ -498,10 +498,10 @@ if { ![string compare $struct_val \ proc test_reload_saved_value { filename msg oldval newval } { global gdb_prompt - + gdb_file_cmd $filename if { ![string compare $oldval \ - [capture_value $newval "$msg"]] } then { + [capture_value $newval "$msg"]] } then { pass "$msg; value restored ok" } else { fail "$msg; value restored ok" diff --git a/gdb/testsuite/gdb.base/dup-sect.exp b/gdb/testsuite/gdb.base/dup-sect.exp index 28cefbb..5a5ad91 100644 --- a/gdb/testsuite/gdb.base/dup-sect.exp +++ b/gdb/testsuite/gdb.base/dup-sect.exp @@ -42,7 +42,7 @@ if {[build_executable ${testfile}.exp $executable [list ${srcfile} ${srcmainfile set test "rename section" set objcopy_program [gdb_find_objcopy] -set result [catch "exec $objcopy_program --rename-section sect2=sect1 $binfile" output] +set result [catch {exec $objcopy_program --rename-section sect2=sect1 $binfile} output] verbose "result is $result" verbose "output is $output" if {$result != 0} { @@ -62,7 +62,7 @@ if {[gdb_gnu_strip_debug $binfile] != 0} { # in $binfile. set test "strip" set strip_program [transform strip] -set result [catch "exec $strip_program $binfile" output] +set result [catch {exec $strip_program $binfile} output] verbose "result is $result" verbose "output is $output" if {$result != 0} { diff --git a/gdb/testsuite/gdb.base/ena-dis-br.exp b/gdb/testsuite/gdb.base/ena-dis-br.exp index 82982c4..92815a7 100644 --- a/gdb/testsuite/gdb.base/ena-dis-br.exp +++ b/gdb/testsuite/gdb.base/ena-dis-br.exp @@ -240,7 +240,7 @@ with_test_prefix "run $count" { incr count } -# See the comments in condbreak.exp for "run until breakpoint at marker1" +# See the comments in condbreak.exp for "run until breakpoint at marker1" # for an explanation of the xfail below. set test "continue to break marker1, 2nd time" gdb_test_multiple "continue" "$test" { diff --git a/gdb/testsuite/gdb.base/endianity.exp b/gdb/testsuite/gdb.base/endianity.exp index 44a7cbb..013866d 100644 --- a/gdb/testsuite/gdb.base/endianity.exp +++ b/gdb/testsuite/gdb.base/endianity.exp @@ -16,8 +16,8 @@ standard_testfile .c set test_sso [expr \ - [supports_scalar_storage_order_attribute] \ - && [supports_gnuc]] + {[supports_scalar_storage_order_attribute] \ + && [supports_gnuc]}] if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ [list debug additional_flags=-DTEST_SSO=$test_sso]] } { diff --git a/gdb/testsuite/gdb.base/ending-run.exp b/gdb/testsuite/gdb.base/ending-run.exp index 0b5eadf..8c542ef 100644 --- a/gdb/testsuite/gdb.base/ending-run.exp +++ b/gdb/testsuite/gdb.base/ending-run.exp @@ -78,7 +78,7 @@ gdb_test_multiple "info line ending-run.c:$break1_line" "" { gdb_test_multiple "i b" "all set to continue" { -re ".* breakpoint .* breakpoint .*$gdb_prompt $" { - fail "all set to continue (didn't clear bps)" + fail "all set to continue (didn't clear bps)" } -re ".*2.*main.*$break2_line.*$gdb_prompt $" { pass "all set to continue" @@ -92,7 +92,7 @@ gdb_test_multiple "i b" "all set to continue" { # See if we can step out with control. The "1 2 3" stuff # is output from the program. # -if ![gdb_skip_stdio_test "cont"] { +if {![gdb_skip_stdio_test "cont"]} { gdb_test_stdio "cont" \ "1 2 7 14 23 34 47 62 79" \ "Breakpoint.*$break2_line.*" @@ -100,7 +100,7 @@ if ![gdb_skip_stdio_test "cont"] { gdb_test "cont" ".*Breakpoint.*$break2_line.*" } -if ![gdb_skip_stdio_test "Step to return"] { +if {![gdb_skip_stdio_test "Step to return"]} { gdb_test_stdio "next" \ "Goodbye!" \ "[expr {$break2_line + 1}].*" \ @@ -129,13 +129,13 @@ gdb_test_multiple "next" "step out of main" { fail "step out of main" gdb_test "n" ".*" "" } - -re ".*in.*start.*$gdb_prompt $" { + -re ".*in.*start.*$gdb_prompt $" { pass "step out of main" } - -re ".*in.*bsp_trap.*$gdb_prompt $" { + -re ".*in.*bsp_trap.*$gdb_prompt $" { pass "step out of main" } - -re ".*in.*init.*$gdb_prompt $" { + -re ".*in.*init.*$gdb_prompt $" { # This is what happens on sparc64-elf ultra. pass "step out of main" } @@ -172,7 +172,7 @@ gdb_test_multiple "next" "step out of main" { # This is what happens on the ARM RVDS runtime pass "step out of main" } - -re ".*in.*\\\$START\\\$.*from.*dld.sl.*$gdb_prompt $" { + -re ".*in.*\\\$START\\\$.*from.*dld.sl.*$gdb_prompt $" { pass "step out of main" } -re ".*in __wrap__?main ().*$gdb_prompt $" { @@ -183,7 +183,7 @@ gdb_test_multiple "next" "step out of main" { # another `next' is necessary. gdb_test "next" ".*in start_l ().*" "step out of main" } - -re ".*in.*currently asm.*$gdb_prompt $" { + -re ".*in.*currently asm.*$gdb_prompt $" { pass "step out of main" } -re "_*start\[0-9\]* \\(\[^)\]*\\).*$gdb_prompt $" { @@ -245,7 +245,7 @@ if {!$use_gdb_stub set program_exited_normally 1 } -re ".*Single.*in exit.*from.*dld.sl.*$gdb_prompt $" { - pass "step to end of run" + pass "step to end of run" set program_in_exit 1 } -re ".*Single.*_int_reset.*$gdb_prompt $" { @@ -254,7 +254,7 @@ if {!$use_gdb_stub set program_exited_normally 1 } } - } + } } if {$program_in_exit} { @@ -275,10 +275,10 @@ if {!$use_gdb_stub set exec_output [remote_exec host "ls core"] - if [ regexp "core not found" $exec_output] { + if {[ regexp "core not found" $exec_output]} { pass "no core dumped on quit" } else { - if [ regexp "No such file or directory" $exec_output] { + if {[ regexp "No such file or directory" $exec_output]} { pass "ls: core (No core dumped on quit)" } else { remote_exec build "rm -f core" diff --git a/gdb/testsuite/gdb.base/errno.exp b/gdb/testsuite/gdb.base/errno.exp index ea1ff70..9607b81 100644 --- a/gdb/testsuite/gdb.base/errno.exp +++ b/gdb/testsuite/gdb.base/errno.exp @@ -47,7 +47,7 @@ standard_testfile proc do_tests {{do_xfail_cast 0} {do_xfail 0} {do_xfail_core_test 0}} { clean_restart gdb_load $::binfile - if ![runto_main] { + if {![runto_main]} { return } @@ -145,12 +145,12 @@ proc do_tests {{do_xfail_cast 0} {do_xfail 0} {do_xfail_core_test 0}} { } } - if $do_xfail { + if {$do_xfail} { setup_xfail *-*-* } gdb_test "print errno" ".* = 42" - if $do_xfail_cast { + if {$do_xfail_cast} { setup_xfail *-*-* } gdb_test "print (int) errno" ".* = 42" @@ -173,7 +173,7 @@ proc do_tests {{do_xfail_cast 0} {do_xfail 0} {do_xfail_core_test 0}} { gdb_test "print errno" ".* = 36" "print masking errno" # Finish test early if no core file was made. - if !$core_supported { + if {!$core_supported} { return } @@ -184,7 +184,7 @@ proc do_tests {{do_xfail_cast 0} {do_xfail 0} {do_xfail_core_test 0}} { if { $core_loaded == -1 } { return } - if $do_xfail_core_test { + if {$do_xfail_core_test} { setup_xfail *-*-* } gdb_test "print errno" ".* = 42" "check errno value from corefile" diff --git a/gdb/testsuite/gdb.base/eu-strip-infcall.exp b/gdb/testsuite/gdb.base/eu-strip-infcall.exp index 1040f6a..43f2bc0 100644 --- a/gdb/testsuite/gdb.base/eu-strip-infcall.exp +++ b/gdb/testsuite/gdb.base/eu-strip-infcall.exp @@ -28,7 +28,7 @@ if {[lindex $status 0] != 0} { clean_restart $testfile -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/eval-avoid-side-effects.exp b/gdb/testsuite/gdb.base/eval-avoid-side-effects.exp index f914594..fdd6bed 100644 --- a/gdb/testsuite/gdb.base/eval-avoid-side-effects.exp +++ b/gdb/testsuite/gdb.base/eval-avoid-side-effects.exp @@ -22,7 +22,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/eval-skip.exp b/gdb/testsuite/gdb.base/eval-skip.exp index b4c856e..aca5118 100644 --- a/gdb/testsuite/gdb.base/eval-skip.exp +++ b/gdb/testsuite/gdb.base/eval-skip.exp @@ -23,7 +23,7 @@ # operators, or in the non returned part of a (x ? y: z) expression. # the part that is not evaluated is parsed and evaluated anyway, but with # the EVAL_SKIP flag set -# +# # source file "int-type.c" # diff --git a/gdb/testsuite/gdb.base/examine-backward.exp b/gdb/testsuite/gdb.base/examine-backward.exp index cc162ee..0eef327 100644 --- a/gdb/testsuite/gdb.base/examine-backward.exp +++ b/gdb/testsuite/gdb.base/examine-backward.exp @@ -22,7 +22,7 @@ if { [prepare_for_testing "failed to prepare for examine-backward" \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } @@ -357,7 +357,7 @@ with_test_prefix "backward disassemble general" { lappend disassmbly $instructions } for {set i 0} {$i < [llength $length_to_examine]} {incr i} { - set idx [expr [llength $length_to_examine] - $i - 1] + set idx [expr {[llength $length_to_examine] - $i - 1}] set len [lindex $length_to_examine $idx] set actual [capture_command_output "x/-${len}i" ""] set expected [lindex $disassmbly $idx] diff --git a/gdb/testsuite/gdb.base/execution-termios.exp b/gdb/testsuite/gdb.base/execution-termios.exp index 55656be..c817db2 100644 --- a/gdb/testsuite/gdb.base/execution-termios.exp +++ b/gdb/testsuite/gdb.base/execution-termios.exp @@ -24,7 +24,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { proc test { prefix body } { with_test_prefix $prefix { - if ![runto_main] { + if {![runto_main]} { return 0 } uplevel 1 $body @@ -39,7 +39,7 @@ test "next" { } test "infcall" { - if ![target_info exists gdb,cannot_call_functions] { + if {![target_info exists gdb,cannot_call_functions]} { gdb_test "print func ()" " = 1" "termios ok" } else { unsupported "cannot call functions" diff --git a/gdb/testsuite/gdb.base/expand-psymtabs.exp b/gdb/testsuite/gdb.base/expand-psymtabs.exp index 1315535..981a06d 100644 --- a/gdb/testsuite/gdb.base/expand-psymtabs.exp +++ b/gdb/testsuite/gdb.base/expand-psymtabs.exp @@ -26,7 +26,7 @@ # # This test is meant to verify that, even with lazy partial symtab # reading in effect, GDB can set breakpoints by line number -# successfully in either compilation unit. +# successfully in either compilation unit. standard_testfile diff --git a/gdb/testsuite/gdb.base/exprs.exp b/gdb/testsuite/gdb.base/exprs.exp index ee0c198..b1cc8fb 100644 --- a/gdb/testsuite/gdb.base/exprs.exp +++ b/gdb/testsuite/gdb.base/exprs.exp @@ -45,11 +45,11 @@ proc test_expr { args } { if { [llength $args] % 2 } { warning "an even # of arguments should be passed to test_expr" } - set last_ent [expr [llength $args] - 1] + set last_ent [expr {[llength $args] - 1}] set testname [lindex $args $last_ent] gdb_test [lindex $args 0] ".*" "$testname, setup" - for {set x 1} {$x < $last_ent} {set x [expr $x + 2]} { - gdb_test [lindex $args $x] [lindex $args [expr $x + 1]] "$testname, [lindex $args $x]" + for {set x 1} {$x < $last_ent} {set x [expr {$x + 2}]} { + gdb_test [lindex $args $x] [lindex $args [expr {$x + 1}]] "$testname, [lindex $args $x]" } } # @@ -224,10 +224,10 @@ gdb_test_multiple "print sizeof (long long) > sizeof (long)" \ pass "sizeof (long long) > sizeof (long) (false)" } } -if [expr ! $ok] { setup_xfail "*-*-*" } +if {!$ok} { setup_xfail "*-*-*" } gdb_test "print (void*) ((long long) (unsigned long) -1 + 1)" \ "warning: value truncated.*" "truncate (void*) 0x00000000ffffffff + 1" -if [expr ! $ok] { setup_xfail "*-*-*" } +if {!$ok} { setup_xfail "*-*-*" } gdb_test "print (void*) (~((long long)(unsigned long) -1) - 1)" \ "warning: value truncated.*" "truncate (void*) 0xffffffff00000000 - 1" diff --git a/gdb/testsuite/gdb.base/fileio.exp b/gdb/testsuite/gdb.base/fileio.exp index a6b4c23..e2b7354 100644 --- a/gdb/testsuite/gdb.base/fileio.exp +++ b/gdb/testsuite/gdb.base/fileio.exp @@ -39,7 +39,7 @@ if {[file exists $dir2] && ![file writable $dir2]} { system "rm -rf [standard_output_file *.fileio.test]" set oldtimeout $timeout -set timeout [expr "$timeout + 60"] +set timeout [expr {$timeout + 60}] clean_restart gdb_load $binfile @@ -51,7 +51,7 @@ if {![runto_main]} { return } -gdb_test "break stop" "Breakpoint .*$srcfile.*" +gdb_test "break stop" "Breakpoint .*$srcfile.*" set stop_msg ".*Breakpoint .* stop \\(\\) at.*$srcfile:.*static void stop \\(void\\) {}.*" @@ -73,7 +73,7 @@ gdb_test continue \ gdb_test "continue" ".*" "" -catch "system \"chmod -f -w [standard_output_file nowrt.fileio.test]\"" +catch {system "chmod -f -w [standard_output_file nowrt.fileio.test]"} # If the user is root, we will always have write permission. if { [root_user] } { @@ -241,7 +241,7 @@ gdb_test continue \ # This test fails on Cygwin because unlink() succeeds on Win32 systems # in that situation. -if [ishost *cygwin*] { +if {[ishost *cygwin*]} { setup_xfail "*-*-*" } # If the user is root, we will always have write permission. diff --git a/gdb/testsuite/gdb.base/filename-completion.exp b/gdb/testsuite/gdb.base/filename-completion.exp index c10941c..c80e634 100644 --- a/gdb/testsuite/gdb.base/filename-completion.exp +++ b/gdb/testsuite/gdb.base/filename-completion.exp @@ -148,7 +148,7 @@ proc test_tab_complete_within_line_multiple { input_line back_count \ [join [list \ [string range $input_line 0 end-$back_count] \ ${add_completed_line} \ - [string range $input_line end-[expr $back_count - 1] end]] \ + [string range $input_line end-[expr {$back_count - 1}] end]] \ ""] set expanded_line_re [string_to_regexp $expanded_line] @@ -166,7 +166,7 @@ proc test_tab_complete_within_line_multiple { input_line back_count \ set after_tab_re "^$input_line_re" set after_tab_re "$after_tab_re\\\x08{$back_count}" set after_tab_re "$after_tab_re${completion::bell_re}" - set tail [string range $input_line end-[expr $back_count - 1] end] + set tail [string range $input_line end-[expr {$back_count - 1}] end] set after_tab_re "$after_tab_re$add_completed_line_re" set after_tab_re "$after_tab_re[string_to_regexp $tail]" set after_tab_re "$after_tab_re\\\x08{$back_count}" @@ -218,7 +218,7 @@ proc test_tab_complete_within_line_unique { input_line back_count insert_str } { set re [string_to_regexp $input_line] set re $re\\\x08{$back_count} set re $re[string_to_regexp $insert_str] - set tail [string range $input_line end-[expr $back_count - 1] end] + set tail [string range $input_line end-[expr {$back_count - 1}] end] set re $re[string_to_regexp $tail] set re $re\\\x08{$back_count} diff --git a/gdb/testsuite/gdb.base/find-unmapped.exp b/gdb/testsuite/gdb.base/find-unmapped.exp index 28c5fd8..8f18650 100644 --- a/gdb/testsuite/gdb.base/find-unmapped.exp +++ b/gdb/testsuite/gdb.base/find-unmapped.exp @@ -19,7 +19,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile}] } { return -1 } -if ![runto breakpt] { +if {![runto breakpt]} { return -1 } diff --git a/gdb/testsuite/gdb.base/find.exp b/gdb/testsuite/gdb.base/find.exp index 3b2dfb0..aa4fc3c 100644 --- a/gdb/testsuite/gdb.base/find.exp +++ b/gdb/testsuite/gdb.base/find.exp @@ -165,7 +165,7 @@ gdb_test "find /w search_buf, +search_buf_size, 0x12345678" \ # For native targets, test a pattern straddling a chunk boundary. -if [isnative] { +if {[isnative]} { gdb_test_no_output "set *(int32_t*) &search_buf\[${CHUNK_SIZE}-1\] = 0xfdb97531" "" gdb_test "find /w search_buf, +search_buf_size, 0xfdb97531" \ "${hex_number}${one_pattern_found}" \ diff --git a/gdb/testsuite/gdb.base/finish-pretty.exp b/gdb/testsuite/gdb.base/finish-pretty.exp index 6c23cec..8f0c7c1 100644 --- a/gdb/testsuite/gdb.base/finish-pretty.exp +++ b/gdb/testsuite/gdb.base/finish-pretty.exp @@ -29,7 +29,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile $opts] } { } proc finish_pretty { } { - if ![runto foo] { + if {![runto foo]} { return } gdb_test_no_output "set print pretty" \ diff --git a/gdb/testsuite/gdb.base/fission-macro.exp b/gdb/testsuite/gdb.base/fission-macro.exp index c86a1a4..0680da6 100644 --- a/gdb/testsuite/gdb.base/fission-macro.exp +++ b/gdb/testsuite/gdb.base/fission-macro.exp @@ -14,7 +14,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. */ # Gcc 14 is the first release containing the fix for PR debug/111409. -require {expr [gcc_major_version] >= 14} +require {expr {[gcc_major_version] >= 14}} standard_testfile .c -2.c diff --git a/gdb/testsuite/gdb.base/foll-fork.exp b/gdb/testsuite/gdb.base/foll-fork.exp index 12db516..470f651 100644 --- a/gdb/testsuite/gdb.base/foll-fork.exp +++ b/gdb/testsuite/gdb.base/foll-fork.exp @@ -67,8 +67,8 @@ proc_with_prefix check_fork_catchpoints {} { # the followed process stops where it is expected to stop, that processes # are detached (or not) as expected, and that the inferior list has the # expected contents after following the fork. WHO is the argument to -# the 'set follow-fork-mode' command, DETACH is the argument to the -# 'set detach-on-fork' command, and CMD is the GDB command used to +# the 'set follow-fork-mode' command, DETACH is the argument to the +# 'set detach-on-fork' command, and CMD is the GDB command used to # execute the program past the fork. If the value of WHO or DETACH is # 'default', the corresponding GDB command is skipped for that test. # The value of CMD must be either 'next 2' or 'continue'. diff --git a/gdb/testsuite/gdb.base/foll-vfork.exp b/gdb/testsuite/gdb.base/foll-vfork.exp index 6ca7711..a480b93 100644 --- a/gdb/testsuite/gdb.base/foll-vfork.exp +++ b/gdb/testsuite/gdb.base/foll-vfork.exp @@ -53,7 +53,7 @@ if { [is_remote target] } { proc setup_gdb { binfile srcfile } { clean_restart $binfile - if ![runto_main] { + if {![runto_main]} { return -code return } diff --git a/gdb/testsuite/gdb.base/fork-print-inferior-events.exp b/gdb/testsuite/gdb.base/fork-print-inferior-events.exp index c24a9bc..0c6ad87 100644 --- a/gdb/testsuite/gdb.base/fork-print-inferior-events.exp +++ b/gdb/testsuite/gdb.base/fork-print-inferior-events.exp @@ -83,7 +83,7 @@ foreach_with_prefix print_inferior_events { "on" "off" } { # Always add the "Starting program..." string so that we # match exactly the lines we want. set output "Starting program: $binfile\\s*\r\n${thread_db_re}${output}${thread_db_re}${exited_normally_re}" - set i [expr $i + 1] + set i [expr {$i + 1}] gdb_test "run" $output } } diff --git a/gdb/testsuite/gdb.base/fortran-sym-case.exp b/gdb/testsuite/gdb.base/fortran-sym-case.exp index 58383c9..f0c4518 100644 --- a/gdb/testsuite/gdb.base/fortran-sym-case.exp +++ b/gdb/testsuite/gdb.base/fortran-sym-case.exp @@ -19,7 +19,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile}] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/frame-selection.exp b/gdb/testsuite/gdb.base/frame-selection.exp index fd492a3..9806a59 100644 --- a/gdb/testsuite/gdb.base/frame-selection.exp +++ b/gdb/testsuite/gdb.base/frame-selection.exp @@ -52,7 +52,7 @@ proc get_new_address { {addresses {}} } { set elem [lindex [lsort -integer -decreasing $addresses] 0] # Return a new address as a hex formatted string. - return [format "%#x" [expr $elem + 0x10]] + return [format "%#x" [expr {$elem + 0x10}]] } diff --git a/gdb/testsuite/gdb.base/fullname.exp b/gdb/testsuite/gdb.base/fullname.exp index ec90179..d989a48 100644 --- a/gdb/testsuite/gdb.base/fullname.exp +++ b/gdb/testsuite/gdb.base/fullname.exp @@ -35,7 +35,7 @@ if { [gdb_compile [standard_output_file tmp-${srcfile}] "${binfile}" executable return -1 } -# Unlike most GDB tests, we do not use gdb_reinitialize_dir in this script. +# Unlike most GDB tests, we do not use gdb_reinitialize_dir in this script. # We're testing GDB's ability to find files in other ways. # Get the line number. diff --git a/gdb/testsuite/gdb.base/fullpath-expand.exp b/gdb/testsuite/gdb.base/fullpath-expand.exp index d18a6f4..a94488f 100644 --- a/gdb/testsuite/gdb.base/fullpath-expand.exp +++ b/gdb/testsuite/gdb.base/fullpath-expand.exp @@ -33,7 +33,7 @@ with_cwd $srcdir { } } -set result [catch "exec realpath ${srcdir}/${subdir}/${srcfile2}" realsrcfile2] +set result [catch {exec realpath ${srcdir}/${subdir}/${srcfile2}} realsrcfile2] if { $result != 0 || $realsrcfile2 == "" } { untested "invalid realpath of ${srcfile2}: result $result output $realsrcfile2" return -1 diff --git a/gdb/testsuite/gdb.base/func-ptr.exp b/gdb/testsuite/gdb.base/func-ptr.exp index 4bc80ac..d2eb0bc 100644 --- a/gdb/testsuite/gdb.base/func-ptr.exp +++ b/gdb/testsuite/gdb.base/func-ptr.exp @@ -21,7 +21,7 @@ if { [prepare_for_testing "failed to prepare" "func-ptr" {func-ptr.c} {debug}] } return -1 } -if ![runto_main] { +if {![runto_main]} { return 0 } diff --git a/gdb/testsuite/gdb.base/funcargs.exp b/gdb/testsuite/gdb.base/funcargs.exp index 1c1b74b..e4c3c5b 100644 --- a/gdb/testsuite/gdb.base/funcargs.exp +++ b/gdb/testsuite/gdb.base/funcargs.exp @@ -21,7 +21,7 @@ standard_testfile set gcc_compiled [is_c_compiler_gcc] set compile_flags {debug nowarnings quiet} -if [support_complex_tests] { +if {[support_complex_tests]} { lappend compile_flags "additional_flags=-DTEST_COMPLEX" } @@ -55,7 +55,7 @@ proc_with_prefix integral_args {} { # Print each arg as a double check to see if we can print # them here as well as with backtrace. - gdb_test "print c" ".* = 97 'a'" "print c after run to call0a" + gdb_test "print c" ".* = 97 'a'" "print c after run to call0a" gdb_test "print s" ".* = 1" "print s after run to call0a" gdb_test "print i" ".* = 2" "print i after run to call0a" gdb_test "print l " ".* = 3" "print l after run to call0a" @@ -921,7 +921,7 @@ proc_with_prefix localvars_in_indirect_call { } { gdb_breakpoint call0a gdb_continue call0a delete_breakpoints - + # Print each arg as a double check to see if we can print # them here as well as with backtrace. @@ -937,9 +937,9 @@ proc_with_prefix localvars_in_indirect_call { } { "#0.*call0a \\(c=97 'a', s=1, i=2, l=3\\).*#1.*main.*" \ "backtrace in indirectly called function" - # + # # "finish" brings us back to main. We then will try to step through - # the second indirect call. + # the second indirect call. # On some targets (e.g. m68k) gdb will stop from the finish in midline # of the first indirect call. This is due to stack adjustment instructions # after the indirect call. In these cases we will step till we hit the @@ -1032,7 +1032,7 @@ proc_with_prefix stepping_over_trampolines { } { } set prev_timeout $timeout -if [istarget "mips*tx39-*"] { +if {[istarget "mips*tx39-*"]} { set timeout 300 } else { set timeout 60 @@ -1083,7 +1083,7 @@ if {$allow_float_test} { } # Test _Complex type here if supported. -if [support_complex_tests] { +if {[support_complex_tests]} { complex_args complex_integral_args diff --git a/gdb/testsuite/gdb.base/gcore-memory-usage.exp b/gdb/testsuite/gdb.base/gcore-memory-usage.exp index 14b03a0..ca47ad6 100644 --- a/gdb/testsuite/gdb.base/gcore-memory-usage.exp +++ b/gdb/testsuite/gdb.base/gcore-memory-usage.exp @@ -73,8 +73,8 @@ proc run_test {megs max_mem} { # Do the main part of the test: How much is the memory # usage of GDB going to grow after using the gcore command. - set diff_k [expr $mem_after - $mem_before] - set diff [expr $diff_k/1024] + set diff_k [expr {$mem_after - $mem_before}] + set diff [expr {$diff_k/1024}] verbose -log "The gcore command used $diff Mb ($diff_k Kb)" gdb_assert {$diff <= $max_mem} "gdb did not use too much memory" diff --git a/gdb/testsuite/gdb.base/gcore-relro-pie.exp b/gdb/testsuite/gdb.base/gcore-relro-pie.exp index 641caf1..a7a6e9b 100644 --- a/gdb/testsuite/gdb.base/gcore-relro-pie.exp +++ b/gdb/testsuite/gdb.base/gcore-relro-pie.exp @@ -29,7 +29,7 @@ set gcorefile ${binfile}.gcore set strip_program [transform strip] remote_file host delete ${stripped_binfile} -if [run_on_host "strip" "$strip_program" "-g -o ${stripped_binfile} $binfile"] { +if {[run_on_host "strip" "$strip_program" "-g -o ${stripped_binfile} $binfile"]} { return -1 } @@ -42,7 +42,7 @@ clean_restart gdb_load $stripped_binfile # The binary is stripped of debug info, but not minsyms. -if ![runto break_here] { +if {![runto break_here]} { return -1 } diff --git a/gdb/testsuite/gdb.base/gcore-relro.exp b/gdb/testsuite/gdb.base/gcore-relro.exp index 2bbd064..4d3d352 100644 --- a/gdb/testsuite/gdb.base/gcore-relro.exp +++ b/gdb/testsuite/gdb.base/gcore-relro.exp @@ -38,7 +38,7 @@ with_test_prefix "first session" { gdb_load $binfile gdb_load_shlib ${binfile_lib} - if ![runto lib] { + if {![runto lib]} { return -1 } diff --git a/gdb/testsuite/gdb.base/gcore-tls-pie.exp b/gdb/testsuite/gdb.base/gcore-tls-pie.exp index a8f7366..27df210 100644 --- a/gdb/testsuite/gdb.base/gcore-tls-pie.exp +++ b/gdb/testsuite/gdb.base/gcore-tls-pie.exp @@ -33,7 +33,7 @@ set gcorefile ${binfile}.gcore set strip_program [transform strip] remote_file host delete ${stripped_binfile} -if [run_on_host "strip" "$strip_program" "-g -o ${stripped_binfile} $binfile"] { +if {[run_on_host "strip" "$strip_program" "-g -o ${stripped_binfile} $binfile"]} { return -1 } @@ -46,7 +46,7 @@ clean_restart gdb_load $stripped_binfile # The binary is stripped of debug info, but not minsyms. -if ![runto break_here] { +if {![runto break_here]} { return -1 } diff --git a/gdb/testsuite/gdb.base/gcore.exp b/gdb/testsuite/gdb.base/gcore.exp index c8a4c11..a902760 100644 --- a/gdb/testsuite/gdb.base/gcore.exp +++ b/gdb/testsuite/gdb.base/gcore.exp @@ -102,7 +102,7 @@ if {![string compare $pre_corefile_sysregs $post_corefile_sysregs]} { set post_corefile_extern_array \ [capture_command_output "print extern_array" "$print_prefix"] -if ![string compare $pre_corefile_extern_array $post_corefile_extern_array] { +if {![string compare $pre_corefile_extern_array $post_corefile_extern_array]} { pass "corefile restored extern array" } else { fail "corefile restored extern array" @@ -110,7 +110,7 @@ if ![string compare $pre_corefile_extern_array $post_corefile_extern_array] { set post_corefile_static_array \ [capture_command_output "print static_array" "$print_prefix"] -if ![string compare $pre_corefile_static_array $post_corefile_static_array] { +if {![string compare $pre_corefile_static_array $post_corefile_static_array]} { pass "corefile restored static array" } else { fail "corefile restored static array" @@ -118,7 +118,7 @@ if ![string compare $pre_corefile_static_array $post_corefile_static_array] { set post_corefile_uninit_array \ [capture_command_output "print un_initialized_array" "$print_prefix"] -if ![string compare $pre_corefile_uninit_array $post_corefile_uninit_array] { +if {![string compare $pre_corefile_uninit_array $post_corefile_uninit_array]} { pass "corefile restored un-initialized array" } else { fail "corefile restored un-initialized array" @@ -126,7 +126,7 @@ if ![string compare $pre_corefile_uninit_array $post_corefile_uninit_array] { set post_corefile_heap_string \ [capture_command_output "print heap_string" "$print_prefix"] -if ![string compare $pre_corefile_heap_string $post_corefile_heap_string] { +if {![string compare $pre_corefile_heap_string $post_corefile_heap_string]} { pass "corefile restored heap array" } else { fail "corefile restored heap array" @@ -134,14 +134,14 @@ if ![string compare $pre_corefile_heap_string $post_corefile_heap_string] { set post_corefile_local_array \ [capture_command_output "print array_func::local_array" "$print_prefix"] -if ![string compare $pre_corefile_local_array $post_corefile_local_array] { +if {![string compare $pre_corefile_local_array $post_corefile_local_array]} { pass "corefile restored stack array" } else { fail "corefile restored stack array" } set post_corefile_backtrace [capture_command_output "backtrace" ""] -if ![string compare $pre_corefile_backtrace $post_corefile_backtrace] { +if {![string compare $pre_corefile_backtrace $post_corefile_backtrace]} { pass "corefile restored backtrace" } else { fail "corefile restored backtrace" diff --git a/gdb/testsuite/gdb.base/gdb-sigterm.exp b/gdb/testsuite/gdb.base/gdb-sigterm.exp index f0802c4..02410fd 100644 --- a/gdb/testsuite/gdb.base/gdb-sigterm.exp +++ b/gdb/testsuite/gdb.base/gdb-sigterm.exp @@ -34,7 +34,7 @@ if { [build_executable ${testfile}.exp ${testfile} $srcfile $options] == -1 } { proc do_test { pass } { global testfile gdb_prompt binfile pf_prefix - if ![runto_main] { + if {![runto_main]} { return -1 } @@ -53,7 +53,7 @@ proc do_test { pass } { set abort 0 } } - if $abort { + if {$abort} { verbose -log "$pf_prefix $test: did not run" return $abort } diff --git a/gdb/testsuite/gdb.base/gdb1555.exp b/gdb/testsuite/gdb.base/gdb1555.exp index ab12a28..174c8f7 100644 --- a/gdb/testsuite/gdb.base/gdb1555.exp +++ b/gdb/testsuite/gdb.base/gdb1555.exp @@ -49,8 +49,8 @@ gdb_test_multiple "s" $name \ -re "hithere2 \\(\\) at.*${libfile}.c:\[0-9\]+\r\n\[0-9\]+.*a = 21;.*$gdb_prompt $" { pass $name } - -re "0x\[0-9a-f\]+ in .* \\(\\) from /lib/ld.so.1.*$gdb_prompt $" { - kfail "gdb/1555" $name + -re "0x\[0-9a-f\]+ in .* \\(\\) from /lib/ld.so.1.*$gdb_prompt $" { + kfail "gdb/1555" $name } } @@ -61,8 +61,8 @@ gdb_test_multiple "n" $name \ -re "\[0-9\]+.*return a;.*$gdb_prompt $" { pass $name } - -re "Single stepping until exit from function .*, \r\nwhich has no line number information.\r\n\r\n$inferior_exited_re normally.*$gdb_prompt $" { - kfail "gdb/1555" $name + -re "Single stepping until exit from function .*, \r\nwhich has no line number information.\r\n\r\n$inferior_exited_re normally.*$gdb_prompt $" { + kfail "gdb/1555" $name } } diff --git a/gdb/testsuite/gdb.base/gdb1821.exp b/gdb/testsuite/gdb.base/gdb1821.exp index c377150..cd9c542 100644 --- a/gdb/testsuite/gdb.base/gdb1821.exp +++ b/gdb/testsuite/gdb.base/gdb1821.exp @@ -30,6 +30,6 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { if {![runto_main]} { return -} -gdb_test "print /x bar" "{x__0 = 0x0, y__0 = 0x0, z__1 = 0x0}" +} +gdb_test "print /x bar" "{x__0 = 0x0, y__0 = 0x0, z__1 = 0x0}" diff --git a/gdb/testsuite/gdb.base/gnu-debugdata.exp b/gdb/testsuite/gdb.base/gnu-debugdata.exp index e959078..2fabd45 100644 --- a/gdb/testsuite/gdb.base/gnu-debugdata.exp +++ b/gdb/testsuite/gdb.base/gnu-debugdata.exp @@ -15,7 +15,7 @@ standard_testfile -if [build_executable ${testfile}.exp $testfile] { +if {[build_executable ${testfile}.exp $testfile]} { return -1 } diff --git a/gdb/testsuite/gdb.base/hbreak-unmapped.exp b/gdb/testsuite/gdb.base/hbreak-unmapped.exp index 80b1247..80c7aa8 100644 --- a/gdb/testsuite/gdb.base/hbreak-unmapped.exp +++ b/gdb/testsuite/gdb.base/hbreak-unmapped.exp @@ -21,7 +21,7 @@ if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/hbreak.exp b/gdb/testsuite/gdb.base/hbreak.exp index dca3bdd..6a9bcbe 100644 --- a/gdb/testsuite/gdb.base/hbreak.exp +++ b/gdb/testsuite/gdb.base/hbreak.exp @@ -21,7 +21,7 @@ if { [prepare_for_testing "failed to prepare" ${test} ${srcfile}] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/hbreak2.exp b/gdb/testsuite/gdb.base/hbreak2.exp index 9390e40..65f08e2 100644 --- a/gdb/testsuite/gdb.base/hbreak2.exp +++ b/gdb/testsuite/gdb.base/hbreak2.exp @@ -477,7 +477,7 @@ proc test_next_with_recursion {} { delete_breakpoints - if [istarget "mips*tx39-*"] { + if {[istarget "mips*tx39-*"]} { set timeout 60 } # We used to set timeout here for all other targets as well. This diff --git a/gdb/testsuite/gdb.base/huge.exp b/gdb/testsuite/gdb.base/huge.exp index cb12964..01bc9ea 100644 --- a/gdb/testsuite/gdb.base/huge.exp +++ b/gdb/testsuite/gdb.base/huge.exp @@ -23,14 +23,14 @@ require {!target_info exists gdb,skip_huge_test} standard_testfile .c -set max [expr 2 * 1024 * 1024] +set max [expr {2 * 1024 * 1024}] set min 16 set opts {} lappend opts debug set compilation_succeeded 0 -for { set size $max } { $size >= $min } { set size [expr $size / 2] } { +for { set size $max } { $size >= $min } { set size [expr {$size / 2}] } { set try_opts [concat $opts [list additional_flags=-DCRASH_GDB=$size]] if { [build_executable $testfile.exp $testfile $srcfile $try_opts] == -1 } { continue @@ -39,7 +39,7 @@ for { set size $max } { $size >= $min } { set size [expr $size / 2] } { set compilation_succeeded 1 break } -require {expr $compilation_succeeded} +require {expr {$compilation_succeeded}} # Start with a fresh gdb. clean_restart @@ -84,6 +84,6 @@ save_vars { timeout } { unsupported $test } else { # At 56 passes with and without the fix, so use 55. - gdb_assert {$space_used < [expr 55 * 4 * $size] } $test + gdb_assert {$space_used < [expr {55 * 4 * $size}] } $test } } diff --git a/gdb/testsuite/gdb.base/hw-sw-break-same-address.exp b/gdb/testsuite/gdb.base/hw-sw-break-same-address.exp index 93c8f54..a342104 100644 --- a/gdb/testsuite/gdb.base/hw-sw-break-same-address.exp +++ b/gdb/testsuite/gdb.base/hw-sw-break-same-address.exp @@ -26,7 +26,7 @@ if { [prepare_for_testing "failed to prepare" ${test} ${srcfile}] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/included.exp b/gdb/testsuite/gdb.base/included.exp index e5223c9..a125a27 100644 --- a/gdb/testsuite/gdb.base/included.exp +++ b/gdb/testsuite/gdb.base/included.exp @@ -26,7 +26,7 @@ gdb_test_no_output "set listsize 1" gdb_test "list -q main" ".*" get_debug_format -set non_dwarf [expr ! [test_debug_format "DWARF \[0-9\]"]] +set non_dwarf [expr {! [test_debug_format "DWARF \[0-9\]"]}] # We should be able to find the source file containing the definition, # even though it was an included header. diff --git a/gdb/testsuite/gdb.base/index-cache.exp b/gdb/testsuite/gdb.base/index-cache.exp index a1f64b0..c7dbc46 100644 --- a/gdb/testsuite/gdb.base/index-cache.exp +++ b/gdb/testsuite/gdb.base/index-cache.exp @@ -29,8 +29,8 @@ if { [build_executable "failed to prepare" $testfile [list $srcfile $srcfile2] \ # - the binary already has an index section # - we use the -readnow switch set has_index_section [exec_has_index_section $binfile] -set uses_readnow [expr [string first "-readnow" $GDBFLAGS] != -1] -set expecting_index_cache_use [expr !$has_index_section && !$uses_readnow] +set uses_readnow [expr {[string first "-readnow" $GDBFLAGS] != -1}] +set expecting_index_cache_use [expr {!$has_index_section && !$uses_readnow}] # List the files in DIR on the host (where GDB-under-test runs). # Return a list of two elements: diff --git a/gdb/testsuite/gdb.base/infcall-nested-structs.exp.tcl b/gdb/testsuite/gdb.base/infcall-nested-structs.exp.tcl index 6c95934..b633cf2 100644 --- a/gdb/testsuite/gdb.base/infcall-nested-structs.exp.tcl +++ b/gdb/testsuite/gdb.base/infcall-nested-structs.exp.tcl @@ -18,7 +18,7 @@ # Some targets can't call functions, so don't even bother with this # test. -if [target_info exists gdb,cannot_call_functions] { +if {[target_info exists gdb,cannot_call_functions]} { unsupported "this target can not call functions" continue } @@ -28,7 +28,7 @@ set float_types { tf td tld } set complex_types { tfc tdc tldc } set compile_flags {debug} -if [support_complex_tests] { +if {[support_complex_tests]} { lappend compile_flags "additional_flags=-DTEST_COMPLEX" lappend compile_flags "additional_flags=-Wno-psabi" } @@ -164,7 +164,7 @@ foreach ta $int_types { start_gdb_and_run_tests $lang $ta } -if [support_complex_tests] { +if {[support_complex_tests]} { foreach ta $complex_types { start_gdb_and_run_tests $lang $ta } diff --git a/gdb/testsuite/gdb.base/inferior-args.exp b/gdb/testsuite/gdb.base/inferior-args.exp index 6b92c08..6ac25fc 100644 --- a/gdb/testsuite/gdb.base/inferior-args.exp +++ b/gdb/testsuite/gdb.base/inferior-args.exp @@ -17,7 +17,7 @@ # This does not work on boards that don't support inferior arguments. require {!target_info exists noargs} -require {expr [have_startup_shell] != -1} +require {expr {[have_startup_shell] != -1}} standard_testfile .c @@ -127,13 +127,13 @@ proc do_test { method startup_with_shell inferior_args expected_results \ error "invalid method $method" } - set argc [expr [llength $expected_results] + 1] + set argc [expr {[llength $expected_results] + 1}] # Now that we are stopped at main, inspect argc/argv. gdb_test "print argc" " = $argc" gdb_test "print argv\[0\]" " = $hex \"\[^\r\n\]+\"" for { set i 1 } { $i < $argc } { incr i } { - set idx [expr $i - 1] + set idx [expr {$i - 1}] gdb_test "print argv\[$i\]" " = [lindex $expected_results $idx]" } } diff --git a/gdb/testsuite/gdb.base/inferior-died.exp b/gdb/testsuite/gdb.base/inferior-died.exp index 9ba3a4c..83f500b 100644 --- a/gdb/testsuite/gdb.base/inferior-died.exp +++ b/gdb/testsuite/gdb.base/inferior-died.exp @@ -31,7 +31,7 @@ save_vars { GDBFLAGS } { gdb_test_no_output "set detach-on-fork off" -if ![runto_main] { +if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.base/info-macros.exp b/gdb/testsuite/gdb.base/info-macros.exp index 2dd0fc9..1e10604 100644 --- a/gdb/testsuite/gdb.base/info-macros.exp +++ b/gdb/testsuite/gdb.base/info-macros.exp @@ -22,7 +22,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug macr return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/info-os.exp b/gdb/testsuite/gdb.base/info-os.exp index 20d28db..be7a746 100644 --- a/gdb/testsuite/gdb.base/info-os.exp +++ b/gdb/testsuite/gdb.base/info-os.exp @@ -128,7 +128,7 @@ proc expect_multiline { command expect test } { exp_continue } -re "^$gdb_prompt $" { - if $found { + if {$found} { set ok 1 } # Exit the loop. diff --git a/gdb/testsuite/gdb.base/info-shared.exp b/gdb/testsuite/gdb.base/info-shared.exp index e81b28e..7475749 100644 --- a/gdb/testsuite/gdb.base/info-shared.exp +++ b/gdb/testsuite/gdb.base/info-shared.exp @@ -84,7 +84,7 @@ check_info_shared "info sharedlibrary before running" 0 0 # Start the inferior, and check neither of the libraries are loaded at # the start. -if ![runto_main] { +if {![runto_main]} { return 0 } check_info_shared "info sharedlibrary #1" 0 0 diff --git a/gdb/testsuite/gdb.base/info_sources.exp b/gdb/testsuite/gdb.base/info_sources.exp index d26362d..3340c83 100644 --- a/gdb/testsuite/gdb.base/info_sources.exp +++ b/gdb/testsuite/gdb.base/info_sources.exp @@ -68,7 +68,7 @@ proc test_info_sources {args expect_seen_info_sources \ } } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/info_sources_2.exp b/gdb/testsuite/gdb.base/info_sources_2.exp index 09e9972..aa26140 100644 --- a/gdb/testsuite/gdb.base/info_sources_2.exp +++ b/gdb/testsuite/gdb.base/info_sources_2.exp @@ -40,7 +40,7 @@ gdb_load $binfile set solib_name [gdb_load_shlib $solib_name] -if ![runto foo] { +if {![runto foo]} { untested "failed to run to function foo" return -1 } @@ -148,7 +148,7 @@ proc run_info_sources { extra_args args } { # Make sure we handle the case where there are no source files # associated with a particular objfile. set source_list {} - if [info exists info_sources($objfile)] { + if {[info exists info_sources($objfile)]} { set source_list $info_sources($objfile) } diff --git a/gdb/testsuite/gdb.base/infoline-reloc-main-from-zero.exp b/gdb/testsuite/gdb.base/infoline-reloc-main-from-zero.exp index bc70a5d..90300c8 100644 --- a/gdb/testsuite/gdb.base/infoline-reloc-main-from-zero.exp +++ b/gdb/testsuite/gdb.base/infoline-reloc-main-from-zero.exp @@ -51,6 +51,6 @@ gdb_test "add-symbol-file $binfile 0xffff0000" \ "add symbol table from file \".*\" at.*\\(y or n\\) " "y" # Check if we are able to read offset adjusted line information of main - + gdb_test "info line main" \ "Line.*starts at address 0xffff0000.*and ends at.*" diff --git a/gdb/testsuite/gdb.base/interrupt-daemon.exp b/gdb/testsuite/gdb.base/interrupt-daemon.exp index b909437..aa6b675 100644 --- a/gdb/testsuite/gdb.base/interrupt-daemon.exp +++ b/gdb/testsuite/gdb.base/interrupt-daemon.exp @@ -35,7 +35,7 @@ proc do_test {} { gdb_test "set follow-fork-mode child" ".*" - if ![runto "daemon_main"] { + if {![runto "daemon_main"]} { return } diff --git a/gdb/testsuite/gdb.base/interrupt-noterm.exp b/gdb/testsuite/gdb.base/interrupt-noterm.exp index fc50bd0..c09a84c 100644 --- a/gdb/testsuite/gdb.base/interrupt-noterm.exp +++ b/gdb/testsuite/gdb.base/interrupt-noterm.exp @@ -15,15 +15,15 @@ standard_testfile -if [prepare_for_testing "failed to prepare for testing" \ - ${testfile} ${srcfile} {debug}] { +if {[prepare_for_testing "failed to prepare for testing" \ + ${testfile} ${srcfile} {debug}]} { return -1 } # Pretend there's no terminal. gdb_test_no_output "set interactive-mode off" -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/jit-bfd-name.exp b/gdb/testsuite/gdb.base/jit-bfd-name.exp index 756a38b..723922c 100644 --- a/gdb/testsuite/gdb.base/jit-bfd-name.exp +++ b/gdb/testsuite/gdb.base/jit-bfd-name.exp @@ -54,11 +54,11 @@ if { ![runto_main] } { # Poke desired values directly into inferior instead of using "set # args" because "set args" does not work under gdbserver. -set count [expr [llength $jit_solibs_target] + 1] +set count [expr {[llength $jit_solibs_target] + 1}] gdb_test_no_output "set var argc=$count" "forging argc" gdb_test_no_output "set var argv=fake_argv" "forging argv" for {set i 1} {$i < $count} {incr i} { - set jit_solib_target [lindex $jit_solibs_target [expr $i-1]] + set jit_solib_target [lindex $jit_solibs_target [expr {$i-1}]] gdb_test_no_output "set var argv\[$i\]=\"${jit_solib_target}\"" \ "forging argv\[$i\]" } @@ -124,7 +124,7 @@ set count 0 foreach addr $symfile_addrs len $symfile_lengths { incr count set output [standard_output_file "dump-elf-solib.${count}.so"] - set end [expr $addr + $len] + set end [expr {$addr + $len}] gdb_test_no_output "dump binary memory $output $addr $end" \ "dump jit solib $count" @@ -141,7 +141,7 @@ foreach addr $symfile_addrs len $symfile_lengths { set start [format 0x%x $addr] # Calculate the end address. - set end [format 0x%x [expr $addr + $len]] + set end [format 0x%x [expr {$addr + $len}]] # This is what we expect the address range to look like in the BFD # filename. diff --git a/gdb/testsuite/gdb.base/jit-elf-so.exp b/gdb/testsuite/gdb.base/jit-elf-so.exp index 8f16bdb..a709c0c 100644 --- a/gdb/testsuite/gdb.base/jit-elf-so.exp +++ b/gdb/testsuite/gdb.base/jit-elf-so.exp @@ -102,10 +102,10 @@ proc one_jit_test {solib_binfiles_target match_str} { # Poke desired values directly into inferior instead of using "set args" # because "set args" does not work under gdbserver. - gdb_test_no_output "set var argc=[expr $count + 1]" "forging argc" + gdb_test_no_output "set var argc=[expr {$count + 1}]" "forging argc" gdb_test_no_output "set var argv=fake_argv" "forging argv" for {set i 1} {$i <= $count} {incr i} { - set binfile_target [lindex $solib_binfiles_target [expr $i-1]] + set binfile_target [lindex $solib_binfiles_target [expr {$i-1}]] gdb_test_no_output "set var argv\[$i\]=\"${binfile_target}\"" \ "forging argv\[$i\]" } diff --git a/gdb/testsuite/gdb.base/jit-elf.exp b/gdb/testsuite/gdb.base/jit-elf.exp index 2dc67a5..2ce9c77 100644 --- a/gdb/testsuite/gdb.base/jit-elf.exp +++ b/gdb/testsuite/gdb.base/jit-elf.exp @@ -103,7 +103,7 @@ proc one_jit_test {jit_solibs_target match_str reattach} { gdb_test_no_output "set var argc=$count" "forging argc" gdb_test_no_output "set var argv=fake_argv" "forging argv" for {set i 1} {$i < $count} {incr i} { - set jit_solib_target [lindex $jit_solibs_target [expr $i-1]] + set jit_solib_target [lindex $jit_solibs_target [expr {$i-1}]] gdb_test_no_output "set var argv\[$i\]=\"${jit_solib_target}\"" \ "forging argv\[$i\]" } diff --git a/gdb/testsuite/gdb.base/jit-reader-simple.exp b/gdb/testsuite/gdb.base/jit-reader-simple.exp index f577dba..eebab22 100644 --- a/gdb/testsuite/gdb.base/jit-reader-simple.exp +++ b/gdb/testsuite/gdb.base/jit-reader-simple.exp @@ -126,7 +126,7 @@ proc jit_test_reread {standalone change_addr} { # second, gdb might not reload the executable automatically. sleep 1 - if ${change_addr} { + if {${change_addr}} { set options "additional_flags=-DSPACER" if {$standalone} { gdb_rename_execfile $binfile ${binfile}x @@ -155,7 +155,7 @@ proc jit_test_reread {standalone change_addr} { "maint info breakpoints shows jit breakpoint" } - if ${change_addr} { + if {${change_addr}} { gdb_assert {$addr_before != $addr_after} "address changed" } else { gdb_assert {$addr_before == $addr_after} "address didn't change" @@ -163,7 +163,7 @@ proc jit_test_reread {standalone change_addr} { } foreach standalone {1 0} { - with_test_prefix [expr ($standalone)?"standalone":"shared"] { + with_test_prefix [expr {($standalone)?"standalone":"shared"}] { with_test_prefix "change addr" { jit_test_reread $standalone 1 } diff --git a/gdb/testsuite/gdb.base/kill-after-signal.exp b/gdb/testsuite/gdb.base/kill-after-signal.exp index 9ed67f8..de0093e 100644 --- a/gdb/testsuite/gdb.base/kill-after-signal.exp +++ b/gdb/testsuite/gdb.base/kill-after-signal.exp @@ -19,13 +19,13 @@ require can_single_step_to_signal_handler require {!target_info exists gdb,nosignals} -if [prepare_for_testing "failed to prepare" ${testfile}] { +if {[prepare_for_testing "failed to prepare" ${testfile}]} { return -1 } gdb_test "handle SIGUSR1 stop print pass" "SIGUSR1\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+.*" -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/kill-detach-inferiors-cmd.exp b/gdb/testsuite/gdb.base/kill-detach-inferiors-cmd.exp index 57ec330..b97d2c2 100644 --- a/gdb/testsuite/gdb.base/kill-detach-inferiors-cmd.exp +++ b/gdb/testsuite/gdb.base/kill-detach-inferiors-cmd.exp @@ -24,7 +24,7 @@ require allow_multi_inferior_tests standard_testfile set executable $testfile -if [prepare_for_testing "failed to prepare" $executable] { +if {[prepare_for_testing "failed to prepare" $executable]} { return -1 } diff --git a/gdb/testsuite/gdb.base/killed-outside.exp b/gdb/testsuite/gdb.base/killed-outside.exp index 2b367e4..6cdbdb4 100644 --- a/gdb/testsuite/gdb.base/killed-outside.exp +++ b/gdb/testsuite/gdb.base/killed-outside.exp @@ -49,7 +49,7 @@ proc test {cmds_after_kill} { clean_restart gdb_load $binfile - if ![runto done] { + if {![runto done]} { return } diff --git a/gdb/testsuite/gdb.base/langs.exp b/gdb/testsuite/gdb.base/langs.exp index aa8d8e0..ab09d82 100644 --- a/gdb/testsuite/gdb.base/langs.exp +++ b/gdb/testsuite/gdb.base/langs.exp @@ -16,7 +16,7 @@ standard_testfile langs0.c langs1.c langs2.c -if [is_remote host] { +if {[is_remote host]} { remote_download host ${srcdir}/${subdir}/langs1.f remote_download host ${srcdir}/${subdir}/langs2.cxx } @@ -88,7 +88,7 @@ if {[runto csub]} { gdb_test "show language" "currently $lang\".*" \ "show language at main" - if [target_info exists gdb,noresults] { return } + if {[target_info exists gdb,noresults]} { return } gdb_continue_to_end "first session" } @@ -102,7 +102,7 @@ if {[runto csub]} { # Also test warn-language-frame-mismatch. gdb_test_no_output "set warn-language-frame-mismatch off" gdb_test_no_output "set lang minimal" "set lang to minimal" - + gdb_test "print x" " = 5000" "print parameter value" # Ensure this at least does not crash. diff --git a/gdb/testsuite/gdb.base/ldbl_e308.exp b/gdb/testsuite/gdb.base/ldbl_e308.exp index c7b2bcb..cb997cb 100644 --- a/gdb/testsuite/gdb.base/ldbl_e308.exp +++ b/gdb/testsuite/gdb.base/ldbl_e308.exp @@ -19,7 +19,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/limited-length.exp b/gdb/testsuite/gdb.base/limited-length.exp index cd628b4..3b0857d 100644 --- a/gdb/testsuite/gdb.base/limited-length.exp +++ b/gdb/testsuite/gdb.base/limited-length.exp @@ -74,7 +74,7 @@ with_test_prefix "with standard max-value size" { # Set the max-value-size so we can only print 51 elements. set elements 51 set int_size [get_valueof "/d" "sizeof(large_1d_array\[0\])" "*unknown*"] -gdb_test_no_output "set max-value-size [expr $int_size * $elements]" +gdb_test_no_output "set max-value-size [expr {$int_size * $elements}]" with_test_prefix "with reduced max-value size" { gdb_test "print large_1d_array" \ diff --git a/gdb/testsuite/gdb.base/line-symtabs.exp b/gdb/testsuite/gdb.base/line-symtabs.exp index cd3326d..f937b32 100644 --- a/gdb/testsuite/gdb.base/line-symtabs.exp +++ b/gdb/testsuite/gdb.base/line-symtabs.exp @@ -24,7 +24,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/lineinc.exp b/gdb/testsuite/gdb.base/lineinc.exp index 2382fa5..61983cc 100644 --- a/gdb/testsuite/gdb.base/lineinc.exp +++ b/gdb/testsuite/gdb.base/lineinc.exp @@ -21,7 +21,7 @@ # # Compiling lineinc.c with Dwarf 2 macro information will produce # something like this: -# +# # $ gcc -g3 lineinc.c -o lineinc # $ readelf -wml lineinc # ... @@ -33,10 +33,10 @@ # 4 0 0 0 lineinc3.h # ... # Contents of the .debug_macinfo section: -# +# # DW_MACINFO_start_file - lineno: 0 filenum: 1 # DW_MACINFO_define - lineno : 1 macro : __VERSION__ "3.2 20020903 (Red Hat Linux 8.0 3.2-7)" -# DW_MACINFO_define - lineno : 2 macro : __USER_LABEL_PREFIX__ +# DW_MACINFO_define - lineno : 2 macro : __USER_LABEL_PREFIX__ # ... # DW_MACINFO_define - lineno : 1 macro : __i386__ 1 # DW_MACINFO_define - lineno : 1 macro : __tune_i386__ 1 @@ -52,7 +52,7 @@ # DW_MACINFO_define - lineno : 2 macro : FOO 3 # DW_MACINFO_end_file # DW_MACINFO_end_file -# $ +# $ # # Note how the inclusions of lineinc1.h and lineinc2.h are both # attributed to line 10 of lineinc.c, and the #inclusion of lineinc3.h @@ -105,7 +105,7 @@ gdb_test_multiple "break -q main" $test_name { exp_continue } -re "$gdb_prompt" { - } + } timeout { fail "$test_name (timeout)" } diff --git a/gdb/testsuite/gdb.base/list-ambiguous.exp b/gdb/testsuite/gdb.base/list-ambiguous.exp index cc1210e..e3c821d 100644 --- a/gdb/testsuite/gdb.base/list-ambiguous.exp +++ b/gdb/testsuite/gdb.base/list-ambiguous.exp @@ -48,8 +48,8 @@ proc test_list_ambiguous_symbol {symbol_line symbol} { set lineno0 [gdb_get_line_number $symbol_line $srcfile] set lineno1 [gdb_get_line_number $symbol_line $srcfile2] - set lines0_re [line_range_pattern [expr $lineno0 - 5] [expr $lineno0 + 4]] - set lines1_re [line_range_pattern [expr $lineno1 - 5] [expr $lineno1 + 4]] + set lines0_re [line_range_pattern [expr {$lineno0 - 5}] [expr {$lineno0 + 4}]] + set lines1_re [line_range_pattern [expr {$lineno1 - 5}] [expr {$lineno1 + 4}]] set any "\[^\r\n\]*" set h0_re "file: \"${any}list-ambiguous0.c\", line number: $lineno0, symbol: \"$symbol\"" diff --git a/gdb/testsuite/gdb.base/list.exp b/gdb/testsuite/gdb.base/list.exp index bdbb52b..2da2742 100644 --- a/gdb/testsuite/gdb.base/list.exp +++ b/gdb/testsuite/gdb.base/list.exp @@ -44,14 +44,14 @@ proc set_listsize { arg } { global set_listsize_count incr set_listsize_count - if [gdb_test_no_output "set listsize $arg" "setting listsize to $arg #$set_listsize_count"] { + if {[gdb_test_no_output "set listsize $arg" "setting listsize to $arg #$set_listsize_count"]} { return 0 } if { $arg == 0 } { set arg "unlimited" } - if [gdb_test "show listsize" "Number of source lines.* is ${arg}.*" "show listsize $arg #$set_listsize_count"] { + if {[gdb_test "show listsize" "Number of source lines.* is ${arg}.*" "show listsize $arg #$set_listsize_count"]} { return 0 } return 1 @@ -68,21 +68,21 @@ proc test_listsize {} { # Show default size gdb_test "show listsize" "Number of source lines gdb will list by default is 10.*" "show default list size" - + # Show the default lines gdb_test "list" "(1\[ \t\]+#include \"list0.h\".*7\[ \t\]+x = 0;\r\n.*10\[ \t\]+foo .x\[+)\]+;)" "list default lines around main" # Ensure we can limit printouts to one line - if [set_listsize 1] { + if {[set_listsize 1]} { gdb_test "list 1" "1\[ \t\]+#include \"list0.h\"" "list line 1 with listsize 1" gdb_test "list 2" "2\[ \t\]+" "list line 2 with listsize 1" - } + } # Try just two lines - - if [ set_listsize 2 ] { + + if {[ set_listsize 2 ]} { gdb_test "list 1" "1\[ \t\]+#include \"list0.h\"\r\n2\[ \t\]+" "list line 1 with listsize 2" gdb_test "list 2" "1\[ \t\]+#include \"list0.h\"\r\n2\[ \t\]+" "list line 2 with listsize 2" gdb_test "list 3" "2\[ \t\]+\r\n3\[ \t\]+int main \[)(\]+" "list line 3 with listsize 2" @@ -90,7 +90,7 @@ proc test_listsize {} { # Try small listsize > 1 that is an odd number - if [ set_listsize 3 ] { + if {[ set_listsize 3 ]} { gdb_test "list 1" "1\[ \t\]+#include \"list0.h\".*3\[ \t\]+int main \[)(\]+" "list line 1 with listsize 3" gdb_test "list 2" "1\[ \t\]+#include \"list0.h\".*3\[ \t\]+int main \[)(\]+" "list line 2 with listsize 3" gdb_test "list 3" "2\[ \t\]+\r\n3\[ \t\]+int main \[(\]+\[)\]+\r\n4\[ \t\]+\{" "list line 3 with listsize 3" @@ -101,7 +101,7 @@ proc test_listsize {} { if {[set_listsize 4]} { gdb_test "list 1" "1\[ \t\]+#include \"list0.h\".*4\[ \t\]+\{" "list line 1 with listsize 4" gdb_test "list 2" "1\[ \t\]+#include \"list0.h\".*4\[ \t\]+\{" "list line 2 with listsize 4" - + gdb_test "list 3" "1\[ \t\]+#include \"list0.h\".*4\[ \t\]+\{" "list line 3 with listsize 4" gdb_test "list 4" "2\[ \t\]+\r\n.*5\[ \t\]+int x;.*" "list line 4 with listsize 4" } @@ -110,7 +110,7 @@ proc test_listsize {} { if {[set_listsize 100]} { gdb_test "list 1" "1\[ \t\]+#include \"list0.h\".*\r\n${last_line_re}" "list line 1 with listsize 100" - + gdb_test "list 10" "1\[ \t\]+#include \"list0.h\".*\r\n${last_line_re}" "list line 10 with listsize 100" } @@ -182,7 +182,7 @@ proc_with_prefix test_list_forward {} { # Test that repeating the list linenum command doesn't print the same # lines over again. Note that this test makes sure that the argument # linenum is dropped, when we repeat the previous command. 'x/5i $pc' -# works the same way. +# works the same way. proc_with_prefix test_repeat_list_command {} { global last_line_re @@ -227,8 +227,8 @@ proc test_list_range {} { # gdb_test "list -100,-40" "Line number -60 out of range; .*list0.c has 39 lines." "list range; both bounds negative" - set past_end [expr ${last_line} + 10] - set much_past_end [expr ${past_end} + 10] + set past_end [expr {${last_line} + 10}] + set much_past_end [expr {${past_end} + 10}] gdb_test "list 30,${past_end}" "30\[ \t\]+foo \(.*\);.*${last_line_re}" "list range; upper bound past EOF" @@ -323,7 +323,7 @@ proc test_list_filename_and_function {} { # Test some invalid specs # The following test takes the FIXME result on most systems using # DWARF. It fails to notice that main() is not in the file requested. - + setup_xfail "*-*-*" # Does this actually work ANYWHERE? I believe not, as this is an `aspect' of @@ -369,7 +369,7 @@ proc test_forward_reverse_search {} { # Test that GDB won't crash if the line being searched is extremely long. set oldtimeout $timeout - set timeout [expr "$timeout + 300"] + set timeout [expr {$timeout + 300}] verbose "Timeout is now $timeout seconds" 2 gdb_test "search 1234" ".*1234.*" "search extremely long line (> 5000 chars)" set timeout $oldtimeout diff --git a/gdb/testsuite/gdb.base/load-command.exp b/gdb/testsuite/gdb.base/load-command.exp index 1581873..8111404 100644 --- a/gdb/testsuite/gdb.base/load-command.exp +++ b/gdb/testsuite/gdb.base/load-command.exp @@ -17,7 +17,7 @@ standard_testfile -if [gdb_protocol_is_native] { +if {[gdb_protocol_is_native]} { unsupported "the native target does not support the load command" return } @@ -27,11 +27,11 @@ if [gdb_protocol_is_native] { set opts {debug nopie} -if [prepare_for_testing "failed to prepare" $testfile $srcfile $opts] { +if {[prepare_for_testing "failed to prepare" $testfile $srcfile $opts]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/logical.exp b/gdb/testsuite/gdb.base/logical.exp index b00d6d5..f924b09 100644 --- a/gdb/testsuite/gdb.base/logical.exp +++ b/gdb/testsuite/gdb.base/logical.exp @@ -49,7 +49,7 @@ proc evaluate { vars ops } { set var [lindex $vars $vari] for {set opi 0} {$opi < [llength $ops]} {incr opi} { set op [lindex [lindex $ops $opi] 0] - set val [lindex [lindex $ops $opi] [expr $vari + 1]] + set val [lindex [lindex $ops $opi] [expr {$vari + 1}]] gdb_test "print $var, $op" " = $val" "evaluate $op; variables $var; expecting $val" } } diff --git a/gdb/testsuite/gdb.base/long-inferior-output.exp b/gdb/testsuite/gdb.base/long-inferior-output.exp index 8ef7c53..90369f8 100644 --- a/gdb/testsuite/gdb.base/long-inferior-output.exp +++ b/gdb/testsuite/gdb.base/long-inferior-output.exp @@ -32,7 +32,7 @@ require {!target_info exists gdb,noinferiorio} standard_testfile -if [prepare_for_testing "failed to prepare" $testfile {} {debug}] { +if {[prepare_for_testing "failed to prepare" $testfile {} {debug}]} { return -1 } diff --git a/gdb/testsuite/gdb.base/long_long.exp b/gdb/testsuite/gdb.base/long_long.exp index 4fbb757..2e2400b 100644 --- a/gdb/testsuite/gdb.base/long_long.exp +++ b/gdb/testsuite/gdb.base/long_long.exp @@ -34,7 +34,7 @@ clean_restart gdb_load $binfile if {![runto known_types]} { - return + return } # Detect the size of the target's basic types. @@ -53,7 +53,7 @@ set sizeof_long_double [get_sizeof "long double" 8] proc pat2 { n pats } { set i 0 while { $n > 1 } { - set n [expr $n / 2] + set n [expr {$n / 2}] incr i } return [lindex $pats $i] diff --git a/gdb/testsuite/gdb.base/macscp.exp b/gdb/testsuite/gdb.base/macscp.exp index 63f1356..c275d74 100644 --- a/gdb/testsuite/gdb.base/macscp.exp +++ b/gdb/testsuite/gdb.base/macscp.exp @@ -44,7 +44,7 @@ gdb_load $binfile # # If GDB complains that it doesn't have any information about # preprocessor macro definitions, return the string `no-macro-info'. -# +# # If expect times out waiting for GDB, we return the string `timeout'. # # If GDB's output doesn't otherwise match what we're expecting, we @@ -208,7 +208,7 @@ if {$macro_support == 0} { unsupported "skipping test because debug information does not include macro information." return 0 } - + list_and_check_macro main WHERE {macscp1.c {before macscp1_3}} list_and_check_macro macscp2_2 WHERE {macscp2.h macscp1.c {before macscp2_2}} list_and_check_macro macscp3_2 WHERE {macscp3.h macscp1.c {before macscp3_2}} @@ -234,10 +234,10 @@ switch -exact -- [info_macro WHERE] { pass "info macro WHERE after `list macscp_4_2_from_macscp2'" } {macscp4.h macscp3.h macscp1.c {before macscp4_2_..., from macscp3.h}} { - setup_kfail "gdb/7660" *-*-* + setup_kfail "gdb/7660" *-*-* fail "info macro WHERE after `list macscp_4_2_from_macscp2' (gdb/7660)" } - timeout { + timeout { fail "info macro WHERE after `list macscp_4_2_from_macscp2' (timeout)" } default { fail "info macro WHERE after `list macscp_4_2_from_macscp2'" } @@ -249,7 +249,7 @@ switch -exact -- [info_macro WHERE] { pass "info macro WHERE after `list macscp_4_2_from_macscp3'" } {macscp4.h macscp2.h macscp1.c {before macscp4_2_..., from macscp2.h}} { - setup_kfail "gdb/7660" *-*-* + setup_kfail "gdb/7660" *-*-* fail "info macro WHERE after `list macscp_4_2_from_macscp3' (gdb/7660)" } timeout { @@ -360,7 +360,7 @@ for {set i 0} {$i < [llength $funcs]} {incr i} { if {[string compare $result $expected] == 0} { pass "info macro WHERE stopped in $func" } elseif {[string compare $result $kfail_expected] == 0} { - setup_kfail "gdb/7660" *-*-* + setup_kfail "gdb/7660" *-*-* fail "info macro WHERE stopped in $func (gdb/7660)" } elseif {[string compare $result timeout] == 0} { fail "info macro WHERE stopped in $func (timeout)" @@ -393,7 +393,7 @@ for {set i 0} {$i < [llength $funcs]} {incr i} { switch -- [lindex $result end] { undefined { pass $test_name } timeout { fail "$test_name (timeout)" } - default { + default { maybe_kfail $func "$test_name" } } @@ -408,7 +408,7 @@ for {set i 0} {$i < [llength $funcs]} {incr i} { switch -- [lindex $result end] { undefined { pass $test_name } timeout { fail "$test_name (timeout)" } - default { + default { maybe_kfail $func "$test_name" } } diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp index 3d49b36..fd366d6 100644 --- a/gdb/testsuite/gdb.base/maint.exp +++ b/gdb/testsuite/gdb.base/maint.exp @@ -179,7 +179,7 @@ if { $index_cache_misses == 0 && $using_index_cache } { set have_gdb_index 1 } -set have_psyms [expr ! ( $have_gdb_index || $readnow_p )] +set have_psyms [expr {! ( $have_gdb_index || $readnow_p )}] # # this command does not produce any output @@ -223,9 +223,9 @@ gdb_test "maint set per-command off" \ # The timeout value is raised, because printing all the symbols and # statistical information about Cygwin and Windows libraries takes a lot # of time. -if [istarget "*-*-cygwin*"] { +if {[istarget "*-*-cygwin*"]} { set oldtimeout $timeout - set timeout [expr $timeout + 500] + set timeout [expr {$timeout + 500}] } set re \ @@ -288,7 +288,7 @@ gdb_test_multiple "$cmd $re" "$cmd" -lbl { } proc maint_pass_if {val name} { - if $val { pass $name } else { fail $name } + if {$val} { pass $name } else { fail $name } } maint_pass_if $header "maint print objfiles: header" @@ -378,7 +378,7 @@ gdb_test_multiple "maint print type argc" $msg { } } -if [istarget "hppa*-*-11*"] { +if {[istarget "hppa*-*-11*"]} { setup_xfail hppa*-*-*11* CLLbs14860 gdb_test_multiple "maint print unwind &main" "maint print unwind" { -re ".*unwind_table_entry \\($hex\\):\r\n\tregion_start = $hex <main>\r\n\tregion_end = $hex <main\\+\[0-9\]*>\r\n\tflags = Args_stored Save_RP\r\n\tRegion_description = $hex\r\n\tEntry_FR = $hex\r\n\tEntry_GR = $hex\r\n\tTotal_frame_size = $hex\r\n$gdb_prompt $" { @@ -391,7 +391,7 @@ if [istarget "hppa*-*-11*"] { } set oldtimeout $timeout -set timeout [expr $timeout + 300] +set timeout [expr {$timeout + 300}] set bp_location6 [gdb_get_line_number "set breakpoint 6 here"] @@ -406,7 +406,7 @@ gdb_test_multiple "maint info breakpoints" "maint info breakpoints" { gdb_test "maint print" \ "List.*unambiguous\\..*" \ - "maint print w/o args" + "maint print w/o args" gdb_test "maint info" \ "List.*unambiguous\\..*" \ @@ -506,7 +506,7 @@ test_prefix_command_help {"maint" "maintenance"} { } #set oldtimeout $timeout -#set timeout [expr $timeout + 300] +#set timeout [expr {$timeout + 300}] gdb_test_multiple "maint dump-me" "maint dump-me" { -re "Should GDB dump core.*\\(y or n\\) $" { @@ -522,7 +522,7 @@ send_gdb "maint internal-error\n" gdb_expect { -re "A problem internal to GDB has been detected" { pass "maint internal-error" - if [gdb_internal_error_resync] { + if {[gdb_internal_error_resync]} { pass "internal-error resync" } else { fail "internal-error resync" diff --git a/gdb/testsuite/gdb.base/memops-watchpoint.exp b/gdb/testsuite/gdb.base/memops-watchpoint.exp index 1a8d6d9..09500b3 100644 --- a/gdb/testsuite/gdb.base/memops-watchpoint.exp +++ b/gdb/testsuite/gdb.base/memops-watchpoint.exp @@ -25,7 +25,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ } set linespec ${srcfile}:[gdb_get_line_number "Break here"] -if ![runto ${linespec}] { +if {![runto ${linespec}]} { return -1 } diff --git a/gdb/testsuite/gdb.base/memtag.exp b/gdb/testsuite/gdb.base/memtag.exp index 4cd593c..2951c91 100644 --- a/gdb/testsuite/gdb.base/memtag.exp +++ b/gdb/testsuite/gdb.base/memtag.exp @@ -39,7 +39,7 @@ with_test_prefix "before program execution" { clean_restart $testfile -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/miscexprs.exp b/gdb/testsuite/gdb.base/miscexprs.exp index f723d75..9d2d1d2 100644 --- a/gdb/testsuite/gdb.base/miscexprs.exp +++ b/gdb/testsuite/gdb.base/miscexprs.exp @@ -20,14 +20,14 @@ # # tests for expressions with struct/array elements and mixed operator types # with elementary types -# +# # By default, the datastructures are allocated on the stack. For targets # with very small stack, that will not work. In that case, just set # storage to `-DSTORAGE=static' which changes the datastructures to be # allocated in data segment. set storage "-DSTORAGE=" -if [target_info exists gdb,small_stack_section] { +if {[target_info exists gdb,small_stack_section]} { set storage "-DSTORAGE=static" } diff --git a/gdb/testsuite/gdb.base/morestack.exp b/gdb/testsuite/gdb.base/morestack.exp index d8da583..96cc15c 100644 --- a/gdb/testsuite/gdb.base/morestack.exp +++ b/gdb/testsuite/gdb.base/morestack.exp @@ -25,7 +25,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} $srcfile \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/moribund-step.exp b/gdb/testsuite/gdb.base/moribund-step.exp index b643f07..d28e33f 100644 --- a/gdb/testsuite/gdb.base/moribund-step.exp +++ b/gdb/testsuite/gdb.base/moribund-step.exp @@ -24,7 +24,7 @@ save_vars { GDBFLAGS } { } } -if ![runto_main] { +if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.base/msym-bp-shl.exp b/gdb/testsuite/gdb.base/msym-bp-shl.exp index 41dc818..fb0a99d 100644 --- a/gdb/testsuite/gdb.base/msym-bp-shl.exp +++ b/gdb/testsuite/gdb.base/msym-bp-shl.exp @@ -75,7 +75,7 @@ proc test {debug} { } } - if ![runto_main] { + if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.base/msym-bp.exp b/gdb/testsuite/gdb.base/msym-bp.exp index 62e8ec1..08da72e 100644 --- a/gdb/testsuite/gdb.base/msym-bp.exp +++ b/gdb/testsuite/gdb.base/msym-bp.exp @@ -68,7 +68,7 @@ proc test {debug} { test_break "before run" - if ![runto_main] { + if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.base/multi-forks.exp b/gdb/testsuite/gdb.base/multi-forks.exp index 5d2d220..73bd1c4 100644 --- a/gdb/testsuite/gdb.base/multi-forks.exp +++ b/gdb/testsuite/gdb.base/multi-forks.exp @@ -151,7 +151,7 @@ gdb_test "show detach-on-fork" "on." "show detach default on" gdb_test_no_output "set detach off" "set detach off" # -# We will now run every fork up to the exit bp, +# We will now run every fork up to the exit bp, # eventually winding up with 16 inferiors. # @@ -180,9 +180,9 @@ gdb_test "inferior 2" " main .*" "restart final" # Now we should examine all the pids. # -# +# # Test detach inferior -# +# # [assumes we're at #1] gdb_test "detach inferior 2" "Detaching .*" "detach 2" @@ -190,7 +190,7 @@ gdb_test "detach inferior 3" "Detaching .*" "detach 3" gdb_test "detach inferior 4" "Detaching .*" "detach 4" gdb_test "detach inferior 5" "Detaching .*" "detach 5" -# +# # Test kill inferior # diff --git a/gdb/testsuite/gdb.base/nested-addr.exp b/gdb/testsuite/gdb.base/nested-addr.exp index c4450f6..8f19017 100644 --- a/gdb/testsuite/gdb.base/nested-addr.exp +++ b/gdb/testsuite/gdb.base/nested-addr.exp @@ -19,7 +19,7 @@ if {[prepare_for_testing "failed to prepare" "${testfile}" "${srcfile}"]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/nested-subp1.exp b/gdb/testsuite/gdb.base/nested-subp1.exp index 7ea461a..9d0e873 100644 --- a/gdb/testsuite/gdb.base/nested-subp1.exp +++ b/gdb/testsuite/gdb.base/nested-subp1.exp @@ -24,7 +24,7 @@ standard_testfile set testcase "nested-subp1" -if ![support_nested_function_tests] { +if {![support_nested_function_tests]} { untested "compiler does not support nested functions" return -1 } @@ -40,7 +40,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${testcase}.c" \ # Run until the variables we are interested in are visible. clean_restart "${testcase}" -if ![runto_main] { +if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.base/nested-subp2.exp b/gdb/testsuite/gdb.base/nested-subp2.exp index d6c67a4..1846685 100644 --- a/gdb/testsuite/gdb.base/nested-subp2.exp +++ b/gdb/testsuite/gdb.base/nested-subp2.exp @@ -24,7 +24,7 @@ standard_testfile set testcase "nested-subp2" -if ![support_nested_function_tests] { +if {![support_nested_function_tests]} { untested "compiler does not support nested functions" return -1 } @@ -49,7 +49,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${testcase}.c" \ # Run until the variables we are interested in are visible. clean_restart "${testcase}" -if ![runto_main] { +if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.base/nested-subp3.exp b/gdb/testsuite/gdb.base/nested-subp3.exp index f5ea4ce..4099667 100644 --- a/gdb/testsuite/gdb.base/nested-subp3.exp +++ b/gdb/testsuite/gdb.base/nested-subp3.exp @@ -24,7 +24,7 @@ standard_testfile set testcase "nested-subp3" -if ![support_nested_function_tests] { +if {![support_nested_function_tests]} { untested "compiler does not support nested functions" return -1 } @@ -49,7 +49,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${testcase}.c" \ # Run until the variables we are interested in are visible. clean_restart "${testcase}" -if ![runto_main] { +if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.base/new-ui.exp b/gdb/testsuite/gdb.base/new-ui.exp index f66ddc5..345cd36 100644 --- a/gdb/testsuite/gdb.base/new-ui.exp +++ b/gdb/testsuite/gdb.base/new-ui.exp @@ -81,7 +81,7 @@ proc_with_prefix do_test {} { clean_restart $testfile - if ![runto_main] { + if {![runto_main]} { return -1 } @@ -184,14 +184,14 @@ proc_with_prefix do_test_invalid_args {} { "new-ui with bad interpreter name" # Test that the TUI cannot be used for a new UI. - if [allow_tui_tests] { + if {[allow_tui_tests]} { gdb_test "new-ui tui $extra_tty_name" \ "interpreter 'tui' cannot be used with a new UI" \ "new-ui with tui" } # Test that we can continue working normally. - if ![runto_main] { + if {![runto_main]} { return } } diff --git a/gdb/testsuite/gdb.base/nodebug.exp b/gdb/testsuite/gdb.base/nodebug.exp index b839317..6ed428e 100644 --- a/gdb/testsuite/gdb.base/nodebug.exp +++ b/gdb/testsuite/gdb.base/nodebug.exp @@ -18,9 +18,9 @@ standard_testfile .c -if [test_compiler_info "xlc-*"] { +if {[test_compiler_info "xlc-*"]} { # By default, IBM'x xlc compiler doesn't add static variables into the symtab. - # Use "-qstatsym" to do so. + # Use "-qstatsym" to do so. set exec_opts additional_flags=-qstatsym } else { set exec_opts "" @@ -42,7 +42,7 @@ gdb_load $binfile proc nodebug_runto {func} { with_test_prefix $func { - if ![runto $func] { + if {![runto $func]} { return false } gdb_test_no_output "nosharedlibrary" \ @@ -55,7 +55,7 @@ proc nodebug_runto {func} { # require coercion/promotion, both prototyped and unprototyped, both # return-type-cast style, and function-pointer-cast styles. proc test_call_promotion {} { - if [target_info exists gdb,cannot_call_functions] { + if {[target_info exists gdb,cannot_call_functions]} { return } @@ -86,9 +86,9 @@ proc test_call_promotion {} { } if {[nodebug_runto inner]} { - + # Expect to find global/local symbols in each of text/data/bss. - + # The exact format for some of this output is not necessarily # ideal, particularly interpreting "p top" requires a fair bit of # savvy about gdb's workings and the meaning of the "{}" @@ -100,7 +100,7 @@ if {[nodebug_runto inner]} { # to detect that gdb does not know the type, rather than just # being told they are ints or functions returning int like old # versions of gdb used to do. - + # On alpha (and other ecoff systems) the native compilers put # out debugging info for non-aggregate return values of functions # even without -g, which should be accepted. @@ -220,7 +220,7 @@ if {[nodebug_runto inner]} { # Check that pointer arithmetic works as expected. set addr1 [get_hexadecimal_valueof "&dataglobal" "*UNKNOWN*"] set addr2 [get_hexadecimal_valueof "(int *) &dataglobal + 1" "*UNKNOWN*"] - set offset [expr $addr2 - $addr1] + set offset [expr {$addr2 - $addr1}] set int_size [get_integer_valueof "sizeof (int)" "*UNKNOWN*"] gdb_assert { $offset == $int_size } @@ -271,14 +271,14 @@ if {[nodebug_runto inner]} { # ever, why bother with a weaker test? #gdb_test "backtrace 10" "#0.*inner.*#1.*#2.*top.*#3.*main.*" \ # "backtrace from inner for externals" - + # This test is not as obscure as it might look. `p getenv ("TERM")' # is a real-world example, at least on many systems. foreach cmd {"p/c" "ptype" "whatis"} { gdb_test "$cmd array_index(\"abcdef\",2)" \ "'array_index' has unknown return type; cast the call to its declared return type" } - if [target_info exists gdb,cannot_call_functions] { + if {[target_info exists gdb,cannot_call_functions]} { unsupported "p/c (int) array_index(\"abcdef\",2)" } else { # We need to up this because this can be really slow on some boards. diff --git a/gdb/testsuite/gdb.base/noreturn-finish.exp b/gdb/testsuite/gdb.base/noreturn-finish.exp index 43b2353..2da0a40 100644 --- a/gdb/testsuite/gdb.base/noreturn-finish.exp +++ b/gdb/testsuite/gdb.base/noreturn-finish.exp @@ -15,7 +15,7 @@ standard_testfile -if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug}] { +if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug}]} { return -1 } diff --git a/gdb/testsuite/gdb.base/noreturn-return.exp b/gdb/testsuite/gdb.base/noreturn-return.exp index e653749..e6f8117 100644 --- a/gdb/testsuite/gdb.base/noreturn-return.exp +++ b/gdb/testsuite/gdb.base/noreturn-return.exp @@ -15,7 +15,7 @@ standard_testfile -if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug}] { +if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug}]} { return -1 } diff --git a/gdb/testsuite/gdb.base/nostdlib.exp b/gdb/testsuite/gdb.base/nostdlib.exp index 8dcefcf..826fbd9 100644 --- a/gdb/testsuite/gdb.base/nostdlib.exp +++ b/gdb/testsuite/gdb.base/nostdlib.exp @@ -34,13 +34,15 @@ foreach_with_prefix pie { "nopie" "pie" } { set binfile [standard_output_file $testfile-$pie] set board [target_info name] - if [board_info $board exists mathlib] { + if {[board_info $board exists mathlib]} { set mathlib [board_info $dest mathlib] set_board_info mathlib "" + # tclint-disable-next-line command-args set err [eval $compile] set_board_info mathlib $mathlib } else { set_board_info mathlib "" + # tclint-disable-next-line command-args set err [eval $compile] unset_board_info mathlib } diff --git a/gdb/testsuite/gdb.base/offsets.exp b/gdb/testsuite/gdb.base/offsets.exp index 548f2a4..3193ed9 100644 --- a/gdb/testsuite/gdb.base/offsets.exp +++ b/gdb/testsuite/gdb.base/offsets.exp @@ -35,7 +35,7 @@ gdb_test_multiple "print &big_struct.second" "$test" { -re "\\$\[0-9\]* = .* (0x\[0-9a-fA-F\]*) .*\[\r\n\]*$gdb_prompt $" { set addr2 $expect_out(1,string) - if {[expr $addr2 - $addr1] == [expr 0x10000000 + 16]} { + if {[expr {$addr2 - $addr1}] == [expr {0x10000000 + 16}]} { pass "big offsets" } else { fail "big offsets" diff --git a/gdb/testsuite/gdb.base/opaque.exp b/gdb/testsuite/gdb.base/opaque.exp index 9a5364a..c010fb8 100644 --- a/gdb/testsuite/gdb.base/opaque.exp +++ b/gdb/testsuite/gdb.base/opaque.exp @@ -110,7 +110,7 @@ gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} # Run to main, where struct foo is incomplete. -if ![runto_main] { +if {![runto_main]} { return } @@ -160,7 +160,7 @@ gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} # Run to getfoo, where struct foo is complete. -if ![runto getfoo] { +if {![runto getfoo]} { perror "cannot run to breakpoint at getfoo" } diff --git a/gdb/testsuite/gdb.base/options.exp b/gdb/testsuite/gdb.base/options.exp index 8ac9f4e..067f55e 100644 --- a/gdb/testsuite/gdb.base/options.exp +++ b/gdb/testsuite/gdb.base/options.exp @@ -208,7 +208,7 @@ proc_with_prefix test-print {{prefix ""}} { clean_restart gdb_load $binfile - if ![runto_main] { + if {![runto_main]} { return } @@ -321,7 +321,7 @@ proc_with_prefix test-backtrace {} { clean_restart gdb_load $binfile - if ![runto_main] { + if {![runto_main]} { return } @@ -1163,7 +1163,7 @@ foreach prefix { # Same for "compile print". Not really a wrapper prefix command like # "frame apply", but similar enough that we test pretty much the same # things. -if ![skip_compile_feature_tests] { +if {![skip_compile_feature_tests]} { test-print "compile " } diff --git a/gdb/testsuite/gdb.base/overlays.exp b/gdb/testsuite/gdb.base/overlays.exp index 0aa94f9..8e7e0c0 100644 --- a/gdb/testsuite/gdb.base/overlays.exp +++ b/gdb/testsuite/gdb.base/overlays.exp @@ -1,5 +1,5 @@ # Copyright 1997-2025 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 @@ -64,7 +64,7 @@ proc get_func_address { func func_sym msg } { global hexx set func_addr 0 - send_gdb "print $func\n" + send_gdb "print $func\n" gdb_expect { -re "\\$\[0-9\]+ = $fptrcast (${hexx}) <$func_sym>.*$gdb_prompt $" { set func_addr $expect_out(1,string) @@ -99,39 +99,39 @@ if {$data_overlays} { # map each overlay successively, and # capture the VMA addresses of [foo bar baz grbx foox barx bazx grbxx] -gdb_test "overlay map .ovly0" "" +gdb_test "overlay map .ovly0" "" gdb_test "overlay list" "Section .ovly0, loaded at.*, mapped at.*" "list ovly0" set foo_vma [get_func_address "foo" "foo" "foo runtime address"] -gdb_test "overlay map .ovly1" "" +gdb_test "overlay map .ovly1" "" gdb_test "overlay list" "Section .ovly1, loaded at.*, mapped at.*" "list ovly1" set bar_vma [get_func_address "bar" "bar" "bar runtime address"] -gdb_test "overlay map .ovly2" "" +gdb_test "overlay map .ovly2" "" gdb_test "overlay list" "Section .ovly2, loaded at.*, mapped at.*" "list ovly2" set baz_vma [get_func_address "baz" "baz" "baz runtime address"] -gdb_test "overlay map .ovly3" "" +gdb_test "overlay map .ovly3" "" gdb_test "overlay list" "Section .ovly3, loaded at.*, mapped at.*" "list ovly3" set grbx_vma [get_func_address "grbx" "grbx" "grbx runtime address"] if {$data_overlays} { - gdb_test "overlay map .data00" "" + gdb_test "overlay map .data00" "" gdb_test "overlay list" "Section .data00, loaded .*, mapped .*" "list data00" gdb_test "print \$foox_vma = &foox" \ ".* $iptrcast 0x.*" "foox runtime addr" - gdb_test "overlay map .data01" "" + gdb_test "overlay map .data01" "" gdb_test "overlay list" "Section .data01, loaded .*, mapped .*" "list data01" gdb_test "print \$barx_vma = &barx" \ ".* $iptrcast 0x.*" "barx runtime addr" - gdb_test "overlay map .data02" "" + gdb_test "overlay map .data02" "" gdb_test "overlay list" "Section .data02, loaded .*, mapped .*" "list data02" gdb_test "print \$bazx_vma = &bazx" \ ".* $iptrcast 0x.*" "bazx runtime addr" - gdb_test "overlay map .data03" "" + gdb_test "overlay map .data03" "" gdb_test "overlay list" "Section .data03, loaded .*, mapped .*" "list data03" gdb_test "print \$grbxx_vma = &grbxx" \ ".* $iptrcast 0x.*" "grbxx runtime addr" @@ -149,7 +149,7 @@ if {$data_overlays} { gdb_test "print \$grbxx_lma != \$grbxx_vma" ".* = 1" "grbxx's LMA != VMA" } -# Verify that early-mapped overlays have been bumped out +# Verify that early-mapped overlays have been bumped out # by later-mapped overlays laid over in the same VMA range. send_gdb "overlay list\n" diff --git a/gdb/testsuite/gdb.base/paginate-execution-startup.exp b/gdb/testsuite/gdb.base/paginate-execution-startup.exp index 430bda3..8f971c8 100644 --- a/gdb/testsuite/gdb.base/paginate-execution-startup.exp +++ b/gdb/testsuite/gdb.base/paginate-execution-startup.exp @@ -23,7 +23,7 @@ if {[build_executable "failed to prepare" $testfile $srcfile debug] == -1} { } set file_arg $binfile -if [is_remote host] { +if {[is_remote host]} { set file_arg [remote_download host $file_arg] } @@ -176,7 +176,7 @@ save_vars { INTERNAL_GDBFLAGS } { if {[probe_can_run_cmdline] > 0} { test_fg_execution_pagination_return - if ![target_info exists gdb,nointerrupts] { + if {![target_info exists gdb,nointerrupts]} { test_fg_execution_pagination_cancel "ctrl-c" } test_fg_execution_pagination_cancel "quit" diff --git a/gdb/testsuite/gdb.base/parse_number.exp b/gdb/testsuite/gdb.base/parse_number.exp index 14ccd8e..7f6e37f 100644 --- a/gdb/testsuite/gdb.base/parse_number.exp +++ b/gdb/testsuite/gdb.base/parse_number.exp @@ -48,21 +48,21 @@ proc fits_in_type { n type_bits type_signedness } { if { $n < 0} { set n_sign -1 - set n [expr -$n] + set n [expr {-$n}] } else { set n_sign 1 } - set smax [expr 1 << ($type_bits - 1)]; + set smax [expr {1 << ($type_bits - 1)}]; if { $n_sign == -1 } { # Negative number, signed type. - return [expr ($n <= $smax)] + return [expr {($n <= $smax)}] } elseif { $n_sign == 1 && $type_signed_p } { # Positive number, signed type. - return [expr ($n < $smax)] + return [expr {($n < $smax)}] } elseif { $n_sign == 1 && !$type_signed_p } { # Positive number, unsigned type. - return [expr ($n >> $type_bits) == 0] + return [expr {($n >> $type_bits) == 0}] } else { error "unreachable" } @@ -99,9 +99,9 @@ proc parse_number { lang n } { } global sizeof_long_long sizeof_long sizeof_int - set long_long_bits [expr $sizeof_long_long * 8] - set long_bits [expr $sizeof_long * 8] - set int_bits [expr $sizeof_int * 8] + set long_long_bits [expr {$sizeof_long_long * 8}] + set long_bits [expr {$sizeof_long * 8}] + set int_bits [expr {$sizeof_int * 8}] if { $lang == "rust" } { if { [fits_in_type $n 32 s] } { @@ -303,7 +303,7 @@ proc test_parse_numbers {arch} { foreach_with_prefix prefix $prefixes { foreach baseval $basevals { foreach offset { -2 -1 0 1 2 } { - set dec_val [expr $baseval + $offset] + set dec_val [expr {$baseval + $offset}] set hex_val [format "0x%llx" $dec_val] if { $dec_val < 0 } { continue diff --git a/gdb/testsuite/gdb.base/pending.exp b/gdb/testsuite/gdb.base/pending.exp index 150adbe..fc1820a 100644 --- a/gdb/testsuite/gdb.base/pending.exp +++ b/gdb/testsuite/gdb.base/pending.exp @@ -103,8 +103,8 @@ gdb_test "info break" \ "pending plus real breakpoint info" -# -# Test not setting a pending breakpoint +# +# Test not setting a pending breakpoint # gdb_test "break pendfunc2" \ "" \ @@ -113,7 +113,7 @@ gdb_test "break pendfunc2" \ "n" # -# Add condition to pending breakpoint +# Add condition to pending breakpoint # gdb_test_no_output "condition 1 k == 1" diff --git a/gdb/testsuite/gdb.base/pie-execl.exp b/gdb/testsuite/gdb.base/pie-execl.exp index d26aa62..0400a99 100644 --- a/gdb/testsuite/gdb.base/pie-execl.exp +++ b/gdb/testsuite/gdb.base/pie-execl.exp @@ -49,7 +49,7 @@ clean_restart ${executable1} gdb_test_no_output "set args ${binfile2}" "set args ${binfile2_test_msg}" -if ![runto_main] { +if {![runto_main]} { return -1 } @@ -113,7 +113,7 @@ verbose -log "addr2 is $addr2" # Ensure we cannot get a false PASS and the inferior has really changed. set test "pie_execl_marker address has changed" -if [string equal $addr1 $addr2] { +if {[string equal $addr1 $addr2]} { fail $test } else { pass $test diff --git a/gdb/testsuite/gdb.base/pie-fork.exp b/gdb/testsuite/gdb.base/pie-fork.exp index 9d232c8..fcc6ad4 100644 --- a/gdb/testsuite/gdb.base/pie-fork.exp +++ b/gdb/testsuite/gdb.base/pie-fork.exp @@ -22,7 +22,7 @@ standard_testfile set opts [list debug pie] -if [build_executable "failed to prepare" $testfile $srcfile $opts] { +if {[build_executable "failed to prepare" $testfile $srcfile $opts]} { return } @@ -32,7 +32,7 @@ proc setup_test {detach_on_fork {follow_fork_mode "parent"}} { clean_restart gdb_load $binfile - if ![runto_main] { + if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.base/pointers.exp b/gdb/testsuite/gdb.base/pointers.exp index 4d4d58e..9895a2f 100644 --- a/gdb/testsuite/gdb.base/pointers.exp +++ b/gdb/testsuite/gdb.base/pointers.exp @@ -19,7 +19,7 @@ # # tests for pointer arithmetic and pointer dereferencing # with integer type variables and pointers to integers -# +# # # test running programs @@ -65,7 +65,7 @@ gdb_test "next " "more_code.*;" "continuing after dummy()" # pass "illegal pointer assignment rejected" # } # -re ".*$gdb_prompt $" { fail "illegal pointer assignment rejected" } -# timeout { fail "(timeout) illegal pointer assignment rejected" } +# timeout { fail "(timeout) illegal pointer assignment rejected" } # } @@ -75,7 +75,7 @@ gdb_test "next " "more_code.*;" "continuing after dummy()" # pass "illegal pointer assignment rejected" # } # -re ".*$gdb_prompt $" { fail "illegal pointer assignment rejected" } -# timeout { fail "(timeout) ilegal pointer assignment rejected" } +# timeout { fail "(timeout) ilegal pointer assignment rejected" } # } #send_gdb "print v_unsigned_int_pointer == v_double_pointer\n" @@ -84,7 +84,7 @@ gdb_test "next " "more_code.*;" "continuing after dummy()" # pass "illegal pointer operation (+) rejected" # } # -re ".*$gdb_prompt $" { fail "illegal pointer operation (+) rejected" } -# timeout { fail "(timeout) illegal pointer operation (+) rejected" } +# timeout { fail "(timeout) illegal pointer operation (+) rejected" } # } @@ -94,7 +94,7 @@ gdb_test "next " "more_code.*;" "continuing after dummy()" # pass "illegal pointer operation (*) rejected" # } # -re ".*$gdb_prompt $" { fail "illegal pointer operation (*) rejected" } -# timeout { fail "(timeout) illegal pointer operation (*) rejected" } +# timeout { fail "(timeout) illegal pointer operation (*) rejected" } # } @@ -104,7 +104,7 @@ gdb_test "next " "more_code.*;" "continuing after dummy()" # pass "ilegal pointer assignment rejected" # } # -re ".*$gdb_prompt $" { fail "illegal pointer assignment rejected" } -# timeout { fail "(timeout) illegal pointer assignment rejected" } +# timeout { fail "(timeout) illegal pointer assignment rejected" } # } @@ -114,7 +114,7 @@ gdb_test "next " "more_code.*;" "continuing after dummy()" # pass "illegal pointer assignment rejected" # } # -re ".*$gdb_prompt $" { fail "illegal pointer assignment rejected" } -# timeout { fail "(timeout) illegal pointer assignment rejected" } +# timeout { fail "(timeout) illegal pointer assignment rejected" } # } gdb_test_no_output "set variable v_int_pointer=&v_int_array\[0\]" \ @@ -203,9 +203,9 @@ gdb_test "print *( *(matrix+1) +2)" " = 5" \ gdb_test "print **ptr_to_ptr_to_float" " = 100" \ "print through ptr to ptr" -# tests for pointers +# tests for pointers # with elementary type variables and pointers. -# +# gdb_test "break marker1" ".*" "" gdb_test "cont" "Break.* marker1 \\(\\) at .*:$decimal.*" \ @@ -221,7 +221,7 @@ gdb_test "print *pS" " = -14" "print value of *pS" gdb_test_multiple "ptype pS" "ptype pS" { -re "type = short \\*.*$gdb_prompt $" { pass "ptype pS" } -re "type = short int \\*.*$gdb_prompt $" { pass "ptype pS" } -} +} gdb_test "print *pUS" " = 7" "print value of *pUS" diff --git a/gdb/testsuite/gdb.base/pr10179.exp b/gdb/testsuite/gdb.base/pr10179.exp index dfb8f9b..a6d8a83 100644 --- a/gdb/testsuite/gdb.base/pr10179.exp +++ b/gdb/testsuite/gdb.base/pr10179.exp @@ -22,7 +22,7 @@ if {[build_executable ${testname}.exp $testname $sources {debug}] == -1} { clean_restart ${testname} -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/prelink.exp b/gdb/testsuite/gdb.base/prelink.exp index 5dd4cdc..73380bb 100644 --- a/gdb/testsuite/gdb.base/prelink.exp +++ b/gdb/testsuite/gdb.base/prelink.exp @@ -43,13 +43,13 @@ if {$prelink_args == ""} { } set test "split debug of executable" -if [gdb_gnu_strip_debug $binfile] { +if {[gdb_gnu_strip_debug $binfile]} { fail $test } else { pass $test } -if ![prelink_yes $prelink_args] { +if {![prelink_yes $prelink_args]} { # Maybe we don't have prelink. return -1 } @@ -57,10 +57,10 @@ if ![prelink_yes $prelink_args] { set found 0 set coredir "[standard_output_file coredir.[getpid]]" file mkdir $coredir -catch "system \"(cd ${coredir}; ulimit -c unlimited; ${binfile}; true) >/dev/null 2>&1\"" +catch {system "(cd ${coredir}; ulimit -c unlimited; ${binfile}; true) >/dev/null 2>&1"} foreach i "${coredir}/core ${coredir}/core.coremaker.c ${binfile}.core" { - if [remote_file build exists $i] { + if {[remote_file build exists $i]} { remote_exec build "mv $i [standard_output_file prelink.core]" set found 1 } @@ -85,7 +85,7 @@ if { $found == 0 } { } # Relink $libfile to a different address. -if ![prelink_yes $prelink_args] { +if {![prelink_yes $prelink_args]} { return -1 } diff --git a/gdb/testsuite/gdb.base/pretty-array.exp b/gdb/testsuite/gdb.base/pretty-array.exp index e512d19..1e93ea7 100644 --- a/gdb/testsuite/gdb.base/pretty-array.exp +++ b/gdb/testsuite/gdb.base/pretty-array.exp @@ -22,7 +22,7 @@ if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/pretty-print.exp b/gdb/testsuite/gdb.base/pretty-print.exp index 8b60d13..8533481 100644 --- a/gdb/testsuite/gdb.base/pretty-print.exp +++ b/gdb/testsuite/gdb.base/pretty-print.exp @@ -22,7 +22,7 @@ if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/print-file-var.exp b/gdb/testsuite/gdb.base/print-file-var.exp index a9d3064..d4866ad 100644 --- a/gdb/testsuite/gdb.base/print-file-var.exp +++ b/gdb/testsuite/gdb.base/print-file-var.exp @@ -81,7 +81,7 @@ proc test {hidden dlopen version_id_main lang} { gdb_load_shlib $libobj1 gdb_locate_shlib $libobj2 - if ![runto_main] { + if {![runto_main]} { return -1 } @@ -129,7 +129,7 @@ proc test {hidden dlopen version_id_main lang} { } } - if $version_id_main { + if {$version_id_main} { compare "'print-file-var-main.c'::this_version_id" "vm" compare "this_version_id" "vm" } diff --git a/gdb/testsuite/gdb.base/print-internal-string.exp b/gdb/testsuite/gdb.base/print-internal-string.exp index 156fb80..ddfaaef 100644 --- a/gdb/testsuite/gdb.base/print-internal-string.exp +++ b/gdb/testsuite/gdb.base/print-internal-string.exp @@ -27,7 +27,7 @@ if {![runto_main]} { return 0 } -if [allow_python_tests] { +if {[allow_python_tests]} { # The $_as_string convenience function is implemented in Python. gdb_test {printf "%s\n", $_as_string("aabbcc")} "\"aabbcc\"" diff --git a/gdb/testsuite/gdb.base/print-symbol-loading.exp b/gdb/testsuite/gdb.base/print-symbol-loading.exp index 91e818b..695a3d2 100644 --- a/gdb/testsuite/gdb.base/print-symbol-loading.exp +++ b/gdb/testsuite/gdb.base/print-symbol-loading.exp @@ -39,7 +39,7 @@ clean_restart gdb_load $binfile gdb_load_shlib ${binfile_lib} -if ![runto lib] { +if {![runto lib]} { return -1 } @@ -97,7 +97,7 @@ proc test_load_shlib { print_symbol_loading } { with_test_prefix "shlib ${print_symbol_loading}" { clean_restart gdb_load $binfile - if ![runto_main] { + if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/printcmds.exp b/gdb/testsuite/gdb.base/printcmds.exp index 8634668..0165791 100644 --- a/gdb/testsuite/gdb.base/printcmds.exp +++ b/gdb/testsuite/gdb.base/printcmds.exp @@ -96,18 +96,18 @@ proc test_integer_literals_rejected {} { # Test various octal values. - test_print_reject "p 09" - test_print_reject "p 079" + test_print_reject "p 09" + test_print_reject "p 079" # Test various hexadecimal values. - test_print_reject "p 0xG" - test_print_reject "p 0xAG" + test_print_reject "p 0xG" + test_print_reject "p 0xAG" # Test various binary values. - test_print_reject "p 0b2" - test_print_reject "p 0b12" + test_print_reject "p 0b2" + test_print_reject "p 0b12" } proc test_float_accepted {} { @@ -458,14 +458,14 @@ proc test_print_repeats_10_one { setting } { for { set x 1 } { $x <= 16 } { incr x } { gdb_test_no_output "set print $setting $x" "$setting $x repeats" for { set e 1 } { $e <= 16 } {incr e } { - set v [expr $e - 1] + set v [expr {$e - 1}] set command "p &ctable2\[${v}*16\]" if { $x < $e } { set aval $x } else { set aval $e } - set xval [expr $x - $e] + set xval [expr {$x - $e}] if { $xval < 0 } { set xval 0 } @@ -703,7 +703,7 @@ proc test_artificial_arrays {} { # for the test because that character isn't recognized as an # escape character. set ctrlv "\026" - if [ishost *-*-mingw*] { + if {[ishost *-*-mingw*]} { set ctrlv "" } gdb_test_escape_braces "p int1dim\[0\]${ctrlv}@2" " = {0, 1}" {p int1dim[0]@2} @@ -797,7 +797,7 @@ proc test_print_string_constants {} { gdb_test_no_output "set print elements 50" - if [target_info exists gdb,cannot_call_functions] { + if {[target_info exists gdb,cannot_call_functions]} { unsupported "this target can not call functions" return } @@ -821,7 +821,7 @@ proc test_print_string_constants {} { proc test_print_array_constants {} { global hex - if [target_info exists gdb,cannot_call_functions] { + if {[target_info exists gdb,cannot_call_functions]} { unsupported "this target can not call functions" return } @@ -1028,7 +1028,7 @@ proc test_print_symbol {} { gdb_test_no_output "set print symbol off" } -# Escape a left curly brace to prevent it from being interpreted as +# Escape a left curly brace to prevent it from being interpreted as # the beginning of a bound proc gdb_test_escape_braces { args } { diff --git a/gdb/testsuite/gdb.base/ptr-typedef.exp b/gdb/testsuite/gdb.base/ptr-typedef.exp index 8bffb26..f7bdf08 100644 --- a/gdb/testsuite/gdb.base/ptr-typedef.exp +++ b/gdb/testsuite/gdb.base/ptr-typedef.exp @@ -25,7 +25,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb clean_restart gdb_load $binfile -if ![runto marker1] { +if {![runto marker1]} { untested "couldn't run to marker1" } diff --git a/gdb/testsuite/gdb.base/ptype.exp b/gdb/testsuite/gdb.base/ptype.exp index 04d2d2b..25dd4c9 100644 --- a/gdb/testsuite/gdb.base/ptype.exp +++ b/gdb/testsuite/gdb.base/ptype.exp @@ -51,7 +51,7 @@ gdb_test_multiple "ptype red1" "ptype unnamed enumeration member" { # Here and elsewhere, we accept # "long", "long int", or "int" for long variables (whatis.exp already # has an XFAIL for "int" (Sun cc bug), so no need to fail it here). -gdb_test "ptype struct t_struct" "type = struct t_struct \{.*\[\r\n\] (unsigned |)char v_char_member;.*\[\r\n\] (short|short int) v_short_member;.*\[\r\n\] int v_int_member;.*\[\r\n\] (long|long int|int) v_long_member;.*\[\r\n\] float v_float_member;.*\[\r\n\] double v_double_member;.*\[\r\n\]\}.*" "ptype structure" +gdb_test "ptype struct t_struct" "type = struct t_struct \{.*\[\r\n\] (unsigned |)char v_char_member;.*\[\r\n\] (short|short int) v_short_member;.*\[\r\n\] int v_int_member;.*\[\r\n\] (long|long int|int) v_long_member;.*\[\r\n\] float v_float_member;.*\[\r\n\] double v_double_member;.*\[\r\n\]\}.*" "ptype structure" # Test the equivalence between '.' and '->' for struct member references. @@ -73,30 +73,30 @@ if {[gdb_test "ptype v_t_struct_p->v_float_member" "type = float"] < 0} { # IBM's xlc puts out bogus stabs--the stuff field is type 42, # which isn't defined. -gdb_test "ptype struct link" "type = struct link \{\[\r\n\]+\[ \t\]+struct link \\*next;\[\r\n\]+\[ \t\]+struct link \\*\\(\\*linkfunc\\)\\((struct link \\*, int|void|)\\);\[\r\n\]+\[ \t\]+struct t_struct stuff.1..2..3.;\[\r\n\]+\}.*" "ptype linked list structure" +gdb_test "ptype struct link" "type = struct link \{\[\r\n\]+\[ \t\]+struct link \\*next;\[\r\n\]+\[ \t\]+struct link \\*\\(\\*linkfunc\\)\\((struct link \\*, int|void|)\\);\[\r\n\]+\[ \t\]+struct t_struct stuff.1..2..3.;\[\r\n\]+\}.*" "ptype linked list structure" # # test ptype command with unions # -gdb_test "ptype union t_union" "type = union t_union \{.*\[\r\n\] (unsigned |)char v_char_member;.*\[\r\n\] (short|short int) v_short_member;.*\[\r\n\] int v_int_member;.*\[\r\n\] (long|long int|int) v_long_member;.*\[\r\n\] float v_float_member;.*\[\r\n\] double v_double_member;.*\[\r\n\]\}.*" "ptype union" +gdb_test "ptype union t_union" "type = union t_union \{.*\[\r\n\] (unsigned |)char v_char_member;.*\[\r\n\] (short|short int) v_short_member;.*\[\r\n\] int v_int_member;.*\[\r\n\] (long|long int|int) v_long_member;.*\[\r\n\] float v_float_member;.*\[\r\n\] double v_double_member;.*\[\r\n\]\}.*" "ptype union" # IBM's xlc puts out bogus stabs--the stuff field is type 42, # which isn't defined. -gdb_test "ptype union tu_link" "type = union tu_link \{\[\r\n\]+\[ \t\]+struct link \\*next;\[\r\n\]+\[ \t\]+struct link \\*\\(\\*linkfunc\\)\\((struct link \\*, int|void|)\\);\[\r\n\]+\[ \t\]+struct t_struct stuff.1..2..3.;\[\r\n\]+\}.*" "ptype linked list union" +gdb_test "ptype union tu_link" "type = union tu_link \{\[\r\n\]+\[ \t\]+struct link \\*next;\[\r\n\]+\[ \t\]+struct link \\*\\(\\*linkfunc\\)\\((struct link \\*, int|void|)\\);\[\r\n\]+\[ \t\]+struct t_struct stuff.1..2..3.;\[\r\n\]+\}.*" "ptype linked list union" # # test ptype command with enums # -gdb_test "ptype primary" "type = enum .red, green, blue.*" "ptype unnamed enumeration" +gdb_test "ptype primary" "type = enum .red, green, blue.*" "ptype unnamed enumeration" -gdb_test "ptype enum colors" "type = enum colors \{yellow, purple, pink\}.*" "ptype named enumeration" +gdb_test "ptype enum colors" "type = enum colors \{yellow, purple, pink\}.*" "ptype named enumeration" # # test ptype command with enums as typedef # -gdb_test "ptype boolean" "type = enum (boolean |)\{FALSE, TRUE\}.*" "ptype unnamed typedef'd enumeration" +gdb_test "ptype boolean" "type = enum (boolean |)\{FALSE, TRUE\}.*" "ptype unnamed typedef'd enumeration" # And check that whatis shows the name, not "enum {...}". # This probably fails for all DWARF 1 cases, so assume so for now. -fnf @@ -132,20 +132,20 @@ gdb_test "ptype enum bvals" "type = enum bvals \{my_false, my_true\}.*" "ptype n # # test ptype command with out-of-order enum values # -gdb_test "ptype enum misordered" "type = enum misordered \{two = 2, one = 1, zero = 0, three = 3\}.*" "ptype misordered enumeration" +gdb_test "ptype enum misordered" "type = enum misordered \{two = 2, one = 1, zero = 0, three = 3\}.*" "ptype misordered enumeration" # # test ptype command with a named enum's value # -gdb_test "ptype three" "type = enum misordered \{two = 2, one = 1, zero = 0, three = 3\}.*" "ptype named enumeration member" +gdb_test "ptype three" "type = enum misordered \{two = 2, one = 1, zero = 0, three = 3\}.*" "ptype named enumeration member" -gdb_test "ptype red" "type = enum \{red, green, blue\}.*" "ptype unnamed enumeration member #2" +gdb_test "ptype red" "type = enum \{red, green, blue\}.*" "ptype unnamed enumeration member #2" # # test ptype command with basic C types # # I've commented most of this out because it duplicates tests in whatis.exp. -# I've just left in a token test or 2 which is designed to test that ptype +# I've just left in a token test or 2 which is designed to test that ptype # acts like whatis for basic types. If it is thought to be necessary to # test both whatis and ptype for all the types, the tests should be # merged into whatis.exp, or else maintenance will be a royal pain -kingdon @@ -174,7 +174,7 @@ gdb_test "ptype red" "type = enum \{red, green, blue\}.*" "ptype unnamed enumera # timeout { fail "(timeout) ptype unsigned char" } #} -gdb_test "ptype v_short" "type = short(| int).*" "ptype short" +gdb_test "ptype v_short" "type = short(| int).*" "ptype short" #send "ptype v_signed_short\n" #gdb_expect { @@ -192,7 +192,7 @@ gdb_test "ptype v_short" "type = short(| int).*" "ptype short" #} -gdb_test "ptype v_int" "type = int.*" "ptype int" +gdb_test "ptype v_int" "type = int.*" "ptype int" #send "ptype v_signed_int\n" #gdb_expect { @@ -306,7 +306,7 @@ gdb_test "ptype v_int" "type = int.*" "ptype int" # #send "ptype v_long_array\n" #gdb_expect { -# -re "type = (long|int|long int) .2..*$gdb_prompt $" { +# -re "type = (long|int|long int) .2..*$gdb_prompt $" { # pass "ptype long array" } # -re ".*$gdb_prompt $" { fail "ptype long array" } # timeout { fail "(timeout) ptype long array" } @@ -315,7 +315,7 @@ gdb_test "ptype v_int" "type = int.*" "ptype int" # #send "ptype v_signed_long_array\n" #gdb_expect { -# -re "type = (long|int|long int) .2..*$gdb_prompt $" { +# -re "type = (long|int|long int) .2..*$gdb_prompt $" { # pass "ptype signed long array" } # -re ".*$gdb_prompt $" { fail "ptype signed long array" } # timeout { fail "(timeout) ptype signed long array" } @@ -585,7 +585,7 @@ gdb_test "ptype foo" "type = char" "ptype foo typedef after second list of charf if {[runto_main]} { - if [target_info exists gdb,cannot_call_functions] { + if {[target_info exists gdb,cannot_call_functions]} { unsupported "this target can not call functions" return } diff --git a/gdb/testsuite/gdb.base/quit-live.exp b/gdb/testsuite/gdb.base/quit-live.exp index 46579d4..e33d8bc 100644 --- a/gdb/testsuite/gdb.base/quit-live.exp +++ b/gdb/testsuite/gdb.base/quit-live.exp @@ -120,8 +120,13 @@ proc quit_with_live_inferior {appear_how extra_inferior quit_how} { } if {$extra_inferior} { - gdb_test "add-inferior" "Added inferior 2 on connection .*" \ - "add empty inferior 2" + if {[target_info gdb_protocol] ne "remote"} { + gdb_test "add-inferior" "Added inferior 2 on connection .*" \ + "add empty inferior 2" + } else { + gdb_test "add-inferior -no-connection" "Added inferior 2" \ + "add empty inferior 2" + } gdb_test "inferior 2" "Switching to inferior 2.*" \ "switch to inferior 2" } diff --git a/gdb/testsuite/gdb.base/radix.exp b/gdb/testsuite/gdb.base/radix.exp index 0d32baa..eeeb9bb 100644 --- a/gdb/testsuite/gdb.base/radix.exp +++ b/gdb/testsuite/gdb.base/radix.exp @@ -59,20 +59,20 @@ proc test_input_radix { iradix iradixhex iradixoctal } { test_one_input $iradix "-1" "-1" # test simple two-digit constants - test_one_input $iradix "10" [expr $iradix] - test_one_input $iradix "11" [expr $iradix + 1] - test_one_input $iradix "-10" [expr 0 - $iradix] - test_one_input $iradix "-11" [expr 0 - $iradix - 1] + test_one_input $iradix "10" [expr {$iradix}] + test_one_input $iradix "11" [expr {$iradix + 1}] + test_one_input $iradix "-10" [expr {0 - $iradix}] + test_one_input $iradix "-11" [expr {0 - $iradix - 1}] # test simple three-digit constants - test_one_input $iradix "100" [expr $iradix * $iradix] - test_one_input $iradix "101" [expr $iradix * $iradix + 1] - test_one_input $iradix "-100" [expr 0 - $iradix * $iradix] - test_one_input $iradix "-101" [expr 0 - $iradix * $iradix - 1] + test_one_input $iradix "100" [expr {$iradix * $iradix}] + test_one_input $iradix "101" [expr {$iradix * $iradix + 1}] + test_one_input $iradix "-100" [expr {0 - $iradix * $iradix}] + test_one_input $iradix "-101" [expr {0 - $iradix * $iradix - 1}] # test a five-digit constant test_one_input $iradix "10101" \ - [expr $iradix * $iradix * $iradix * $iradix + $iradix * $iradix + 1] + [expr {$iradix * $iradix * $iradix * $iradix + $iradix * $iradix + 1}] } test_input_radix 2 "2" "2" diff --git a/gdb/testsuite/gdb.base/randomize.exp b/gdb/testsuite/gdb.base/randomize.exp index 63bff21..5a7b089 100644 --- a/gdb/testsuite/gdb.base/randomize.exp +++ b/gdb/testsuite/gdb.base/randomize.exp @@ -60,7 +60,7 @@ gdb_test "show disable-randomization" \ set addr1 [address_get "randomized first address"] set addr2 [address_get "randomized second address"] set test "randomized addresses should not match" -if [string equal $addr1 $addr2] { +if {[string equal $addr1 $addr2]} { untested "no randomization detected on this system" return -1 } else { @@ -75,7 +75,7 @@ gdb_test "show disable-randomization" \ set addr1 [address_get "fixed first address"] set addr2 [address_get "fixed second address"] set test "fixed addresses should match" -if [string equal $addr1 $addr2] { +if {[string equal $addr1 $addr2]} { pass $test } else { fail $test diff --git a/gdb/testsuite/gdb.base/range-stepping.exp b/gdb/testsuite/gdb.base/range-stepping.exp index af78a2a..d1131c8 100644 --- a/gdb/testsuite/gdb.base/range-stepping.exp +++ b/gdb/testsuite/gdb.base/range-stepping.exp @@ -22,11 +22,11 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile {debug}] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } -if ![gdb_range_stepping_enabled] { +if {![gdb_range_stepping_enabled]} { unsupported "range stepping not supported by the target" return -1 } @@ -171,7 +171,7 @@ with_test_prefix "loop 2" { # Check that range stepping works well even when it is interrupted by # ctrl-c. -if ![target_info exists gdb,nointerrupts] { +if {![target_info exists gdb,nointerrupts]} { with_test_prefix "interrupt" { gdb_test_no_output "set debug remote 1" diff --git a/gdb/testsuite/gdb.base/recpar.exp b/gdb/testsuite/gdb.base/recpar.exp index 7e69790..5676067 100644 --- a/gdb/testsuite/gdb.base/recpar.exp +++ b/gdb/testsuite/gdb.base/recpar.exp @@ -19,7 +19,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/recurse.exp b/gdb/testsuite/gdb.base/recurse.exp index efe50db..e05f7e0 100644 --- a/gdb/testsuite/gdb.base/recurse.exp +++ b/gdb/testsuite/gdb.base/recurse.exp @@ -108,10 +108,10 @@ proc recurse_tests {} { # The former version expected the test to return to main(). # Now it expects the test to return to main or to stop in the # function's epilogue. - # + # # The problem is that gdb needs to (but doesn't) understand # function epilogues in the same way as for prologues. - # + # # If there is no hardware watchpoint (such as a x86 debug register), # then watchpoints are done "the hard way" by single-stepping the # target until the value of the watched variable changes. If you @@ -119,7 +119,7 @@ proc recurse_tests {} { # When you do that, the "top" stack frame may become partially # deconstructed (as when you pop the frame pointer, for instance), # and from that point on, GDB can no longer make sense of the stack. - # + # # A test which stops in the epilogue is trying to determine when GDB # leaves the stack frame in which the watchpoint was created. It does # this basically by watching for the frame pointer to change. When @@ -134,7 +134,7 @@ proc recurse_tests {} { # Preserve the old timeout, and set a new one that should be # sufficient to avoid timing out during this test. set oldtimeout $timeout -set timeout [expr "$timeout + 60"] +set timeout [expr {$timeout + 60}] verbose "Timeout is now $timeout seconds" 2 recurse_tests diff --git a/gdb/testsuite/gdb.base/reggroups.exp b/gdb/testsuite/gdb.base/reggroups.exp index 9e549bd..0d333af 100644 --- a/gdb/testsuite/gdb.base/reggroups.exp +++ b/gdb/testsuite/gdb.base/reggroups.exp @@ -114,7 +114,7 @@ set reggroups [fetch_reggroups "fetch reggroups"] set regcount 0 foreach reggroup $reggroups { set regs [fetch_reggroup_regs $reggroup "fetch reggroup regs $reggroup"] - set regcount [expr $regcount + [llength $regs]] + set regcount [expr {$regcount + [llength $regs]}] } gdb_assert "[llength $regcount] != 0" "system has reggroup registers" diff --git a/gdb/testsuite/gdb.base/relational.exp b/gdb/testsuite/gdb.base/relational.exp index 886cc4d..d79e205 100644 --- a/gdb/testsuite/gdb.base/relational.exp +++ b/gdb/testsuite/gdb.base/relational.exp @@ -19,7 +19,7 @@ # # tests for correctenss of relational operators, associativity and precedence # with integer type variables -# +# # # test running programs diff --git a/gdb/testsuite/gdb.base/relocate.exp b/gdb/testsuite/gdb.base/relocate.exp index c1c0815..db42885 100644 --- a/gdb/testsuite/gdb.base/relocate.exp +++ b/gdb/testsuite/gdb.base/relocate.exp @@ -29,7 +29,7 @@ clean_restart #Check that invalid options are rejected. foreach x {"-raednow" "readnow" "foo" "-readnow s"} { - set word [lindex $x [expr [llength $x]-1]] + set word [lindex $x [expr {[llength $x]-1}]] gdb_test "add-symbol-file ${binfile} 0 $x" \ "Unrecognized argument \"$word\"" \ "add-symbol-file: unknown option $word" @@ -278,7 +278,7 @@ with_test_prefix "functions, 2nd" { # Re-load the object giving an explicit address for .text -set text [ format "0x%x" [expr ${function_foo_addr} + 0x20000] ] +set text [ format "0x%x" [expr {${function_foo_addr} + 0x20000}] ] clean_restart gdb_test "add-symbol-file $binfile -o $offset $text" \ "Reading symbols from ${binfile}\.\.\.(\r\n$readnow_re)?" \ @@ -295,7 +295,7 @@ with_test_prefix "functions, 3rd" { # Re-load the object giving an explicit address for .data -set data [ format "0x%x" [expr ${global_foo_addr} + 0x20000] ] +set data [ format "0x%x" [expr {${global_foo_addr} + 0x20000}] ] clean_restart gdb_test "add-symbol-file $binfile -o $offset -s .data $data" \ "Reading symbols from ${binfile}\.\.\.(\r\n$readnow_re)?" \ diff --git a/gdb/testsuite/gdb.base/remote.exp b/gdb/testsuite/gdb.base/remote.exp index c1d6a99..1d97726 100644 --- a/gdb/testsuite/gdb.base/remote.exp +++ b/gdb/testsuite/gdb.base/remote.exp @@ -136,7 +136,7 @@ proc gdb_load_timed {executable class writesize} { fail "$test - loading executable" return } - verbose "$test - time [expr ($load_end_time - $load_begin_time) / 1000] ms" + verbose "$test - time [expr {($load_end_time - $load_begin_time) / 1000}] ms" pass $test } diff --git a/gdb/testsuite/gdb.base/reread.exp b/gdb/testsuite/gdb.base/reread.exp index 6c71f40..065cf1b 100644 --- a/gdb/testsuite/gdb.base/reread.exp +++ b/gdb/testsuite/gdb.base/reread.exp @@ -86,7 +86,7 @@ foreach_with_prefix opts { "" "pie" } { # Should see "Breakpoint 1, foo () at reread2.c:9" set test "run to foo() second time" - if [is_remote target] { + if {[is_remote target]} { unsupported $test } else { gdb_run_cmd @@ -97,7 +97,7 @@ foreach_with_prefix opts { "" "pie" } { ### Second pass: verify that GDB checks the executable file's ### timestamp when the program is *restarted*, not just when it exits. - if [is_remote target] { + if {[is_remote target]} { unsupported "second pass: GDB should check for changes before running" } else { diff --git a/gdb/testsuite/gdb.base/restore.exp b/gdb/testsuite/gdb.base/restore.exp index 5448fb4..a19c956 100644 --- a/gdb/testsuite/gdb.base/restore.exp +++ b/gdb/testsuite/gdb.base/restore.exp @@ -55,10 +55,10 @@ proc restore_tests { } { gdb_test "tbreak callee$e" "Temporary breakpoint.*\[0-9\]*\\." \ "caller$c calls callee$e; tbreak callee" - + gdb_test "continue" " callee$e prologue .*/" \ "caller$c calls callee$e; continue to callee" - + # Do a forced return from the callee. set test "caller$c calls callee$e; return callee now" @@ -71,7 +71,7 @@ proc restore_tests { } { # Check that the values of the local variables are what # they should be. for {set var 1} {$var <= $c} {incr var} { - set expected [expr 0x7eeb + $var] + set expected [expr {0x7eeb + $var}] set test "caller$c calls callee$e; return restored l$var to $expected" set pass_pattern " = $expected" set unsupported_pattern " = <optimized out>" diff --git a/gdb/testsuite/gdb.base/return.exp b/gdb/testsuite/gdb.base/return.exp index f39eebd..2d8665f 100644 --- a/gdb/testsuite/gdb.base/return.exp +++ b/gdb/testsuite/gdb.base/return.exp @@ -36,8 +36,8 @@ proc return_tests { } { send_gdb "step\n" exp_continue } - -re ".*in main after func1.*$gdb_prompt $" { - pass "simple return" + -re ".*in main after func1.*$gdb_prompt $" { + pass "simple return" } } diff --git a/gdb/testsuite/gdb.base/rtld-step.exp b/gdb/testsuite/gdb.base/rtld-step.exp index d1e240b..a2086a1 100644 --- a/gdb/testsuite/gdb.base/rtld-step.exp +++ b/gdb/testsuite/gdb.base/rtld-step.exp @@ -53,7 +53,7 @@ set binfile_rtld [standard_output_file ${rtld_basename}] # the flags -static-pie -fPIE were needed for Fedora 35 through Fedora # 38. The source file rtld-step-rtld.c didn't need the _start() # function either. And, better still, it was possible to call -# printf() to output progress messages in the pretend/fake RTLD. +# printf() to output progress messages in the pretend/fake RTLD. # Sadly, these output statements had to be removed in order to obtain # code which would work on other Linux distributions / releases. # diff --git a/gdb/testsuite/gdb.base/run-after-attach.exp b/gdb/testsuite/gdb.base/run-after-attach.exp index fde3854..2b8b4d0 100644 --- a/gdb/testsuite/gdb.base/run-after-attach.exp +++ b/gdb/testsuite/gdb.base/run-after-attach.exp @@ -21,7 +21,7 @@ require can_spawn_for_attach standard_testfile set executable $testfile -if [prepare_for_testing "failed to prepare" $executable] { +if {[prepare_for_testing "failed to prepare" $executable]} { return -1 } diff --git a/gdb/testsuite/gdb.base/save-bp.exp b/gdb/testsuite/gdb.base/save-bp.exp index 8a696cd..00b216a 100644 --- a/gdb/testsuite/gdb.base/save-bp.exp +++ b/gdb/testsuite/gdb.base/save-bp.exp @@ -19,7 +19,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} $srcfile] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } # Delete all breakpoints, watchpoints, tracepoints, and catchpoints so that @@ -61,7 +61,7 @@ gdb_test "save breakpoint $bps" "" "save breakpoint bps" # Now start a new debugger session... clean_restart $testfile -if ![runto_main] { +if {![runto_main]} { return -1 } # Delete all breakpoints, watchpoints, tracepoints, and catchpoints so that diff --git a/gdb/testsuite/gdb.base/savedregs.exp b/gdb/testsuite/gdb.base/savedregs.exp index d71d872..74b402f 100644 --- a/gdb/testsuite/gdb.base/savedregs.exp +++ b/gdb/testsuite/gdb.base/savedregs.exp @@ -96,7 +96,7 @@ proc process_saved_regs { current inner outer } { } incr level } - + # Now iterate through the list of OUTER frames checking that the # "info frame" output from each still matches what was captured # during an early query. To avoid cascading failures, checking is @@ -109,7 +109,7 @@ proc process_saved_regs { current inner outer } { foreach func $outer { set test [concat "Check $func info frame; stack contains" \ $current $inner $outer] - if $ok { + if {$ok} { set ok 0 set pat [string_to_regexp "$saved_regs($func)"] gdb_test_multiple "info frame $level" "$test" { diff --git a/gdb/testsuite/gdb.base/scope.exp b/gdb/testsuite/gdb.base/scope.exp index bb902a1..38ab6ca 100644 --- a/gdb/testsuite/gdb.base/scope.exp +++ b/gdb/testsuite/gdb.base/scope.exp @@ -263,7 +263,7 @@ proc_with_prefix test_at_autovars {} { set count 0 while {$count < 100} { gdb_test "print i$count" ".* = $count" "" - set count [expr $count+1] + set count [expr {$count+1}] } clear_xfail "*-*-*" pass "$count auto variables correctly initialized" @@ -327,7 +327,7 @@ clean_restart gdb_file_cmd $binfile # Test that variables in various segments print out correctly before -# the program is run. +# the program is run. # AIX--sections get mapped to the same address so we can't get the right one. setup_xfail "rs6000-*-*" diff --git a/gdb/testsuite/gdb.base/sepdebug.exp b/gdb/testsuite/gdb.base/sepdebug.exp index 71cc0eb..0235cbe 100644 --- a/gdb/testsuite/gdb.base/sepdebug.exp +++ b/gdb/testsuite/gdb.base/sepdebug.exp @@ -42,7 +42,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb # the name of a debuginfo only file. This file will be stored in the # gdb.base/ subdirectory. -if [gdb_gnu_strip_debug $binfile$EXEEXT] { +if {[gdb_gnu_strip_debug $binfile$EXEEXT]} { # check that you have a recent version of strip and objcopy installed unsupported "cannot produce separate debug info files" return -1 @@ -461,7 +461,7 @@ gdb_test "finish 123" \ # Verify that GDB responds gracefully to a request to "finish" from # the outermost frame. On a stub that never exits, this will just -# run to the stubs routine, so we don't get this error... Thus the +# run to the stubs routine, so we don't get this error... Thus the # second condition. # @@ -478,7 +478,7 @@ gdb_test_multiple "finish" "finish from outermost frame disallowed" { # Test "next" over recursive function call. # -proc test_next_with_recursion {} { +proc test_next_with_recursion {} { global gdb_prompt global decimal global binfile @@ -520,7 +520,7 @@ proc test_next_with_recursion {} { delete_breakpoints - if [istarget "mips*tx39-*"] { + if {[istarget "mips*tx39-*"]} { set timeout 60 } # We used to set timeout here for all other targets as well. This @@ -610,7 +610,7 @@ proc test_different_dir {type test_different_dir xfail} { # # Add a second pass pattern. The behavior differs here between stabs # and dwarf for one-line functions. Stabs preserves two line symbols - # (one before the prologue and one after) with the same line number, + # (one before the prologue and one after) with the same line number, # but dwarf regards these as duplicates and discards one of them. # Therefore the address after the prologue (where the breakpoint is) # has no exactly matching line symbol, and GDB reports the breakpoint diff --git a/gdb/testsuite/gdb.base/sepsymtab.exp b/gdb/testsuite/gdb.base/sepsymtab.exp index ed7a7a2..1822f1f 100644 --- a/gdb/testsuite/gdb.base/sepsymtab.exp +++ b/gdb/testsuite/gdb.base/sepsymtab.exp @@ -25,7 +25,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ return -1 } -if [gdb_gnu_strip_debug $binfile no-main] { +if {[gdb_gnu_strip_debug $binfile no-main]} { # check that you have a recent version of strip and objcopy installed unsupported "cannot produce separate debug info files" return -1 diff --git a/gdb/testsuite/gdb.base/setshow.exp b/gdb/testsuite/gdb.base/setshow.exp index 0e38a9d..de62692 100644 --- a/gdb/testsuite/gdb.base/setshow.exp +++ b/gdb/testsuite/gdb.base/setshow.exp @@ -411,7 +411,7 @@ proc_with_prefix test_setshow_print_characters {} { proc_with_prefix test_setshow_prompt {} { clean_restart - if [board_info target exists gdb_prompt] { + if {[board_info target exists gdb_prompt]} { return } diff --git a/gdb/testsuite/gdb.base/setvar.exp b/gdb/testsuite/gdb.base/setvar.exp index 0bce620..5335eff 100644 --- a/gdb/testsuite/gdb.base/setvar.exp +++ b/gdb/testsuite/gdb.base/setvar.exp @@ -33,7 +33,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { # # set it up at a breakpoint so we canplay with the variable values # -gdb_test_no_output "set print sevenbit-strings" +gdb_test_no_output "set print sevenbit-strings" if {![runto_main]} { return @@ -51,22 +51,22 @@ gdb_test_multiple "print sizeof (unsigned long)" "sizeof ulong" { set ulong_minus_1 18446744073709551615 set ulong_minus_456 18446744073709551160 } -} +} proc test_set { args } { global gdb_prompt - set length [expr [llength $args] - 1] + set length [expr {[llength $args] - 1}] set message "[lindex $args $length]" - set final [expr $length - 2] + set final [expr {$length - 2}] set count 1 # Set up the variables. for {set x 0} {$x < $length} {incr x} { if { "[lindex $args $x]" != "" } { set arg [lindex $args $x] - if { ($x == $final) || ([string first ".*" [lindex $args [expr $x + 1]]] >= 0) } { - set match [lindex $args [expr $x + 1]] + if { ($x == $final) || ([string first ".*" [lindex $args [expr {$x + 1}]]] >= 0) } { + set match [lindex $args [expr {$x + 1}]] set mess "$message -- $match" if { $count != 1 } { append mess " (#$count)" @@ -78,7 +78,7 @@ proc test_set { args } { set mess "$message -- $match" } verbose "doing $arg $match" - if [gdb_test -nopass "$arg" "$match" "$mess"] { + if {[gdb_test -nopass "$arg" "$match" "$mess"]} { return 1 } } @@ -91,27 +91,27 @@ proc test_set { args } { # # Because bare char types can be either signed or unsigned, we just test the # range of values that are common to both (0-127). -# +# -test_set "set variable v_char=0" "print v_char" ".\[0-9\]* = 0 \'.000\'" "set variable char=0" -test_set "set variable v_char=1" "print v_char" ".\[0-9\]* = 1 \'.001\'" "set variable char=1" -test_set "set variable v_char=7" "print v_char" ".\[0-9\]* = 7 \'.a\'" "set variable char=7 (Bel)" -test_set "set variable v_char=32" "print v_char" ".\[0-9\]* = 32 \' \'" "set variable char=32 (SPC)" -test_set "set variable v_char=65" "print v_char" ".\[0-9\]* = 65 \'A\'" "set variable char=65 ('A')" -test_set "set variable v_char=97" "print v_char" ".\[0-9\]* = 97 \'a\'" "set variable char=97 ('a')" -test_set "set variable v_char=126" "print v_char" ".\[0-9\]* = 126 \'~\'" "set variable char=126 ('~')" -test_set "set variable v_char=127" "print v_char" ".\[0-9\]* = 127 \'.177\'" "set variable char=127 (8-bit)" +test_set "set variable v_char=0" "print v_char" ".\[0-9\]* = 0 \'.000\'" "set variable char=0" +test_set "set variable v_char=1" "print v_char" ".\[0-9\]* = 1 \'.001\'" "set variable char=1" +test_set "set variable v_char=7" "print v_char" ".\[0-9\]* = 7 \'.a\'" "set variable char=7 (Bel)" +test_set "set variable v_char=32" "print v_char" ".\[0-9\]* = 32 \' \'" "set variable char=32 (SPC)" +test_set "set variable v_char=65" "print v_char" ".\[0-9\]* = 65 \'A\'" "set variable char=65 ('A')" +test_set "set variable v_char=97" "print v_char" ".\[0-9\]* = 97 \'a\'" "set variable char=97 ('a')" +test_set "set variable v_char=126" "print v_char" ".\[0-9\]* = 126 \'~\'" "set variable char=126 ('~')" +test_set "set variable v_char=127" "print v_char" ".\[0-9\]* = 127 \'.177\'" "set variable char=127 (8-bit)" # # test "set variable" for type "signed char" -# -test_set "set variable v_char=0" "print v_signed_char" ".\[0-9\]* = 0 \'.000\'" "set variable signed char=0" -test_set "set variable v_signed_char=1" "print v_signed_char" ".\[0-9\]* = 1 \'.001\'" "set variable signed char=1" -test_set "set variable v_signed_char=7" "print v_signed_char" ".\[0-9\]* = 7 \'.a\'" "set variable signed char=7 (Bel)" -test_set "set variable v_signed_char=32" "print v_signed_char" ".\[0-9\]* = 32 \' \'" "set variable signed char=32 (SPC)" -test_set "set variable v_signed_char=65" "print v_signed_char" ".\[0-9\]* = 65 \'A\'" "set variable signed char=65 ('A')" -test_set "set variable v_signed_char=97" "print v_signed_char" ".\[0-9\]* = 97 \'a\'" "set variable signed char=97 ('a')" -test_set "set variable v_signed_char=126" "print v_signed_char" ".\[0-9\]* = 126 \'~\'" "set variable signed char=126 ('~')" -test_set "set variable v_signed_char=127" "print v_signed_char" ".\[0-9\]* = 127 \'.177\'" "set variable signed char=127 (8-bit)" +# +test_set "set variable v_char=0" "print v_signed_char" ".\[0-9\]* = 0 \'.000\'" "set variable signed char=0" +test_set "set variable v_signed_char=1" "print v_signed_char" ".\[0-9\]* = 1 \'.001\'" "set variable signed char=1" +test_set "set variable v_signed_char=7" "print v_signed_char" ".\[0-9\]* = 7 \'.a\'" "set variable signed char=7 (Bel)" +test_set "set variable v_signed_char=32" "print v_signed_char" ".\[0-9\]* = 32 \' \'" "set variable signed char=32 (SPC)" +test_set "set variable v_signed_char=65" "print v_signed_char" ".\[0-9\]* = 65 \'A\'" "set variable signed char=65 ('A')" +test_set "set variable v_signed_char=97" "print v_signed_char" ".\[0-9\]* = 97 \'a\'" "set variable signed char=97 ('a')" +test_set "set variable v_signed_char=126" "print v_signed_char" ".\[0-9\]* = 126 \'~\'" "set variable signed char=126 ('~')" +test_set "set variable v_signed_char=127" "print v_signed_char" ".\[0-9\]* = 127 \'.177\'" "set variable signed char=127 (8-bit)" gdb_test_no_output "set variable v_signed_char=-1" with_target_charset "ASCII" { @@ -129,156 +129,156 @@ with_target_charset "ASCII" { # # test "set variable" for type "unsigned char" # -test_set "set variable v_unsigned_char=0" "print v_unsigned_char" ".\[0-9\]* = 0 \'.000\'" "set variable unsigned char=0" -test_set "set variable v_unsigned_char=1" "print v_unsigned_char" ".\[0-9\]* = 1 \'.001\'" "set variable unsigned char=1" -test_set "set variable v_unsigned_char=7" "print v_unsigned_char" ".\[0-9\]* = 7 \'.a\'" "set variable unsigned char=7 (Bel)" -test_set "set variable v_unsigned_char=32" "print v_unsigned_char" ".\[0-9\]* = 32 \' \'" "set variable unsigned char=32 (SPC)" -test_set "set variable v_unsigned_char=65" "print v_unsigned_char" ".\[0-9\]* = 65 \'A\'" "set variable unsigned char=65 ('A')" -test_set "set variable v_unsigned_char=97" "print v_unsigned_char" ".\[0-9\]* = 97 \'a\'" "set variable unsigned char=97 ('a')" -test_set "set variable v_unsigned_char=126" "print v_unsigned_char" ".\[0-9\]* = 126 \'~\'" "set variable unsigned char=126 ('~')" +test_set "set variable v_unsigned_char=0" "print v_unsigned_char" ".\[0-9\]* = 0 \'.000\'" "set variable unsigned char=0" +test_set "set variable v_unsigned_char=1" "print v_unsigned_char" ".\[0-9\]* = 1 \'.001\'" "set variable unsigned char=1" +test_set "set variable v_unsigned_char=7" "print v_unsigned_char" ".\[0-9\]* = 7 \'.a\'" "set variable unsigned char=7 (Bel)" +test_set "set variable v_unsigned_char=32" "print v_unsigned_char" ".\[0-9\]* = 32 \' \'" "set variable unsigned char=32 (SPC)" +test_set "set variable v_unsigned_char=65" "print v_unsigned_char" ".\[0-9\]* = 65 \'A\'" "set variable unsigned char=65 ('A')" +test_set "set variable v_unsigned_char=97" "print v_unsigned_char" ".\[0-9\]* = 97 \'a\'" "set variable unsigned char=97 ('a')" +test_set "set variable v_unsigned_char=126" "print v_unsigned_char" ".\[0-9\]* = 126 \'~\'" "set variable unsigned char=126 ('~')" with_target_charset "ASCII" { - test_set "set variable v_unsigned_char=~0" "print v_unsigned_char" ".\[0-9\]* = 255 \'.377\'" "set variable unsigned char=255 (8-bit)" + test_set "set variable v_unsigned_char=~0" "print v_unsigned_char" ".\[0-9\]* = 255 \'.377\'" "set variable unsigned char=255 (8-bit)" } # # test "set variable" for type "short" # -test_set "set variable v_short=0" "print v_short" ".\[0-9\]* = 0" "set variable short=0" -test_set "set variable v_short=1" "print v_short" ".\[0-9\]* = 1" "set variable short=1" -test_set "set variable v_short=-1" "print v_short" ".\[0-9\]* = -1" "set variable short=-1 (minus)" +test_set "set variable v_short=0" "print v_short" ".\[0-9\]* = 0" "set variable short=0" +test_set "set variable v_short=1" "print v_short" ".\[0-9\]* = 1" "set variable short=1" +test_set "set variable v_short=-1" "print v_short" ".\[0-9\]* = -1" "set variable short=-1 (minus)" # # test "set variable" for type "signed short" # -test_set "set variable v_signed_short=0" "print v_signed_short" ".\[0-9\]* = 0" "set variable signed short=0" -test_set "set variable v_signed_short=1" "print v_signed_short" ".\[0-9\]* = 1" "set variable signed short=1" -test_set "set variable v_signed_short=-1" "print v_signed_short" ".\[0-9\]* = -1" "set variable signed short=-1 (minus)" +test_set "set variable v_signed_short=0" "print v_signed_short" ".\[0-9\]* = 0" "set variable signed short=0" +test_set "set variable v_signed_short=1" "print v_signed_short" ".\[0-9\]* = 1" "set variable signed short=1" +test_set "set variable v_signed_short=-1" "print v_signed_short" ".\[0-9\]* = -1" "set variable signed short=-1 (minus)" # # test "set variable" for type "unsigned short" # -test_set "set variable v_unsigned_short=0" "print v_unsigned_short" ".\[0-9\]* = 0" "set variable unsigned short=0" -test_set "set variable v_unsigned_short=1" "print v_unsigned_short" ".\[0-9\]* = 1" "set variable unsigned short=1" -test_set "set variable v_unsigned_short=~0" "print v_unsigned_short" ".\[0-9\]* = 65535" "set variable unsigned short=~0 (minus)" +test_set "set variable v_unsigned_short=0" "print v_unsigned_short" ".\[0-9\]* = 0" "set variable unsigned short=0" +test_set "set variable v_unsigned_short=1" "print v_unsigned_short" ".\[0-9\]* = 1" "set variable unsigned short=1" +test_set "set variable v_unsigned_short=~0" "print v_unsigned_short" ".\[0-9\]* = 65535" "set variable unsigned short=~0 (minus)" # # test "set variable" for type "int" # -test_set "set variable v_int=0" "print v_int" ".\[0-9\]* = 0" "set variable int=0" -test_set "set variable v_int=1" "print v_int" ".\[0-9\]* = 1" "set variable int=1" -test_set "set variable v_int=-1" "print v_int" ".\[0-9\]* = -1" "set variable int=-1 (minus)" +test_set "set variable v_int=0" "print v_int" ".\[0-9\]* = 0" "set variable int=0" +test_set "set variable v_int=1" "print v_int" ".\[0-9\]* = 1" "set variable int=1" +test_set "set variable v_int=-1" "print v_int" ".\[0-9\]* = -1" "set variable int=-1 (minus)" # # test "set variable" for type "signed int" # -test_set "set variable v_signed_int=0" "print v_signed_int" ".\[0-9\]* = 0" "set variable signed int=0" -test_set "set variable v_signed_int=1" "print v_signed_int" ".\[0-9\]* = 1" "set variable signed int=1" -test_set "set variable v_signed_int=-1" "print v_signed_int" ".\[0-9\]* = -1" "set variable signed int=-1 (minus)" +test_set "set variable v_signed_int=0" "print v_signed_int" ".\[0-9\]* = 0" "set variable signed int=0" +test_set "set variable v_signed_int=1" "print v_signed_int" ".\[0-9\]* = 1" "set variable signed int=1" +test_set "set variable v_signed_int=-1" "print v_signed_int" ".\[0-9\]* = -1" "set variable signed int=-1 (minus)" # # test "set variable" for type "unsigned int" # -test_set "set variable v_unsigned_int=0" "print v_unsigned_int" ".\[0-9\]* = 0" "set variable unsigned int=0" -test_set "set variable v_unsigned_int=1" "print v_unsigned_int" ".\[0-9\]* = 1" "set variable unsigned int=1" -test_set "set variable v_unsigned_int=~0" "print v_unsigned_int" ".\[0-9\]* = (4294967295|65535)" "set variable unsigned int=~0 (minus)" -#test_set ".\[0-9\]* = 65535" "set variable unsigned int=~0 (minus)" +test_set "set variable v_unsigned_int=0" "print v_unsigned_int" ".\[0-9\]* = 0" "set variable unsigned int=0" +test_set "set variable v_unsigned_int=1" "print v_unsigned_int" ".\[0-9\]* = 1" "set variable unsigned int=1" +test_set "set variable v_unsigned_int=~0" "print v_unsigned_int" ".\[0-9\]* = (4294967295|65535)" "set variable unsigned int=~0 (minus)" +#test_set ".\[0-9\]* = 65535" "set variable unsigned int=~0 (minus)" # # test "set variable" for type "long" # -test_set "set variable v_long=0" "print v_long" ".\[0-9\]* = 0" "set variable long=0" -test_set "set variable v_long=1" "print v_long" ".\[0-9\]* = 1" "set variable long=1" -test_set "set variable v_long=-1" "print v_long" ".\[0-9\]* = -1" "set variable long=-1 (minus)" +test_set "set variable v_long=0" "print v_long" ".\[0-9\]* = 0" "set variable long=0" +test_set "set variable v_long=1" "print v_long" ".\[0-9\]* = 1" "set variable long=1" +test_set "set variable v_long=-1" "print v_long" ".\[0-9\]* = -1" "set variable long=-1 (minus)" # # test "set variable" for type "signed long" # -test_set "set variable v_signed_long=0" "print v_signed_long" ".\[0-9\]* = 0" "set variable signed long=0" -test_set "set variable v_signed_long=1" "print v_signed_long" ".\[0-9\]* = 1" "set variable signed long=1" -test_set "set variable v_signed_long=-1" "print v_signed_long" ".\[0-9\]* = -1" "set variable signed long=-1 (minus)" +test_set "set variable v_signed_long=0" "print v_signed_long" ".\[0-9\]* = 0" "set variable signed long=0" +test_set "set variable v_signed_long=1" "print v_signed_long" ".\[0-9\]* = 1" "set variable signed long=1" +test_set "set variable v_signed_long=-1" "print v_signed_long" ".\[0-9\]* = -1" "set variable signed long=-1 (minus)" # # test "set variable" for type "unsigned long" # -test_set "set variable v_unsigned_long=0" "print v_unsigned_long" ".\[0-9\]* = 0" "set variable unsigned long=0" -test_set "set variable v_unsigned_long=1" "print v_unsigned_long" ".\[0-9\]* = 1" "set variable unsigned long=1" -test_set "set variable v_unsigned_long=~0" "print v_unsigned_long" ".\[0-9\]* = $ulong_minus_1" "set variable unsigned long=~0 (minus)" +test_set "set variable v_unsigned_long=0" "print v_unsigned_long" ".\[0-9\]* = 0" "set variable unsigned long=0" +test_set "set variable v_unsigned_long=1" "print v_unsigned_long" ".\[0-9\]* = 1" "set variable unsigned long=1" +test_set "set variable v_unsigned_long=~0" "print v_unsigned_long" ".\[0-9\]* = $ulong_minus_1" "set variable unsigned long=~0 (minus)" # # test "set variable" for type "float" # -test_set "set variable v_float=0.0" "print v_float" ".\[0-9\]* = 0" "set variable float=0" -test_set "set variable v_float=1.0" "print v_float" ".\[0-9\]* = 1" "set variable float=1" -test_set "set variable v_float=-1.0" "print v_float" ".\[0-9\]* = -1" "set variable float=-1 (minus)" +test_set "set variable v_float=0.0" "print v_float" ".\[0-9\]* = 0" "set variable float=0" +test_set "set variable v_float=1.0" "print v_float" ".\[0-9\]* = 1" "set variable float=1" +test_set "set variable v_float=-1.0" "print v_float" ".\[0-9\]* = -1" "set variable float=-1 (minus)" # # test "set variable" for type "double" # -test_set "set variable v_double=0.0" "print v_double" ".\[0-9\]* = 0" "set variable double=0" -test_set "set variable v_double=1.0" "print v_double" ".\[0-9\]* = 1" "set variable double=1" -test_set "set variable v_double=-1.0" "print v_double" ".*.\[0-9\]* = -1" "set variable double=-1 (minus)" +test_set "set variable v_double=0.0" "print v_double" ".\[0-9\]* = 0" "set variable double=0" +test_set "set variable v_double=1.0" "print v_double" ".\[0-9\]* = 1" "set variable double=1" +test_set "set variable v_double=-1.0" "print v_double" ".*.\[0-9\]* = -1" "set variable double=-1 (minus)" # # test "set variable" for "char array[2]" # -test_set "set variable v_char_array\[0\]='h'" "set variable v_char_array\[1\]='i'" "print v_char_array" ".*.\[0-9\]* =.*\"hi\"" "set variable char array=\"hi\" (string)" +test_set "set variable v_char_array\[0\]='h'" "set variable v_char_array\[1\]='i'" "print v_char_array" ".*.\[0-9\]* =.*\"hi\"" "set variable char array=\"hi\" (string)" # # test "set variable" for "signed char array[2]" # -test_set "set variable v_signed_char_array\[0\]='h'" "set variable v_signed_char_array\[1\]='i'" "print v_signed_char_array" ".*.\[0-9\]* =.*\"hi\"" "set variable signed char array=\"hi\" (string)" +test_set "set variable v_signed_char_array\[0\]='h'" "set variable v_signed_char_array\[1\]='i'" "print v_signed_char_array" ".*.\[0-9\]* =.*\"hi\"" "set variable signed char array=\"hi\" (string)" # # test "set variable" for "unsigned char array[2]" # -test_set "set variable v_unsigned_char_array\[0\]='h'" "set variable v_unsigned_char_array\[1\]='i'" "print v_unsigned_char_array" ".*.\[0-9\]* =.*\"hi\"" "set variable unsigned char array=\"hi\" (string)" +test_set "set variable v_unsigned_char_array\[0\]='h'" "set variable v_unsigned_char_array\[1\]='i'" "print v_unsigned_char_array" ".*.\[0-9\]* =.*\"hi\"" "set variable unsigned char array=\"hi\" (string)" # # test "set variable" for "short array[2]" # -test_set "set variable v_short_array\[0\]=123" "set variable v_short_array\[1\]=-456" "print v_short_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable short array" +test_set "set variable v_short_array\[0\]=123" "set variable v_short_array\[1\]=-456" "print v_short_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable short array" # # test "set variable" for "signed short array[2]" # -test_set "set variable v_signed_short_array\[0\]=123" "set variable v_signed_short_array\[1\]=-456" "print v_signed_short_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable signed short array" +test_set "set variable v_signed_short_array\[0\]=123" "set variable v_signed_short_array\[1\]=-456" "print v_signed_short_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable signed short array" # # test "set variable" for "unsigned short array[2]" # -test_set "set variable v_unsigned_short_array\[0\]=123" "set variable v_unsigned_short_array\[1\]=-456" "print v_unsigned_short_array" ".*.\[0-9\]* =.*\\{123,.*65080\\}" "set variable unsigned short array" +test_set "set variable v_unsigned_short_array\[0\]=123" "set variable v_unsigned_short_array\[1\]=-456" "print v_unsigned_short_array" ".*.\[0-9\]* =.*\\{123,.*65080\\}" "set variable unsigned short array" # # test "set variable" for "int array[2]" # -test_set "set variable v_int_array\[0\]=123" "set variable v_int_array\[1\]=-456" "print v_int_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable int array" +test_set "set variable v_int_array\[0\]=123" "set variable v_int_array\[1\]=-456" "print v_int_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable int array" # # test "set variable" for "signed int array[2]" # -test_set "set variable v_signed_int_array\[0\]=123" "set variable v_signed_int_array\[1\]=-456" "print v_signed_int_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable signed int array" +test_set "set variable v_signed_int_array\[0\]=123" "set variable v_signed_int_array\[1\]=-456" "print v_signed_int_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable signed int array" # # test "set variable" for "unsigned int array[2]" # -test_set "set variable v_unsigned_int_array\[0\]=123" "set variable v_unsigned_int_array\[1\]=-456" "print v_unsigned_int_array" ".*.\[0-9\]* =.*\\{123,.*(4294966840|65080)\\}" "set variable unsigned int array" +test_set "set variable v_unsigned_int_array\[0\]=123" "set variable v_unsigned_int_array\[1\]=-456" "print v_unsigned_int_array" ".*.\[0-9\]* =.*\\{123,.*(4294966840|65080)\\}" "set variable unsigned int array" # # test "set variable" for "long array[2]" # -test_set "set variable v_long_array\[0\]=123" "set variable v_long_array\[1\]=-456" "print v_long_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable long array" +test_set "set variable v_long_array\[0\]=123" "set variable v_long_array\[1\]=-456" "print v_long_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable long array" # # test "set variable" for "signed long array[2]" # -test_set "set variable v_signed_long_array\[0\]=123" "set variable v_signed_long_array\[1\]=-456" "print v_signed_long_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable signed long array" +test_set "set variable v_signed_long_array\[0\]=123" "set variable v_signed_long_array\[1\]=-456" "print v_signed_long_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable signed long array" # # test "set variable" for "unsigned long array[2]" # -test_set "set variable v_unsigned_long_array\[0\]=123" "set variable v_unsigned_long_array\[1\]=-456" "print v_unsigned_long_array" ".*.\[0-9\]* =.*\\{123,.*$ulong_minus_456\\}" "set variable unsigned long array" +test_set "set variable v_unsigned_long_array\[0\]=123" "set variable v_unsigned_long_array\[1\]=-456" "print v_unsigned_long_array" ".*.\[0-9\]* =.*\\{123,.*$ulong_minus_456\\}" "set variable unsigned long array" # # test "set variable" for "float array[2]" # -test_set "set variable v_float_array\[0\]=123.0" "set variable v_float_array\[1\]=-456.0" "print v_float_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable float array" +test_set "set variable v_float_array\[0\]=123.0" "set variable v_float_array\[1\]=-456.0" "print v_float_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable float array" # # test "set variable" for "double array[2]" # -test_set "set variable v_double_array\[0\]=123.0" "set variable v_double_array\[1\]=-456.0" "print v_double_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable double array" +test_set "set variable v_double_array\[0\]=123.0" "set variable v_double_array\[1\]=-456.0" "print v_double_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable double array" # # test "set variable" for type "char *" # -test_set "set v_char_pointer=v_char_array" "set variable *(v_char_pointer)='h'" "set variable *(v_char_pointer+1)='i'" "print v_char_array" ".*.\[0-9\]* =.*\"hi\"" "print *(v_char_pointer+1)" ".*.\[0-9\]* = 105 \'i\'" "set variable char pointer=\"hi\" (string)" +test_set "set v_char_pointer=v_char_array" "set variable *(v_char_pointer)='h'" "set variable *(v_char_pointer+1)='i'" "print v_char_array" ".*.\[0-9\]* =.*\"hi\"" "print *(v_char_pointer+1)" ".*.\[0-9\]* = 105 \'i\'" "set variable char pointer=\"hi\" (string)" # # test "set variable" for type "signed char *" # -test_set "set v_signed_char_pointer=v_signed_char_array" "set variable *(v_signed_char_pointer)='h'" "set variable *(v_signed_char_pointer+1)='i'" "print v_signed_char_array" ".*.\[0-9\]* =.*\"hi\"" "print *(v_signed_char_pointer+1)" ".*.\[0-9\]* = 105 \'i\'" "set variable signed char pointer=\"hi\" (string)" +test_set "set v_signed_char_pointer=v_signed_char_array" "set variable *(v_signed_char_pointer)='h'" "set variable *(v_signed_char_pointer+1)='i'" "print v_signed_char_array" ".*.\[0-9\]* =.*\"hi\"" "print *(v_signed_char_pointer+1)" ".*.\[0-9\]* = 105 \'i\'" "set variable signed char pointer=\"hi\" (string)" # # test "set variable" for type "unsigned char *" # -test_set "set v_unsigned_char_pointer=v_unsigned_char_array" "set variable *(v_unsigned_char_pointer)='h'" "set variable *(v_unsigned_char_pointer+1)='i'" "print v_unsigned_char_array" ".*.\[0-9\]* =.*\"hi\"" "print *(v_unsigned_char_pointer+1)" ".*.\[0-9\]* = 105 \'i\'" "set variable unsigned char pointer=\"hi\" (string)" +test_set "set v_unsigned_char_pointer=v_unsigned_char_array" "set variable *(v_unsigned_char_pointer)='h'" "set variable *(v_unsigned_char_pointer+1)='i'" "print v_unsigned_char_array" ".*.\[0-9\]* =.*\"hi\"" "print *(v_unsigned_char_pointer+1)" ".*.\[0-9\]* = 105 \'i\'" "set variable unsigned char pointer=\"hi\" (string)" # # test "set variable" for type "short *" # -test_set "set v_short_pointer=v_short_array" "set variable *(v_short_pointer)=123" "set variable *(v_short_pointer+1)=-456" "print v_short_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_short_pointer+1)" ".*.\[0-9\]* = -456" "set variable short pointer" +test_set "set v_short_pointer=v_short_array" "set variable *(v_short_pointer)=123" "set variable *(v_short_pointer+1)=-456" "print v_short_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_short_pointer+1)" ".*.\[0-9\]* = -456" "set variable short pointer" # # test "set variable" for type "signed short *" # @@ -300,11 +300,11 @@ gdb_test "print *(v_unsigned_short_pointer+1)" ".\[0-9\]* = 65080" # # test "set variable" for type "int *" # -test_set "set v_int_pointer=v_int_array" "set variable *(v_int_pointer)=123" "set variable *(v_int_pointer+1)=-456" "print v_int_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_int_pointer+1)" ".*.\[0-9\]* = -456" "set variable int pointer" +test_set "set v_int_pointer=v_int_array" "set variable *(v_int_pointer)=123" "set variable *(v_int_pointer+1)=-456" "print v_int_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_int_pointer+1)" ".*.\[0-9\]* = -456" "set variable int pointer" # # test "set variable" for type "signed int *" # -test_set "set v_signed_int_pointer=v_signed_int_array" "set variable *(v_signed_int_pointer)=123" "set variable *(v_signed_int_pointer+1)=-456" "print v_signed_int_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_signed_int_pointer+1)" ".*.\[0-9\]* = -456" "set variable signed int pointer" +test_set "set v_signed_int_pointer=v_signed_int_array" "set variable *(v_signed_int_pointer)=123" "set variable *(v_signed_int_pointer+1)=-456" "print v_signed_int_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_signed_int_pointer+1)" ".*.\[0-9\]* = -456" "set variable signed int pointer" # # test "set variable" for type "unsigned int *" # @@ -313,32 +313,32 @@ test_set "" "print *(v_unsigned_int_pointer+1)" ".*.\[0-9\]* = (4294966840|65080 # # test "set variable" for type "long *" # -test_set "set v_long_pointer=v_long_array" "set variable *(v_long_pointer)=123" "set variable *(v_long_pointer+1)=-456" "print v_long_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_long_pointer+1)" ".*.\[0-9\]* = -456" "set variable long pointer" +test_set "set v_long_pointer=v_long_array" "set variable *(v_long_pointer)=123" "set variable *(v_long_pointer+1)=-456" "print v_long_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_long_pointer+1)" ".*.\[0-9\]* = -456" "set variable long pointer" # # test "set variable" for type "signed long *" # -test_set "set v_signed_long_pointer=v_signed_long_array" "set variable *(v_signed_long_pointer)=123" "set variable *(v_signed_long_pointer+1)=-456" "print v_signed_long_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_signed_long_pointer+1)" ".*.\[0-9\]* = -456" "set variable signed long pointer" +test_set "set v_signed_long_pointer=v_signed_long_array" "set variable *(v_signed_long_pointer)=123" "set variable *(v_signed_long_pointer+1)=-456" "print v_signed_long_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_signed_long_pointer+1)" ".*.\[0-9\]* = -456" "set variable signed long pointer" # # test "set variable" for type "unsigned long *" # -test_set "set v_unsigned_long_pointer=v_unsigned_long_array" "set variable *(v_unsigned_long_pointer)=123" "set variable *(v_unsigned_long_pointer+1)=-456" "print v_unsigned_long_array" ".*.\[0-9\]* =.*\\{123,.*$ulong_minus_456\\}" "print *(v_unsigned_long_pointer+1)" ".*.\[0-9\]* = $ulong_minus_456" "set variable unsigned long pointer" +test_set "set v_unsigned_long_pointer=v_unsigned_long_array" "set variable *(v_unsigned_long_pointer)=123" "set variable *(v_unsigned_long_pointer+1)=-456" "print v_unsigned_long_array" ".*.\[0-9\]* =.*\\{123,.*$ulong_minus_456\\}" "print *(v_unsigned_long_pointer+1)" ".*.\[0-9\]* = $ulong_minus_456" "set variable unsigned long pointer" # # test "set variable" for type "float *" # -test_set "set v_float_pointer=v_float_array" "set variable *(v_float_pointer)=123.0" "set variable *(v_float_pointer+1)=-456.0" "print v_float_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_float_pointer+1)" ".*.\[0-9\]* = -456" "set variable float pointer" +test_set "set v_float_pointer=v_float_array" "set variable *(v_float_pointer)=123.0" "set variable *(v_float_pointer+1)=-456.0" "print v_float_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_float_pointer+1)" ".*.\[0-9\]* = -456" "set variable float pointer" # # test "set variable" for type "double *" # -test_set "set v_double_pointer=v_double_array" "set variable *(v_double_pointer)=123.0" "set variable *(v_double_pointer+1)=-456.0" "print v_double_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_double_pointer+1)" ".*.\[0-9\]* = -456" "set variable double pointer" +test_set "set v_double_pointer=v_double_array" "set variable *(v_double_pointer)=123.0" "set variable *(v_double_pointer+1)=-456.0" "print v_double_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_double_pointer+1)" ".*.\[0-9\]* = -456" "set variable double pointer" # # test "set variable" for struct members # -test_set "set variable v_struct1.v_char_member='h'" "print v_struct1.v_char_member" ".*.\[0-9\]* = 104 \'h\'" "set variable structure char member" -test_set "set variable v_struct1.v_short_member=1" "print v_struct1.v_short_member" ".*.\[0-9\]* = 1" "set variable structure short member" -test_set "set variable v_struct1.v_int_member=2" "print v_struct1.v_int_member" ".*.\[0-9\]* = 2" "set variable structure int member" -test_set "set variable v_struct1.v_long_member=3" "print v_struct1.v_long_member" ".*.\[0-9\]* = 3" "set variable structure long member" -test_set "set variable v_struct1.v_float_member=4.0" "print v_struct1.v_float_member" ".*.\[0-9\]* = 4" "set variable structure float member" -test_set "set variable v_struct1.v_double_member=5.0" "print v_struct1.v_double_member" ".*.\[0-9\]* = 5" "set variable structure double member" +test_set "set variable v_struct1.v_char_member='h'" "print v_struct1.v_char_member" ".*.\[0-9\]* = 104 \'h\'" "set variable structure char member" +test_set "set variable v_struct1.v_short_member=1" "print v_struct1.v_short_member" ".*.\[0-9\]* = 1" "set variable structure short member" +test_set "set variable v_struct1.v_int_member=2" "print v_struct1.v_int_member" ".*.\[0-9\]* = 2" "set variable structure int member" +test_set "set variable v_struct1.v_long_member=3" "print v_struct1.v_long_member" ".*.\[0-9\]* = 3" "set variable structure long member" +test_set "set variable v_struct1.v_float_member=4.0" "print v_struct1.v_float_member" ".*.\[0-9\]* = 4" "set variable structure float member" +test_set "set variable v_struct1.v_double_member=5.0" "print v_struct1.v_double_member" ".*.\[0-9\]* = 5" "set variable structure double member" gdb_test "print v_struct1" \ ".*.\[0-9\]* = \{.*v_char_member = 104 \'h\',.*v_short_member = 1,\ diff --git a/gdb/testsuite/gdb.base/shlib-call.exp b/gdb/testsuite/gdb.base/shlib-call.exp index d3ff1c3..4a5cefd 100644 --- a/gdb/testsuite/gdb.base/shlib-call.exp +++ b/gdb/testsuite/gdb.base/shlib-call.exp @@ -79,7 +79,7 @@ gdb_test "next 2" "g = shr1\\(g\\);" "next to shr1" gdb_test "print g" "\[0-9\]* = 1" #step -over -if ![gdb_skip_stdio_test "next over shr1"] { +if {![gdb_skip_stdio_test "next over shr1"]} { gdb_test_stdio "next" \ "address of sgs is $hex" \ "g = shr2\\(g\\);" \ @@ -93,7 +93,7 @@ if ![gdb_skip_stdio_test "next over shr1"] { gdb_test "print g" "\[0-9\]* = 2" "print g two" #print shr1(1) -if ![gdb_skip_stdio_test "print shr1(1)"] { +if {![gdb_skip_stdio_test "print shr1(1)"]} { gdb_test_stdio "print shr1(1)" \ "address of sgs is $hex" \ "\[0-9\]* = 2" \ @@ -101,7 +101,7 @@ if ![gdb_skip_stdio_test "print shr1(1)"] { } #print shr1(g) -if ![gdb_skip_stdio_test "print shr1(g)"] { +if {![gdb_skip_stdio_test "print shr1(g)"]} { gdb_test_stdio "print shr1(g)" \ "address of sgs is $hex" \ "\[0-9\]* = 4" \ @@ -120,7 +120,7 @@ gdb_test "continue" \ #print shr1(1) -if ![gdb_skip_stdio_test "print shr1(1) 2nd time"] { +if {![gdb_skip_stdio_test "print shr1(1) 2nd time"]} { gdb_test_stdio "print shr1(1)" \ "address of sgs is $hex" \ "\[0-9\]* = 2" \ diff --git a/gdb/testsuite/gdb.base/shlib-unload.exp b/gdb/testsuite/gdb.base/shlib-unload.exp index 0e1369e..e38d04d 100644 --- a/gdb/testsuite/gdb.base/shlib-unload.exp +++ b/gdb/testsuite/gdb.base/shlib-unload.exp @@ -57,7 +57,7 @@ set bp_disabled_re "warning: Temporarily disabling breakpoints for unloaded shar # assuming that GDB has disabled some breakpoints. set stop_after_bp_re [multi_line \ "^$::bp_disabled_re" \ - "[expr $::bp_line + 1]\\s+assert \\(res == 0\\);"] + "[expr {$::bp_line + 1}]\\s+assert \\(res == 0\\);"] # Checking that a breakpoint with multiple locations in a shared # library only triggers a single breakpoint modified event from diff --git a/gdb/testsuite/gdb.base/shreloc.exp b/gdb/testsuite/gdb.base/shreloc.exp index 2bd79af..e960291 100644 --- a/gdb/testsuite/gdb.base/shreloc.exp +++ b/gdb/testsuite/gdb.base/shreloc.exp @@ -42,11 +42,11 @@ if {([istarget "*pc-cygwin"] || [istarget "*pc-mingw32"]) } { lappend lib_opts "ldflags=-Wl,--image-base,0x04000000" } -if [test_compiler_info "xlc-*"] { +if {[test_compiler_info "xlc-*"]} { - # IBM's xlc compiler does not add static variables to the ELF symbol - # table by default. We need this option to make the variables show - # up in "maint print msymbols". + # IBM's xlc compiler does not add static variables to the ELF symbol + # table by default. We need this option to make the variables show + # up in "maint print msymbols". lappend lib_opts "additional_flags=-qstatsym" @@ -194,13 +194,13 @@ proc check_different {var msymfile} { return 1 } -if [is_remote host] { +if {[is_remote host]} { set msymfile shreloc.txt } else { set msymfile [standard_output_file shreloc.txt] } -if [send_gdb_discard "maint print msymbols ${msymfile}"] { +if {[send_gdb_discard "maint print msymbols ${msymfile}"]} { if {[check_different "static_var_\[12\]" "${msymfile}"]} { pass "(msymbol) relocated static vars have different addresses" } else { diff --git a/gdb/testsuite/gdb.base/sigbpt.exp b/gdb/testsuite/gdb.base/sigbpt.exp index a9da0f5..c003baf 100644 --- a/gdb/testsuite/gdb.base/sigbpt.exp +++ b/gdb/testsuite/gdb.base/sigbpt.exp @@ -236,7 +236,7 @@ proc cont_out { name args } { # Now single step the faulted instrction at that breakpoint. gdb_test "stepi" \ "Program received signal ${signame}.*pc(\r\n| *)=> [at_segv] .*" \ - "${name}; stepi fault" + "${name}; stepi fault" # Clear any breakpoints for {set i 0} {$i < [llength $args]} {incr i} { diff --git a/gdb/testsuite/gdb.base/siginfo-infcall.exp b/gdb/testsuite/gdb.base/siginfo-infcall.exp index e60270c..46d67cc 100644 --- a/gdb/testsuite/gdb.base/siginfo-infcall.exp +++ b/gdb/testsuite/gdb.base/siginfo-infcall.exp @@ -21,7 +21,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/signals-state-child.exp b/gdb/testsuite/gdb.base/signals-state-child.exp index 00ad7f5..9bcf730 100644 --- a/gdb/testsuite/gdb.base/signals-state-child.exp +++ b/gdb/testsuite/gdb.base/signals-state-child.exp @@ -90,7 +90,7 @@ if { $res < 0 || $res == "" } { } set wait_status [remote_wait target 60] -set have_standalone [expr [lindex $wait_status 0] == 0] +set have_standalone [expr {[lindex $wait_status 0] == 0}] gdb_assert { $have_standalone } "collect standalone signals state" remote_close target diff --git a/gdb/testsuite/gdb.base/signals.exp b/gdb/testsuite/gdb.base/signals.exp index 5ff1e38..c0aaa0a 100644 --- a/gdb/testsuite/gdb.base/signals.exp +++ b/gdb/testsuite/gdb.base/signals.exp @@ -35,7 +35,7 @@ proc test_handle_all_print {} { # Increase timeout and expect input buffer for large output from gdb. # Allow blank or TAB as whitespace characters. set oldtimeout $timeout - set timeout [expr "$timeout + 60"] + set timeout [expr {$timeout + 60}] verbose "Timeout is now $timeout seconds" 2 if { ![istarget "*-*-linux*"] && ( [istarget "*-*-gnu*"] @@ -258,7 +258,7 @@ The program being debugged stopped while in a function called from GDB.*" \ gdb_test "signal" \ "Argument required .signal number..*" \ "signal without arguments disallowed" - + # Verify that we can successfully send a signal other than 0 to # the inferior. (This probably causes the inferior to run away. # Be prepared to rerun to main for further testing.) diff --git a/gdb/testsuite/gdb.base/signest.exp b/gdb/testsuite/gdb.base/signest.exp index 0e62f0b..c55db4a 100644 --- a/gdb/testsuite/gdb.base/signest.exp +++ b/gdb/testsuite/gdb.base/signest.exp @@ -19,7 +19,7 @@ standard_testfile require {!target_info exists gdb,nosignals} -if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug}] { +if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug}]} { return -1 } diff --git a/gdb/testsuite/gdb.base/sizeof.exp b/gdb/testsuite/gdb.base/sizeof.exp index 1152e13..3c81b77 100644 --- a/gdb/testsuite/gdb.base/sizeof.exp +++ b/gdb/testsuite/gdb.base/sizeof.exp @@ -127,7 +127,7 @@ while { $ok } { gdb_expect { -re ".*dump" { #pass "maint print arch $ok" - #set ok [expr $ok + 1] + #set ok [expr {$ok + 1}] } -re "$gdb_prompt $" { pass "maint print arch" diff --git a/gdb/testsuite/gdb.base/skip-inline.exp b/gdb/testsuite/gdb.base/skip-inline.exp index 33a3951..e3bc108 100644 --- a/gdb/testsuite/gdb.base/skip-inline.exp +++ b/gdb/testsuite/gdb.base/skip-inline.exp @@ -27,7 +27,7 @@ set srcfile skip-inline.c set srcfile1 skip1.c proc_with_prefix single_step { } { - if ![runto_main] { + if {![runto_main]} { return } @@ -43,7 +43,7 @@ proc_with_prefix single_step { } { } proc_with_prefix double_step { } { - if ![runto_main] { + if {![runto_main]} { return } @@ -61,7 +61,7 @@ proc_with_prefix double_step { } { } proc_with_prefix triple_step { } { - if ![runto_main] { + if {![runto_main]} { return } @@ -75,7 +75,7 @@ proc_with_prefix triple_step { } { } proc_with_prefix skip_current_frame { } { - if ![runto_main] { + if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.base/skip-solib.exp b/gdb/testsuite/gdb.base/skip-solib.exp index d96d1ac..e152023 100644 --- a/gdb/testsuite/gdb.base/skip-solib.exp +++ b/gdb/testsuite/gdb.base/skip-solib.exp @@ -72,7 +72,7 @@ with_test_prefix "ignoring solib file" { "Num\\s+Enb\\s+Glob\\s+File\\s+RE\\s+Function\\s*" \ "1\\s+y\\s+n\\s+${srcfile_lib}\\s+n\\s+<none>\\s*"] - if ![runto_main] { + if {![runto_main]} { return } @@ -94,7 +94,7 @@ with_test_prefix "ignoring solib function" { "Function multiply will be skipped when stepping\\." \ "skip function" - if ![runto_main] { + if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.base/skip.exp b/gdb/testsuite/gdb.base/skip.exp index 0c84cf9..3e2f162 100644 --- a/gdb/testsuite/gdb.base/skip.exp +++ b/gdb/testsuite/gdb.base/skip.exp @@ -49,7 +49,7 @@ gdb_test "skip -rfunction" "Missing value for -rfunction option." gdb_test "skip -x" "Invalid skip option: -x" gdb_test "skip -rfu foo.* xyzzy" "Invalid argument: xyzzy" -if ![runto_main] { +if {![runto_main]} { return } @@ -93,7 +93,7 @@ gdb_test "info skip" \ # files, so when we step into the first line in main(), we should step # right over it and go to the second line of main(). -if ![runto_main] { +if {![runto_main]} { return } @@ -121,7 +121,7 @@ with_test_prefix "step after deleting 1" { "4\\s+y\\s+n\\s+<none>\\s+n\\s+baz"] \ "info skip (delete 1)" - if ![runto_main] { + if {![runto_main]} { return } @@ -164,7 +164,7 @@ with_test_prefix "step after disabling 3" { "3\\s+n\\s+n\\s+$srcfile1\\s+n\\s+<none>\\s*" \ "info skip shows entry as disabled" - if ![runto_main] { + if {![runto_main]} { return } @@ -180,7 +180,7 @@ with_test_prefix "step after enable 3" { "3\\s+y\\s+n\\s+$srcfile1\\s+n\\s+<none>\\s*" \ "info skip shows entry as enabled" - if ![runto_main] { + if {![runto_main]} { return } @@ -247,7 +247,7 @@ gdb_test "skip -fu baz" "Function baz will be skipped when stepping\." gdb_test "skip -rfu ^b.z$" "Function\\(s\\) \\^b\\.z\\$ will be skipped when stepping." with_test_prefix "step using -fi" { - if ![runto_main] { + if {![runto_main]} { return } @@ -257,7 +257,7 @@ with_test_prefix "step using -fi" { } with_test_prefix "step using -gfi" { - if ![runto_main] { + if {![runto_main]} { return } @@ -267,7 +267,7 @@ with_test_prefix "step using -gfi" { } with_test_prefix "step using -fu for baz" { - if ![runto_main] { + if {![runto_main]} { return } @@ -278,7 +278,7 @@ with_test_prefix "step using -fu for baz" { } with_test_prefix "step using -rfu for baz" { - if ![runto_main] { + if {![runto_main]} { return } @@ -293,7 +293,7 @@ with_test_prefix "step using -rfu for baz" { with_test_prefix "step using -fi + -fu" { gdb_test_no_output "skip delete" - if ![runto test_skip_file_and_function] { + if {![runto test_skip_file_and_function]} { return } @@ -311,7 +311,7 @@ with_test_prefix "skip delete completion" { global binfile clean_restart gdb_load $binfile - if ![runto_main] { + if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.base/skipcxx.exp b/gdb/testsuite/gdb.base/skipcxx.exp index ec440ab..29f9254 100644 --- a/gdb/testsuite/gdb.base/skipcxx.exp +++ b/gdb/testsuite/gdb.base/skipcxx.exp @@ -23,7 +23,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile $flags]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.base/solib-corrupted.exp b/gdb/testsuite/gdb.base/solib-corrupted.exp index a9cc59d..9b5556d 100644 --- a/gdb/testsuite/gdb.base/solib-corrupted.exp +++ b/gdb/testsuite/gdb.base/solib-corrupted.exp @@ -30,7 +30,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { # corruption cannot be tested. Disable the probes interface. gdb_test "maint ignore-probes rtld" -if ![runto_main] { +if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.base/solib-nodir.exp b/gdb/testsuite/gdb.base/solib-nodir.exp index 510164c..249f494 100644 --- a/gdb/testsuite/gdb.base/solib-nodir.exp +++ b/gdb/testsuite/gdb.base/solib-nodir.exp @@ -53,7 +53,7 @@ gdb_test_no_output "set cwd ${binlibfiledir}" \ "set cwd OBJDIR/${subdir}" set test "library loaded" -if [runto_main] { +if {[runto_main]} { pass $test } else { fail $test diff --git a/gdb/testsuite/gdb.base/solib-overlap.exp b/gdb/testsuite/gdb.base/solib-overlap.exp index ce18607..893deb6 100644 --- a/gdb/testsuite/gdb.base/solib-overlap.exp +++ b/gdb/testsuite/gdb.base/solib-overlap.exp @@ -42,7 +42,7 @@ set srcfile ${srcdir}/${subdir}/${testfile}.c # Prelink first lib1 at 0x40000000 and lib2 at 0x41000000. # During second pass try lib1 at 0x50000000 and lib2 at 0x51000000. foreach prelink_lib1 {0x40000000 0x50000000} { with_test_prefix "$prelink_lib1" { - set prelink_lib2 [format "0x%x" [expr $prelink_lib1 + 0x01000000]] + set prelink_lib2 [format "0x%x" [expr {$prelink_lib1 + 0x01000000}]] # Library file. set binfile_lib1 [standard_output_file ${libname}1-${prelink_lib1}.so] @@ -64,8 +64,8 @@ foreach prelink_lib1 {0x40000000 0x50000000} { with_test_prefix "$prelink_lib1" return -1 } - if {[catch "exec prelink -N -r ${prelink_lib1} ${binfile_lib1}" output] != 0 - || [catch "exec prelink -N -r ${prelink_lib2} ${binfile_lib2}" output] != 0} { + if {[catch {exec prelink -N -r ${prelink_lib1} ${binfile_lib1}} output] != 0 + || [catch {exec prelink -N -r ${prelink_lib2} ${binfile_lib2}} output] != 0} { # Maybe we don't have prelink. verbose -log "prelink failed: $output" untested "could not prelink ${binfile_lib1_test_msg} or ${binfile_lib2_test_msg}." diff --git a/gdb/testsuite/gdb.base/solib-weak.exp b/gdb/testsuite/gdb.base/solib-weak.exp index 511ef37..f9b8856 100644 --- a/gdb/testsuite/gdb.base/solib-weak.exp +++ b/gdb/testsuite/gdb.base/solib-weak.exp @@ -69,7 +69,7 @@ proc do_test { lib1opts lib2opts lib1first } { set lib1 [standard_output_file ${libfile1}.sl] set lib2 [standard_output_file ${libfile2}.sl] - if $lib1first { + if {$lib1first} { set exec_opts [list debug shlib=${lib1} shlib=${lib2}] set expected_file ${libfile1} } else { diff --git a/gdb/testsuite/gdb.base/source-dir.exp b/gdb/testsuite/gdb.base/source-dir.exp index e07a117..96f5a7c 100644 --- a/gdb/testsuite/gdb.base/source-dir.exp +++ b/gdb/testsuite/gdb.base/source-dir.exp @@ -83,7 +83,7 @@ proc test_truncated_comp_dir {} { # All of these pathname and directory manipulations assume # host == build, so do not attempt this set of tests on remote host. - if [is_remote host] { + if {[is_remote host]} { return } diff --git a/gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.exp b/gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.exp index 15c0fda..0ded183 100644 --- a/gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.exp +++ b/gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.exp @@ -41,7 +41,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return 0 } @@ -140,7 +140,7 @@ gdb_test_multiple "" $test { set disasm_after [disassemble "after"] set test "before/after disassembly matches" -if ![string compare $disasm_before $disasm_after] { +if {![string compare $disasm_before $disasm_after]} { pass $test } else { fail $test diff --git a/gdb/testsuite/gdb.base/stale-infcall.exp b/gdb/testsuite/gdb.base/stale-infcall.exp index 158f3f7..1d2c655 100644 --- a/gdb/testsuite/gdb.base/stale-infcall.exp +++ b/gdb/testsuite/gdb.base/stale-infcall.exp @@ -19,7 +19,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/stap-probe.exp b/gdb/testsuite/gdb.base/stap-probe.exp index c487a9f..4d8efc1 100644 --- a/gdb/testsuite/gdb.base/stap-probe.exp +++ b/gdb/testsuite/gdb.base/stap-probe.exp @@ -60,8 +60,8 @@ proc gdb_count_probes { type provider name { object "" }} { } } - if { [expr $no_probes_line && $probe_count > 0] \ - || [expr !$no_probes_line && $probe_count == 0] } { + if { ($no_probes_line && $probe_count > 0) \ + || (!$no_probes_line && $probe_count == 0) } { perror "Mismatch between no probes found line, and probes count" return -1 } @@ -74,7 +74,7 @@ proc check_for_usable_xmm0_probe { binfile } { set binfile [standard_output_file $binfile] set command "exec $readelf_program -n $binfile" verbose -log "command is $command" - set result [catch $command output] + set result [catch {{*}$command} output] verbose -log "result is $result" verbose -log "output is $output" @@ -89,7 +89,7 @@ proc check_for_usable_xmm0_probe { binfile } { # First, look for the xmmreg probe, and if we find it, grab the # argument string. - if ![regexp {\n\s+Provider: test\n\s+Name: xmmreg\n[^\n]+\n\s+Arguments: ([^\n]+)\n} $output ignore arguments] { + if {![regexp {\n\s+Provider: test\n\s+Name: xmmreg\n[^\n]+\n\s+Arguments: ([^\n]+)\n} $output ignore arguments]} { verbose -log "APB: Couldn't find probe at all" return false } @@ -98,7 +98,7 @@ proc check_for_usable_xmm0_probe { binfile } { verbose -log "APB: arguments: '$arguments'" # Check the the argument string mentions xmm0. - if ![regexp {@%?xmm0} $arguments] { + if {![regexp {@%?xmm0} $arguments]} { verbose -log "APB: Prove doesn't use xmm0 register" return false } @@ -133,7 +133,7 @@ proc stap_test {exec_name {args ""}} { "get original address of relocation_marker"] } - if ![runto_main] { + if {![runto_main]} { return -1 } @@ -159,7 +159,7 @@ proc stap_test {exec_name {args ""}} { [get_hexadecimal_valueof "&relocation_marker" \ "0" "get revised relocation_marker address"] set relocation_base \ - [expr $updated_semaphore_addr_var - $semaphore_addr_var] + [expr {$updated_semaphore_addr_var - $semaphore_addr_var}] if {$relocation_base != 0} { # Checks that GDB doesn't mistakenly relocate and write to null # semaphore addresses. If it were to relocate a zero-valued @@ -219,7 +219,7 @@ proc stap_test {exec_name {args ""}} { "print \$_probe_arg1 for probe ps" # Check the probe is using the xmm0 register. - if [check_for_usable_xmm0_probe $exec_name] { + if {[check_for_usable_xmm0_probe $exec_name]} { delete_breakpoints if {[runto "-pstap test:xmmreg"]} { diff --git a/gdb/testsuite/gdb.base/startup-with-shell.exp b/gdb/testsuite/gdb.base/startup-with-shell.exp index a6ebb57..6872369 100644 --- a/gdb/testsuite/gdb.base/startup-with-shell.exp +++ b/gdb/testsuite/gdb.base/startup-with-shell.exp @@ -22,7 +22,7 @@ require !use_gdb_stub # (via dejagnu) yet. require {!is_remote target} -require {expr [have_startup_shell] != -1} +require {expr {[have_startup_shell] != -1}} standard_testfile diff --git a/gdb/testsuite/gdb.base/step-into-other-file.exp b/gdb/testsuite/gdb.base/step-into-other-file.exp index 64403a1..80fc55e 100644 --- a/gdb/testsuite/gdb.base/step-into-other-file.exp +++ b/gdb/testsuite/gdb.base/step-into-other-file.exp @@ -26,7 +26,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/step-over-exit.exp b/gdb/testsuite/gdb.base/step-over-exit.exp index 6dfa7bb..105157d 100644 --- a/gdb/testsuite/gdb.base/step-over-exit.exp +++ b/gdb/testsuite/gdb.base/step-over-exit.exp @@ -38,7 +38,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/step-over-no-symbols.exp b/gdb/testsuite/gdb.base/step-over-no-symbols.exp index 1a91986..24e3bf7 100644 --- a/gdb/testsuite/gdb.base/step-over-no-symbols.exp +++ b/gdb/testsuite/gdb.base/step-over-no-symbols.exp @@ -50,7 +50,7 @@ proc test_step_over { displaced } { clean_restart gdb_load $binfile - if ![runto_main] { + if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/step-over-syscall.exp b/gdb/testsuite/gdb.base/step-over-syscall.exp index 9df716d..e4425a1 100644 --- a/gdb/testsuite/gdb.base/step-over-syscall.exp +++ b/gdb/testsuite/gdb.base/step-over-syscall.exp @@ -227,7 +227,7 @@ proc step_over_syscall { syscall } { lappend options "pthreads" } - if [build_executable ${testfile}.exp ${testfile} ${testfile}.c $options] { + if {[build_executable ${testfile}.exp ${testfile} ${testfile}.c $options]} { untested "failed to compile" return -1 } diff --git a/gdb/testsuite/gdb.base/step-resume-infcall.exp b/gdb/testsuite/gdb.base/step-resume-infcall.exp index 4010c76..f1f8dc2 100644 --- a/gdb/testsuite/gdb.base/step-resume-infcall.exp +++ b/gdb/testsuite/gdb.base/step-resume-infcall.exp @@ -19,7 +19,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} $srcfile] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } @@ -27,7 +27,7 @@ gdb_test "step" " in-func .*" gdb_test "up" " call-func .*" gdb_test_no_output {set $b=$pc} -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/step-sw-breakpoint-adjust-pc.exp b/gdb/testsuite/gdb.base/step-sw-breakpoint-adjust-pc.exp index 2dde3bb..b10465f 100644 --- a/gdb/testsuite/gdb.base/step-sw-breakpoint-adjust-pc.exp +++ b/gdb/testsuite/gdb.base/step-sw-breakpoint-adjust-pc.exp @@ -21,7 +21,7 @@ standard_testfile -if [build_executable "failed to build" ${testfile} ${srcfile} {debug}] { +if {[build_executable "failed to build" ${testfile} ${srcfile} {debug}]} { return -1 } @@ -43,7 +43,7 @@ proc test {non_stop displaced always_inserted} { gdb_test_no_output "set displaced-stepping $displaced" gdb_test_no_output "set breakpoint always-inserted $always_inserted" - if ![runto_main] { + if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/step-symless.exp b/gdb/testsuite/gdb.base/step-symless.exp index 07df253..47e4682 100644 --- a/gdb/testsuite/gdb.base/step-symless.exp +++ b/gdb/testsuite/gdb.base/step-symless.exp @@ -21,7 +21,7 @@ if {[build_executable ${testfile}.exp ${testfile} ${srcfile} {nodebug}] == -1} { # We need those symbols global to access them from the .S file. set test "strip stub symbols" set objcopy_program [gdb_find_objcopy] -set result [catch "exec $objcopy_program -N symless ${binfile}" output] +set result [catch {exec $objcopy_program -N symless ${binfile}} output] verbose "result is $result" verbose "output is $output" if {$result != 0} { @@ -32,7 +32,7 @@ pass $test clean_restart $testfile -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/step-test.exp b/gdb/testsuite/gdb.base/step-test.exp index 39833a3..cfcf511 100644 --- a/gdb/testsuite/gdb.base/step-test.exp +++ b/gdb/testsuite/gdb.base/step-test.exp @@ -33,7 +33,7 @@ if {![runto_main]} { # Set a breakpoint at line 45, if stepi then finish fails, we would # run to the end of the program, which would mess up the rest of the tests. - + # Vanilla step/next # gdb_test "next" ".*${decimal}.*x = 1;.*" "next 1" @@ -92,10 +92,10 @@ if { [istarget "ia64-*-*"] || [istarget "mips*-*-*"]} { ### ### The exact regexps used are "$HERE.*$gdb_prompt $" ### and "$THERE.*$gdb_prompt $" -### +### proc test_i {name command here there} { global gdb_prompt - + set i 0 gdb_test_multiple "$command" "$name" { -re "$here.*$gdb_prompt $" { @@ -123,7 +123,7 @@ test_i "stepi to next line" "stepi" \ # if this passes through a (useless) PLT entry. test_i "stepi into function" "stepi" \ "(.*${decimal}.*callee.*STEPI|.* in callee@plt)" \ - ".*callee \\(\\) at .*step-test\\.c" + ".*callee \\(\\) at .*step-test\\.c" # Continue to step until we reach the function's body. This makes it # more likely that we've actually completed the prologue, so "finish" @@ -134,7 +134,7 @@ test_i "stepi into function's first source line" "stepi" \ "(${decimal}.*int callee|$pic_thunk_re)" \ ".*${decimal}.*myglob.*; return 0;" -# Have to be careful here, if the finish does not work, +# Have to be careful here, if the finish does not work, # then we may run to the end of the program, which # will cause erroneous failures in the rest of the tests set test "stepi: finish call" @@ -143,7 +143,7 @@ gdb_test_multiple "finish" "$test" { pass "$test" } -re ".*(Program received|$inferior_exited_re).*$gdb_prompt $" { - # Oops... We ran to the end of the program... Better reset + # Oops... We ran to the end of the program... Better reset if {![runto_main]} { return 0 } diff --git a/gdb/testsuite/gdb.base/structs.exp b/gdb/testsuite/gdb.base/structs.exp index fa7f786..4850a59 100644 --- a/gdb/testsuite/gdb.base/structs.exp +++ b/gdb/testsuite/gdb.base/structs.exp @@ -75,7 +75,7 @@ proc start_structs_test { types } { get_debug_format # Limit the slow $anychar_re{256} matching for better performance. - if $first { + if {$first} { set first 0 # Verify $anychar_re can match all the values of `char' type. @@ -215,7 +215,7 @@ proc test_struct_calls { n } { # Check that GDB can always extract a struct-return value from an # inferior function call. Since GDB always knows the location of an # inferior function call's return value these should never fail - + # Implemented by calling the parameterless function "fun$N" and then # examining the return value printed by GDB. @@ -364,7 +364,7 @@ proc test_struct_returns { n } { pass "${test}" } -re " = [any $n].*${gdb_prompt} $" { - if $return_value_known { + if {$return_value_known} { # This contradicts the above claim that GDB knew # the location of the return value. fail "${test}" @@ -375,7 +375,7 @@ proc test_struct_returns { n } { } } -re ".*${gdb_prompt} $" { - if $return_value_unimplemented { + if {$return_value_unimplemented} { # What a surprise. The architecture hasn't implemented # return_value, and hence has to fail. kfail "$test" gdb/1444 @@ -383,8 +383,8 @@ proc test_struct_returns { n } { fail "$test" } } - } - + } + # Check that a "finish" works. # This is almost but not quite the same as "call struct funcs". @@ -425,7 +425,7 @@ proc test_struct_returns { n } { set test "value foo<n> finished; ${tests}" gdb_test_multiple "p/c" "${test}" { -re "[foo ${n}]\[\r\n\]+${gdb_prompt} $" { - if $finish_value_known { + if {$finish_value_known} { pass "${test}" } else { # This contradicts the above claim that GDB didn't @@ -435,7 +435,7 @@ proc test_struct_returns { n } { } -re "[zed ${n}]\[\r\n\]+${gdb_prompt} $" { # The value didn't get found. This is "expected". - if $finish_value_known { + if {$finish_value_known} { # This contradicts the above claim that GDB did # know the location of the return-value. fail "${test}" diff --git a/gdb/testsuite/gdb.base/structs2.exp b/gdb/testsuite/gdb.base/structs2.exp index f377022..f0e8342 100644 --- a/gdb/testsuite/gdb.base/structs2.exp +++ b/gdb/testsuite/gdb.base/structs2.exp @@ -31,14 +31,14 @@ gdb_test "break param_reg" \ "Breakpoint .* at .*" \ "structs2 breakpoint set" -if [test_compiler_info gcc-3-*] { +if {[test_compiler_info gcc-3-*]} { setup_xfail hppa*-* gcc/15860 } gdb_test "continue" \ ".*pr_char=120.*pr_uchar=130.*pr_short=32000.*pr_ushort=33000.*bkpt = 1.*" \ "structs2 continue1" -if [test_compiler_info gcc-3-*] { +if {[test_compiler_info gcc-3-*]} { setup_xfail hppa*-* gcc/15860 } gdb_test "continue" \ diff --git a/gdb/testsuite/gdb.base/structs3.exp b/gdb/testsuite/gdb.base/structs3.exp index 6ac450f..22cda9d 100644 --- a/gdb/testsuite/gdb.base/structs3.exp +++ b/gdb/testsuite/gdb.base/structs3.exp @@ -21,7 +21,7 @@ if { [prepare_for_testing "failed to prepare" "structs3" "" {debug}] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/style.exp b/gdb/testsuite/gdb.base/style.exp index 92b5085..222f17e 100644 --- a/gdb/testsuite/gdb.base/style.exp +++ b/gdb/testsuite/gdb.base/style.exp @@ -163,7 +163,7 @@ proc run_style_tests { } { # - 4 leading spaces # - argv string # - closing parenthesis - set line_len [expr 4 + $argv_len + 1] + set line_len [expr {4 + $argv_len + 1}] if { $argv == "argv=0x0" && $width >= 27 } { # Embedded target with no argv support. @@ -847,14 +847,14 @@ proc previous_line_is_ok { str } { # Then compare string lengths to get a count of the '\033' # charactes present in STR. regsub -all "\033" $str {} stripped - set count [expr [string length $str] - [string length $stripped]] + set count [expr {[string length $str] - [string length $stripped]}] # If STR switched styles, then it _must_ switch back again, # otherwise the pagination prompt will be in the wrong style. # This means that there _must_ be an even number of '\033' # characters in STR. If there is not then we switched style, but # failed to switch back. - if { [expr $count % 2] != 0 } { + if {$count % 2 != 0} { return false } diff --git a/gdb/testsuite/gdb.base/symbol-alias.exp b/gdb/testsuite/gdb.base/symbol-alias.exp index c3deaf6..84ba82d 100644 --- a/gdb/testsuite/gdb.base/symbol-alias.exp +++ b/gdb/testsuite/gdb.base/symbol-alias.exp @@ -16,8 +16,8 @@ standard_testfile symbol-alias.c symbol-alias2.c # Clang versions prior to v15 do not emit debug info for aliases. -set old_clang [expr [test_compiler_info {clang-1[0-4]-*-*}] \ - || [test_compiler_info {clang-[1-9]-*}]] +set old_clang [expr {[test_compiler_info {clang-1[0-4]-*-*}] \ + || [test_compiler_info {clang-[1-9]-*}]}] if { [prepare_for_testing "failed to prepare" ${testfile} [list $srcfile $srcfile2]] } { return -1 diff --git a/gdb/testsuite/gdb.base/symtab-search-order.exp b/gdb/testsuite/gdb.base/symtab-search-order.exp index 34b1db0..aca9ca1 100644 --- a/gdb/testsuite/gdb.base/symtab-search-order.exp +++ b/gdb/testsuite/gdb.base/symtab-search-order.exp @@ -37,7 +37,7 @@ clean_restart gdb_load $binfile gdb_load_shlib $lib1 -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/testenv.exp b/gdb/testsuite/gdb.base/testenv.exp index 59cd33c..540a48f 100644 --- a/gdb/testsuite/gdb.base/testenv.exp +++ b/gdb/testsuite/gdb.base/testenv.exp @@ -75,7 +75,7 @@ proc find_env {varname} { } if {[string match "$varname=*" $var]} { - set from [expr [string first "=" $var] + 1] + set from [expr {[string first "=" $var] + 1}] set to [string length $var] return [string range $var $from $to] } @@ -95,7 +95,7 @@ proc_with_prefix test_set_unset_env {} { # First test with no TEST_GDB_VAR. with_test_prefix "test1" { - if ![run_and_count_vars] { + if {![run_and_count_vars]} { return } test_num_test_vars 0 "no TEST_GDB vars" @@ -106,7 +106,7 @@ proc_with_prefix test_set_unset_env {} { gdb_test_no_output "set env TEST_GDB_VAR1 test1" \ "set TEST_GDB_VAR1" - if ![run_and_count_vars] { + if {![run_and_count_vars]} { return } test_num_test_vars 1 "one TEST_GDB var" @@ -117,7 +117,7 @@ proc_with_prefix test_set_unset_env {} { gdb_test_no_output "set env TEST_GDB_VAR2 test2" \ "set TEST_GDB_VAR2" - if ![run_and_count_vars] { + if {![run_and_count_vars]} { return } @@ -130,7 +130,7 @@ proc_with_prefix test_set_unset_env {} { gdb_test_no_output "unset env TEST_GDB_VAR1" \ "unset TEST_GDB_VAR1" - if ![run_and_count_vars] { + if {![run_and_count_vars]} { return } @@ -145,7 +145,7 @@ proc_with_prefix test_inherit_env_var {} { # This test assumes that the build's environ (where dejagnu runs) # is the same as the host's (where gdb runs) environ. - if [is_remote host] { + if {[is_remote host]} { return } @@ -159,7 +159,7 @@ proc_with_prefix test_inherit_env_var {} { # First test with only inherited TEST_GDB_GLOBAL. with_test_prefix "test1" { - if ![run_and_count_vars] { + if {![run_and_count_vars]} { return } @@ -179,7 +179,7 @@ proc_with_prefix test_inherit_env_var {} { gdb_test_no_output "unset env TEST_GDB_GLOBAL" \ "unset TEST_GDB_GLOBAL" - if ![run_and_count_vars] { + if {![run_and_count_vars]} { return } diff --git a/gdb/testsuite/gdb.base/tls-common.exp.tcl b/gdb/testsuite/gdb.base/tls-common.exp.tcl index fc212a9..a17409f 100644 --- a/gdb/testsuite/gdb.base/tls-common.exp.tcl +++ b/gdb/testsuite/gdb.base/tls-common.exp.tcl @@ -33,7 +33,7 @@ set internal_tls_linux_targets {"x86_64-*-linux*" "aarch64-*-linux*" # use of internal TLS support for architectures which don't support # it. -if [is_any_target {*}$internal_tls_linux_targets] { +if {[is_any_target {*}$internal_tls_linux_targets]} { set internal_tls_iters { false true } } else { set internal_tls_iters { false } @@ -43,7 +43,7 @@ if [is_any_target {*}$internal_tls_linux_targets] { # issue gdb_test with command CMD and regular expression RE. proc gdb_test_with_kfail {cmd re kfail_cond kfail_msg} { - if [uplevel 1 [list expr $kfail_cond]] { + if {[uplevel 1 [list expr $kfail_cond]]} { setup_kfail $kfail_msg *-*-* } gdb_test $cmd $re diff --git a/gdb/testsuite/gdb.base/tls-dlobj.exp b/gdb/testsuite/gdb.base/tls-dlobj.exp index 1509ec8..9b70799 100644 --- a/gdb/testsuite/gdb.base/tls-dlobj.exp +++ b/gdb/testsuite/gdb.base/tls-dlobj.exp @@ -46,7 +46,7 @@ proc gdb_test_with_xfail { cmd re cond} { pass $gdb_test_name } -re -wrap "The inferior has not yet allocated storage for thread-local variables.*" { - if [ uplevel 1 [list expr $cond]] { + if {[ uplevel 1 [list expr $cond]]} { xfail $gdb_test_name } else { fail $gdb_test_name @@ -58,11 +58,11 @@ proc gdb_test_with_xfail { cmd re cond} { proc do_tests {force_internal_tls} { clean_restart gdb_load $::binfile - if ![runto_main] { + if {![runto_main]} { return } - if $force_internal_tls { + if {$force_internal_tls} { gdb_test_no_output "maint set force-internal-tls-address-lookup on" } @@ -285,7 +285,7 @@ proc do_tests {force_internal_tls} { } # Finish test early if no core file was made. - if !$core_supported { + if {!$core_supported} { return } @@ -298,7 +298,7 @@ proc do_tests {force_internal_tls} { } with_test_prefix "core file" { - if $force_internal_tls { + if {$force_internal_tls} { gdb_test_no_output "maint set force-internal-tls-address-lookup on" } diff --git a/gdb/testsuite/gdb.base/tls-multiobj.exp b/gdb/testsuite/gdb.base/tls-multiobj.exp index eb3721e..14bbfc9 100644 --- a/gdb/testsuite/gdb.base/tls-multiobj.exp +++ b/gdb/testsuite/gdb.base/tls-multiobj.exp @@ -28,11 +28,11 @@ set lib3obj [standard_output_file "${testfile}3-lib.so"] proc do_tests {force_internal_tls {do_kfail_tls_access 0}} { clean_restart gdb_load $::binfile - if ![runto_main] { + if {![runto_main]} { return } - if $force_internal_tls { + if {$force_internal_tls} { gdb_test_no_output "maint set force-internal-tls-address-lookup on" } @@ -52,7 +52,7 @@ proc do_tests {force_internal_tls {do_kfail_tls_access 0}} { # Also turn off do_kfail_tls_access when connected to a # gdbserver and we observe that accessing a TLS variable # works. - if [target_is_gdbserver] { + if {[target_is_gdbserver]} { gdb_test_multiple "print tls_main_tbss_1" \ "Check TLS accessibility when connected to a gdbserver" { -re -wrap "= 0" { @@ -125,7 +125,7 @@ proc do_tests {force_internal_tls {do_kfail_tls_access 0}} { } # Finish test early if no core file was made. - if !$core_supported { + if {!$core_supported} { return } @@ -138,7 +138,7 @@ proc do_tests {force_internal_tls {do_kfail_tls_access 0}} { } with_test_prefix "core file" { - if $force_internal_tls { + if {$force_internal_tls} { gdb_test_no_output "maint set force-internal-tls-address-lookup on" } diff --git a/gdb/testsuite/gdb.base/tls-nothreads.exp b/gdb/testsuite/gdb.base/tls-nothreads.exp index c7b1476..fe3ce80 100644 --- a/gdb/testsuite/gdb.base/tls-nothreads.exp +++ b/gdb/testsuite/gdb.base/tls-nothreads.exp @@ -20,11 +20,11 @@ standard_testfile proc do_tests {force_internal_tls {do_kfail_tls_access 0}} { clean_restart gdb_load $::binfile - if ![runto_main] { + if {![runto_main]} { return } - if $force_internal_tls { + if {$force_internal_tls} { gdb_test_no_output "maint set force-internal-tls-address-lookup on" } @@ -44,7 +44,7 @@ proc do_tests {force_internal_tls {do_kfail_tls_access 0}} { # Also turn off do_kfail_tls_access when connected to a # gdbserver and we observe that accessing a TLS variable # works. - if [target_is_gdbserver] { + if {[target_is_gdbserver]} { gdb_test_multiple "print tls_tbss_1" "Check TLS accessibility when connected to a gdbserver" { -re -wrap "= 0" { set do_kfail_tls_access 0 @@ -105,14 +105,14 @@ proc do_tests {force_internal_tls {do_kfail_tls_access 0}} { set binfile_stripped "${::binfile}.stripped" set objcopy [gdb_find_objcopy] set cmd "$objcopy --strip-debug ${::binfile} $binfile_stripped" - if ![catch "exec $cmd" cmd_output] { + if {![catch {exec {*}$cmd} cmd_output]} { clean_restart gdb_load $binfile_stripped - if ![runto_main] { + if {![runto_main]} { return } - if $force_internal_tls { + if {$force_internal_tls} { gdb_test_no_output "maint set force-internal-tls-address-lookup on" } @@ -153,7 +153,7 @@ proc do_tests {force_internal_tls {do_kfail_tls_access 0}} { } # Finish test early if no core file was made. - if !$core_supported { + if {!$core_supported} { return } @@ -166,7 +166,7 @@ proc do_tests {force_internal_tls {do_kfail_tls_access 0}} { } with_test_prefix "core file" { - if $force_internal_tls { + if {$force_internal_tls} { gdb_test_no_output "maint set force-internal-tls-address-lookup on" } diff --git a/gdb/testsuite/gdb.base/twice.exp b/gdb/testsuite/gdb.base/twice.exp index 995cd4d..83d271d 100644 --- a/gdb/testsuite/gdb.base/twice.exp +++ b/gdb/testsuite/gdb.base/twice.exp @@ -48,4 +48,4 @@ if {[runto_main]} { gdb_test "step" "nothing \\(\\) at.*" } -remote_exec build "rm -f twice.c" +remote_exec build "rm -f twice.c" diff --git a/gdb/testsuite/gdb.base/ui-redirect.exp b/gdb/testsuite/gdb.base/ui-redirect.exp index 24742b8..c758697 100644 --- a/gdb/testsuite/gdb.base/ui-redirect.exp +++ b/gdb/testsuite/gdb.base/ui-redirect.exp @@ -20,7 +20,7 @@ if { [prepare_for_testing "failed to prepare" ui-redirect start.c] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/until-nodebug.exp b/gdb/testsuite/gdb.base/until-nodebug.exp index 9d8d097..bd327a10 100644 --- a/gdb/testsuite/gdb.base/until-nodebug.exp +++ b/gdb/testsuite/gdb.base/until-nodebug.exp @@ -22,7 +22,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile nodebug]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return 0 } diff --git a/gdb/testsuite/gdb.base/until-trailing-insns.exp b/gdb/testsuite/gdb.base/until-trailing-insns.exp index cc28adc..4456812 100644 --- a/gdb/testsuite/gdb.base/until-trailing-insns.exp +++ b/gdb/testsuite/gdb.base/until-trailing-insns.exp @@ -160,7 +160,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/unwind-on-each-insn-amd64-2.exp b/gdb/testsuite/gdb.base/unwind-on-each-insn-amd64-2.exp index 51601f9..0e307d3 100644 --- a/gdb/testsuite/gdb.base/unwind-on-each-insn-amd64-2.exp +++ b/gdb/testsuite/gdb.base/unwind-on-each-insn-amd64-2.exp @@ -27,7 +27,7 @@ lappend srcfile_flags nopie set ldflags $srcfile_flags -if [info exists COMPILE] { +if {[info exists COMPILE]} { # Make sure that we use .eh_frame info, by generating it # using -fasynchronous-unwind-tables. if { [gdb_can_simple_compile fasynchronous-unwind-tables \ diff --git a/gdb/testsuite/gdb.base/unwind-on-each-insn-amd64.exp b/gdb/testsuite/gdb.base/unwind-on-each-insn-amd64.exp index c874930..08944f9 100644 --- a/gdb/testsuite/gdb.base/unwind-on-each-insn-amd64.exp +++ b/gdb/testsuite/gdb.base/unwind-on-each-insn-amd64.exp @@ -24,7 +24,7 @@ lappend srcfile_flags nopie set srcfile2_flags $srcfile_flags set ldflags $srcfile_flags -if [info exists COMPILE] { +if {[info exists COMPILE]} { standard_testfile unwind-on-each-insn.c unwind-on-each-insn-foo.c # When updating the .s file, use these flags to generate the file: #lappend srcfile2_flags additional_flags=-save-temps diff --git a/gdb/testsuite/gdb.base/unwind-on-each-insn-i386.exp b/gdb/testsuite/gdb.base/unwind-on-each-insn-i386.exp index ad3b702..0285c54 100644 --- a/gdb/testsuite/gdb.base/unwind-on-each-insn-i386.exp +++ b/gdb/testsuite/gdb.base/unwind-on-each-insn-i386.exp @@ -24,7 +24,7 @@ lappend srcfile_flags nopie set srcfile2_flags $srcfile_flags set ldflags $srcfile_flags -if [info exists COMPILE] { +if {[info exists COMPILE]} { standard_testfile unwind-on-each-insn.c unwind-on-each-insn-foo.c # When updating the .s file, use these flags to generate the file: #lappend srcfile2_flags additional_flags=-save-temps diff --git a/gdb/testsuite/gdb.base/utf8-identifiers.exp b/gdb/testsuite/gdb.base/utf8-identifiers.exp index fe868e5..8d19dbc 100644 --- a/gdb/testsuite/gdb.base/utf8-identifiers.exp +++ b/gdb/testsuite/gdb.base/utf8-identifiers.exp @@ -23,7 +23,7 @@ load_lib completion-support.exp if { [is_c_compiler_gcc] } { # Gcc fully supports fextended-identifiers starting GCC 5. - require {expr [gcc_major_version] >= 5} + require {expr {[gcc_major_version] >= 5}} } require {have_host_locale C.UTF-8} @@ -36,7 +36,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} [list $srcfile]] } { return -1 } -if ![runto done] { +if {![runto done]} { return } diff --git a/gdb/testsuite/gdb.base/valgrind-infcall.exp b/gdb/testsuite/gdb.base/valgrind-infcall.exp index 11cd49d..3b06c1d 100644 --- a/gdb/testsuite/gdb.base/valgrind-infcall.exp +++ b/gdb/testsuite/gdb.base/valgrind-infcall.exp @@ -54,7 +54,7 @@ while {$loop && $continue_count < 100} { pass "$test (false warning)" } } - set continue_count [expr $continue_count + 1] + set continue_count [expr {$continue_count + 1}] } set test "p gdb_test_infcall ()" diff --git a/gdb/testsuite/gdb.base/value-double-free.exp b/gdb/testsuite/gdb.base/value-double-free.exp index c3fbbb6..8395b97 100644 --- a/gdb/testsuite/gdb.base/value-double-free.exp +++ b/gdb/testsuite/gdb.base/value-double-free.exp @@ -27,7 +27,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/value-history-unavailable.exp b/gdb/testsuite/gdb.base/value-history-unavailable.exp index b17764e..6794953 100644 --- a/gdb/testsuite/gdb.base/value-history-unavailable.exp +++ b/gdb/testsuite/gdb.base/value-history-unavailable.exp @@ -27,11 +27,11 @@ if {![runto_main]} { set target_char_mask [get_valueof "/u" "a.x\[0]" "255" "get target char mask"] set target_char_bit 0 -for {set i $target_char_mask} {$i > 0} {set i [expr $i >> 1]} { +for {set i $target_char_mask} {$i > 0} {set i [expr {$i >> 1}]} { incr target_char_bit } set target_char_rank -1 -for {set i $target_char_bit} {$i > 0} {set i [expr $i >> 1]} { +for {set i $target_char_bit} {$i > 0} {set i [expr {$i >> 1}]} { incr target_char_rank } diff --git a/gdb/testsuite/gdb.base/varargs.exp b/gdb/testsuite/gdb.base/varargs.exp index 534971c..d25ae26 100644 --- a/gdb/testsuite/gdb.base/varargs.exp +++ b/gdb/testsuite/gdb.base/varargs.exp @@ -36,7 +36,7 @@ set allow_float_test [allow_float_test] set flags {} lappend flags debug lappend_include_file flags $srcdir/lib/unbuffer_output.c -if [support_complex_tests] { +if {[support_complex_tests]} { lappend flags "additional_flags=-DTEST_COMPLEX" } @@ -56,7 +56,7 @@ gdb_test_no_output "set print address off" gdb_test_no_output "set width 0" -if [gdb_skip_stdio_test "varargs.exp"] { +if {[gdb_skip_stdio_test "varargs.exp"]} { # Nothing in this module is testable without printf. return } @@ -93,7 +93,7 @@ if {$allow_float_test} { # Test _Complex type here if supported. -if [support_complex_tests] { +if {[support_complex_tests]} { global gdb_prompt set test "print find_max_float_real(4, fc1, fc2, fc3, fc4)" diff --git a/gdb/testsuite/gdb.base/vla-datatypes.exp b/gdb/testsuite/gdb.base/vla-datatypes.exp index 4a08de3..a116123 100644 --- a/gdb/testsuite/gdb.base/vla-datatypes.exp +++ b/gdb/testsuite/gdb.base/vla-datatypes.exp @@ -19,7 +19,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/vla-optimized-out.exp b/gdb/testsuite/gdb.base/vla-optimized-out.exp index 3119097..316043d 100644 --- a/gdb/testsuite/gdb.base/vla-optimized-out.exp +++ b/gdb/testsuite/gdb.base/vla-optimized-out.exp @@ -33,7 +33,7 @@ proc vla_optimized_out {exe_suffix options} { return -1 } - if ![runto f1] { + if {![runto f1]} { return } diff --git a/gdb/testsuite/gdb.base/vla-ptr.exp b/gdb/testsuite/gdb.base/vla-ptr.exp index 6db0b9a..22ac0a3 100644 --- a/gdb/testsuite/gdb.base/vla-ptr.exp +++ b/gdb/testsuite/gdb.base/vla-ptr.exp @@ -20,7 +20,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/vla-sideeffect.exp b/gdb/testsuite/gdb.base/vla-sideeffect.exp index 942d111..158ae35 100644 --- a/gdb/testsuite/gdb.base/vla-sideeffect.exp +++ b/gdb/testsuite/gdb.base/vla-sideeffect.exp @@ -22,7 +22,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } @@ -31,7 +31,8 @@ gdb_continue_to_breakpoint "vla-filled" # Check side effects for sizeof argument. set sizeof_int [get_sizeof "int" 4] -set sizeof_vla [ expr "10" * "$sizeof_int" ] + +set sizeof_vla [expr {10 * $sizeof_int}] gdb_test "print sizeof (vla1\[i++\])" " = ${sizeof_int}" gdb_test "print i" " = 0" \ diff --git a/gdb/testsuite/gdb.base/vla-struct-fields.exp b/gdb/testsuite/gdb.base/vla-struct-fields.exp index 68f9269..72af212 100644 --- a/gdb/testsuite/gdb.base/vla-struct-fields.exp +++ b/gdb/testsuite/gdb.base/vla-struct-fields.exp @@ -22,7 +22,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/volatile.exp b/gdb/testsuite/gdb.base/volatile.exp index 35aa1cf..e85d415 100644 --- a/gdb/testsuite/gdb.base/volatile.exp +++ b/gdb/testsuite/gdb.base/volatile.exp @@ -27,7 +27,7 @@ # const volatile pointers to const vars # const volatile pointers to volatile vars # ... etc. (you get the idea) -# Mostly with char and unsigned char. +# Mostly with char and unsigned char. # # test running programs @@ -54,7 +54,7 @@ proc local_compiler_xfail_check { } { if {[test_compiler_info gcc-2-*]} { if { ![test_debug_format "HP"] \ && ![test_debug_format "DWARF \[0-9\]"] } then { - setup_xfail "*-*-*" + setup_xfail "*-*-*" } } } diff --git a/gdb/testsuite/gdb.base/watchpoint-cond-gone.exp b/gdb/testsuite/gdb.base/watchpoint-cond-gone.exp index 21b60fc..c789c60 100644 --- a/gdb/testsuite/gdb.base/watchpoint-cond-gone.exp +++ b/gdb/testsuite/gdb.base/watchpoint-cond-gone.exp @@ -27,7 +27,7 @@ if {[prepare_for_testing_full "failed to prepare" \ # Problem does not occur otherwise. gdb_test_no_output "set can-use-hw-watchpoints 0" -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/watchpoint-delete.exp b/gdb/testsuite/gdb.base/watchpoint-delete.exp index 3013b70..cdf532f 100644 --- a/gdb/testsuite/gdb.base/watchpoint-delete.exp +++ b/gdb/testsuite/gdb.base/watchpoint-delete.exp @@ -22,7 +22,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { # It is more compatible this way. gdb_test_no_output "set can-use-hw-watchpoints 0" -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/watchpoint-hw-hit-once.exp b/gdb/testsuite/gdb.base/watchpoint-hw-hit-once.exp index ba60c90..906654e 100644 --- a/gdb/testsuite/gdb.base/watchpoint-hw-hit-once.exp +++ b/gdb/testsuite/gdb.base/watchpoint-hw-hit-once.exp @@ -21,7 +21,7 @@ if { [prepare_for_testing "failed to prepare" ${test} ${srcfile}] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp b/gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp index 994228f..23ef746 100644 --- a/gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp +++ b/gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp @@ -158,7 +158,7 @@ proc valid_addr_p {cmd offset width} { # registers to represent the whole unaligned region. Breakpoint # addresses must still be aligned though. if {$cmd == "hbreak" } { - if { [expr ($offset) % 4] != 0 } { + if {$offset % 4 != 0} { return 0 } } @@ -170,20 +170,20 @@ proc valid_addr_p {cmd offset width} { } } else { # Watchpoints can be of length 1, 2, 4 or 8 bytes. - if { [expr $width % 2] != 0 } { + if { $width % 2 != 0 } { return 0 } } - if { [expr ($offset) % 8] == 0 && $width == 8 } { + if {$offset % 8 == 0 && $width == 8} { # If WIDTH is 8 byte, the address should be 8-byte aligned. return 1 - } elseif { [expr ($offset) % 4] == 0 } { + } elseif {$offset % 4 == 0} { return 1 - } elseif { [expr ($offset) % 4] == 2 && $width == 2 } { + } elseif {$offset % 4 == 2 && $width == 2} { # Halfword watchpoints and breakpoints. return 1 - } elseif { [expr ($offset) % 4] == 1 && $width == 1 && $cmd != "hbreak" } { + } elseif {$offset % 4 == 1 && $width == 1 && $cmd != "hbreak"} { # Single byte watchpoints. return 1 } else { @@ -249,7 +249,7 @@ proc run_watchpoints_tests {hw_wp_p} { for {set x 0} {$x < 4} {incr x} { if { ![valid_addr_p $cmd1 $x $width] - || ![valid_addr_p $cmd2 $x+1 $width] } { + || ![valid_addr_p $cmd2 [expr {$x+1}] $width] } { # Skip tests if requested address or length # of breakpoint or watchpoint don't meet # target or kernel requirements. diff --git a/gdb/testsuite/gdb.base/watchpoint-running.exp b/gdb/testsuite/gdb.base/watchpoint-running.exp index 04c4c52..61c1f8c 100644 --- a/gdb/testsuite/gdb.base/watchpoint-running.exp +++ b/gdb/testsuite/gdb.base/watchpoint-running.exp @@ -22,7 +22,7 @@ set allow_hw_watchpoint_tests_p [allow_hw_watchpoint_tests] standard_testfile -if [build_executable "failed to prepare" $testfile $srcfile {debug}] { +if {[build_executable "failed to prepare" $testfile $srcfile {debug}]} { return -1 } @@ -87,7 +87,7 @@ proc test {stop_mode hw} { # sufficient time to ever wrap around.) gdb_assert {$val1 != $val2} "values are different" - set wp_str [expr ($hw)?"Hardware watchpoint":"Watchpoint"] + set wp_str [expr {($hw)?"Hardware watchpoint":"Watchpoint"}] # Now set a watchpoint, while the inferior is running. Since # we're watching a global, and we can read global memory while the @@ -130,7 +130,7 @@ foreach hw {0 1} { continue } foreach stop_mode {all-stop non-stop} { - set wp_type [expr ($hw)?"hardware":"software"] + set wp_type [expr {($hw)?"hardware":"software"}] with_test_prefix "$stop_mode: $wp_type" { test $stop_mode $hw } diff --git a/gdb/testsuite/gdb.base/watchpoint-unaligned.exp b/gdb/testsuite/gdb.base/watchpoint-unaligned.exp index 85b1eb7..13dcfba 100644 --- a/gdb/testsuite/gdb.base/watchpoint-unaligned.exp +++ b/gdb/testsuite/gdb.base/watchpoint-unaligned.exp @@ -24,7 +24,7 @@ if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } @@ -43,14 +43,14 @@ if {[istarget "s390*-*-*"]} { foreach wpsize $sizes { for {set wpoffset 0} {$wpoffset < 8 / $wpsize} {incr wpoffset} { - set wpstart [expr $wpoffset * $wpsize] - set wpend [expr ($wpoffset + 1) * $wpsize] + set wpstart [expr {$wpoffset * $wpsize}] + set wpend [expr {($wpoffset + 1) * $wpsize}] set wpendaligned $alignedend($wpend) foreach rdsize $sizes { for {set rdoffset 0} {$rdoffset < 8 / $rdsize} {incr rdoffset} { - set rdstart [expr $rdoffset * $rdsize] - set rdend [expr ($rdoffset + 1) * $rdsize] - set expect_hit [expr max ($wpstart, $rdstart) < min ($wpend, $rdend)] + set rdstart [expr {$rdoffset * $rdsize}] + set rdend [expr {($rdoffset + 1) * $rdsize}] + set expect_hit [expr {max ($wpstart, $rdstart) < min ($wpend, $rdend)}] set test "$rwatch data.u.size$wpsize\[$wpoffset\]" set wpnum "" gdb_test_multiple $test $test { @@ -88,7 +88,7 @@ foreach wpsize $sizes { if {$expect_hit == 0 && $rdstart < $wpendaligned} { setup_xfail external/20207 "aarch64*-*-linux*" } - if {!$expect_hit && [expr max ($wpstart / 8, $rdstart / 8) < min (($wpend + 7) / 8, ($rdend + 7) / 8)]} { + if {!$expect_hit && max ($wpstart / 8, $rdstart / 8) < min (($wpend + 7) / 8, ($rdend + 7) / 8)} { setup_xfail breakpoints/23131 "powerpc*-*-*" } fail $test @@ -139,7 +139,7 @@ foreach_with_prefix wpcount {4 7} { } } set test "wpcount($wpcount)" - if {!$wpoffset_to_wpnum([expr $wpcount - 1])} { + if {!$wpoffset_to_wpnum([expr {$wpcount - 1}])} { untested $test continue } @@ -168,7 +168,7 @@ proc size8twice { function cmd offset index } { "Breakpoint $::decimal at $::hex" "$bp_src_string" # Set a hardware watchpoint. - set watch_index [expr $offset + $index] + set watch_index [expr {$offset + $index}] set test "$cmd data.u.size8twice\[$watch_index\]" set wpnum 0 gdb_test_multiple $test "" { diff --git a/gdb/testsuite/gdb.base/watchpoint.exp b/gdb/testsuite/gdb.base/watchpoint.exp index fba8ac6..7a5a96a 100644 --- a/gdb/testsuite/gdb.base/watchpoint.exp +++ b/gdb/testsuite/gdb.base/watchpoint.exp @@ -55,23 +55,23 @@ proc initialize {} { global decimal global srcfile - if [gdb_test "break marker1" "Breakpoint 1 at $hex: file .*$srcfile, line $decimal.*" "set breakpoint at marker1" ] { + if {[gdb_test "break marker1" "Breakpoint 1 at $hex: file .*$srcfile, line $decimal.*" "set breakpoint at marker1" ]} { return 0 } - if [gdb_test "break marker2" "Breakpoint 2 at $hex: file .*$srcfile, line $decimal.*" "set breakpoint at marker2" ] { + if {[gdb_test "break marker2" "Breakpoint 2 at $hex: file .*$srcfile, line $decimal.*" "set breakpoint at marker2" ]} { return 0 } - if [gdb_test "info break" "1\[ \]*breakpoint.*marker1.*\r\n2\[ \]*breakpoint.*marker2.*" "info break" ] { + if {[gdb_test "info break" "1\[ \]*breakpoint.*marker1.*\r\n2\[ \]*breakpoint.*marker2.*" "info break" ]} { return 0 } gdb_test "watch ival3" ".*\[Ww\]atchpoint 3: ival3.*" "set watchpoint on ival3" - if [gdb_test "info watch" "3\[ \]*.*watchpoint.*ival3" "watchpoint found in watchpoint/breakpoint table" ] { + if {[gdb_test "info watch" "3\[ \]*.*watchpoint.*ival3" "watchpoint found in watchpoint/breakpoint table" ]} { return 0 } @@ -80,7 +80,7 @@ proc initialize {} { # to use it. This allows the test program to run at full speed until # we get to the first marker function. - if [gdb_test_no_output "disable 3" "disable watchpoint" ] { + if {[gdb_test_no_output "disable 3" "disable watchpoint" ]} { return 0 } @@ -99,8 +99,8 @@ proc test_simple_watchpoint {} { # Ensure that the watchpoint is disabled when we startup. - if [gdb_test_no_output "disable 3" \ - "disable watchpoint in test_simple_watchpoint" ] { + if {[gdb_test_no_output "disable 3" \ + "disable watchpoint in test_simple_watchpoint" ]} { return 0 } @@ -121,7 +121,7 @@ proc test_simple_watchpoint {} { # After reaching the marker function, enable the watchpoint. - if [gdb_test_no_output "enable 3" "enable watchpoint" ] { + if {[gdb_test_no_output "enable 3" "enable watchpoint" ]} { return } @@ -165,7 +165,7 @@ Continuing.*\[Ww\]atchpoint.*ival3.*Old value = -1.*New value = 0.*ival3 = count # Check that the hit count is reported correctly gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival3\r\n\[ \t]+breakpoint already hit 3 times.*" "watchpoint hit count is 3" - + # Continue until the next change, from 2 to 3. gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 2.*New value = 3.*ival3 = count; ival4 = count;.*" "watchpoint hit, fourth time" @@ -188,14 +188,14 @@ Continuing.*\[Ww\]atchpoint.*ival3.*Old value = -1.*New value = 0.*ival3 = count # Disable the watchpoint so we run at full speed until we exit. - if [gdb_test_no_output "disable 3" "watchpoint disabled" ] { + if {[gdb_test_no_output "disable 3" "watchpoint disabled" ]} { return } # Run until process exits. - if [target_info exists gdb,noresults] { return } + if {[target_info exists gdb,noresults]} { return } gdb_continue_to_end "continue to exit in test_simple_watchpoint" } @@ -213,8 +213,8 @@ proc test_disabling_watchpoints {} { # Ensure that the watchpoint is disabled when we startup. - if [gdb_test_no_output "disable 3" \ - "disable watchpoint in test_disabling_watchpoints" ] { + if {[gdb_test_no_output "disable 3" \ + "disable watchpoint in test_disabling_watchpoints" ]} { return 0 } @@ -236,7 +236,7 @@ proc test_disabling_watchpoints {} { # After reaching the marker function, enable the watchpoint. - if [gdb_test_no_output "enable 3" "watchpoint enabled" ] { + if {[gdb_test_no_output "enable 3" "watchpoint enabled" ]} { return } @@ -245,14 +245,14 @@ proc test_disabling_watchpoints {} { # Don't check the old value, because on VxWorks the variable value # will not have been reinitialized. gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = .*New value = 0.*ival3 = count; ival4 = count;.*" "watchpoint hit in test_disabling_watchpoints, first time" - + # Continue until the next change, from 0 to 1. gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 0.*New value = 1.*ival3 = count; ival4 = count;.*" "watchpoint hit in test_disabling_watchpoints, second time" - + # Disable the watchpoint but leave breakpoints - if [gdb_test_no_output "disable 3" \ - "disable watchpoint #2 in test_disabling_watchpoints" ] { + if {[gdb_test_no_output "disable 3" \ + "disable watchpoint #2 in test_disabling_watchpoints" ]} { return 0 } @@ -265,8 +265,8 @@ proc test_disabling_watchpoints {} { # Make sure we hit no more watchpoints. gdb_test "cont" "Continuing.*Breakpoint.*marker2 \\(\\).*" \ "disabled watchpoint skipped" - - if [target_info exists gdb,noresults] { return } + + if {[target_info exists gdb,noresults]} { return } gdb_continue_to_end "continue to exit in test_disabling_watchpoints" } @@ -286,7 +286,7 @@ proc test_stepping {} { gdb_test "p func1 ()" "= 73" \ "calling function with watchpoint enabled" - # + # # "finish" brings us back to main. # On some targets (e.g. alpha) gdb will stop from the finish in midline # of the marker1 call. This is due to register restoring code on @@ -357,7 +357,7 @@ proc test_watchpoint_triggered_in_syscall {} { global gdb_prompt # These tests won't work without printf support. - if [gdb_skip_stdio_test "watchpoints triggered in syscall"] { + if {[gdb_skip_stdio_test "watchpoints triggered in syscall"]} { return } # Run until we get to the first marker function. @@ -391,10 +391,10 @@ proc test_watchpoint_triggered_in_syscall {} { set test "sent 123" gdb_test_multiple "123" $test { - -re ".*\[Ww\]atchpoint.*buf\\\[0\\\].*Old value = 0.*New value = 49\[^\n\]*\n" { set x [expr $x+1] ; exp_continue } - -re ".*\[Ww\]atchpoint.*buf\\\[1\\\].*Old value = 0.*New value = 50\[^\n\]*\n" { set x [expr $x+1] ; exp_continue } - -re ".*\[Ww\]atchpoint.*buf\\\[2\\\].*Old value = 0.*New value = 51\[^\n\]*\n" { set x [expr $x+1] ; exp_continue } - -re ".*\[Ww\]atchpoint.*buf\\\[3\\\].*Old value = 0.*New value = 10\[^\n\]*\n" { set x [expr $x+1] ; exp_continue } + -re ".*\[Ww\]atchpoint.*buf\\\[0\\\].*Old value = 0.*New value = 49\[^\n\]*\n" { set x [expr {$x+1}] ; exp_continue } + -re ".*\[Ww\]atchpoint.*buf\\\[1\\\].*Old value = 0.*New value = 50\[^\n\]*\n" { set x [expr {$x+1}] ; exp_continue } + -re ".*\[Ww\]atchpoint.*buf\\\[2\\\].*Old value = 0.*New value = 51\[^\n\]*\n" { set x [expr {$x+1}] ; exp_continue } + -re ".*\[Ww\]atchpoint.*buf\\\[3\\\].*Old value = 0.*New value = 10\[^\n\]*\n" { set x [expr {$x+1}] ; exp_continue } -re ".*$gdb_prompt $" { pass $test } } @@ -402,27 +402,27 @@ proc test_watchpoint_triggered_in_syscall {} { # should have printed. set test "print buf\[0\]" gdb_test_multiple $test $test { - -re ".*= 49.*$gdb_prompt $" { set y [expr $y+1]; pass $test } + -re ".*= 49.*$gdb_prompt $" { set y [expr {$y+1}]; pass $test } -re ".*= 0.*$gdb_prompt $" { $test } } set test "print buf\[1\]" gdb_test_multiple $test $test { - -re ".*= 50.*$gdb_prompt $" { set y [expr $y+1]; pass $test } + -re ".*= 50.*$gdb_prompt $" { set y [expr {$y+1}]; pass $test } -re ".*= 0.*$gdb_prompt $" { pass $test } } set test "print buf\[2\]" gdb_test_multiple $test $test { - -re ".*= 51.*$gdb_prompt $" { set y [expr $y+1]; pass $test } + -re ".*= 51.*$gdb_prompt $" { set y [expr {$y+1}]; pass $test } -re ".*= 0.*$gdb_prompt $" { pass $test } } set test "print buf\[3\]" gdb_test_multiple $test $test { - -re ".*= 10.*$gdb_prompt $" { set y [expr $y+1]; pass $test } + -re ".*= 10.*$gdb_prompt $" { set y [expr {$y+1}]; pass $test } -re ".*= 0.*$gdb_prompt $" { pass $test } } # Did we find what we were looking for? If not, flunk it. - if {[expr $x==$y]} { pass $testname } else { fail "$testname (only triggered $x watchpoints, expected $y)"} + if {$x==$y} { pass $testname } else { fail "$testname (only triggered $x watchpoints, expected $y)"} # Continue until we hit the finishing marker function. # Make sure we hit no more watchpoints. @@ -432,7 +432,7 @@ proc test_watchpoint_triggered_in_syscall {} { # Disable everything so we can finish the program at full speed gdb_test_no_output "disable" "disable in test_watchpoint_triggered_in_syscall" - if [target_info exists gdb,noresults] { return } + if {[target_info exists gdb,noresults]} { return } gdb_continue_to_end "continue to exit in test_watchpoint_triggered_in_syscall" } @@ -567,7 +567,7 @@ proc test_complex_watchpoint {} { # Disable everything so we can finish the program at full speed gdb_test_no_output "disable" "disable in test_complex_watchpoint, second time" - if [target_info exists gdb,noresults] { return } + if {[target_info exists gdb,noresults]} { return } gdb_continue_to_end "continue to exit in test_complex_watchpoint" } @@ -941,7 +941,7 @@ proc test_watch_register_location {} { # Start with a fresh gdb. set prev_timeout $timeout -set timeout 600 +set timeout 600 verbose "Timeout now 600 sec.\n" test_no_hw_watchpoints @@ -964,7 +964,7 @@ proc do_tests {} { test_disabling_watchpoints - if ![target_info exists gdb,cannot_call_functions] { + if {![target_info exists gdb,cannot_call_functions]} { test_stepping } } @@ -978,9 +978,9 @@ proc do_tests {} { "disable fast watches, 2" } - # Only enabled for some targets merely because it has not been tested + # Only enabled for some targets merely because it has not been tested # elsewhere. - # On sparc-sun-sunos4.1.3, GDB was running all the way to the marker4 + # On sparc-sun-sunos4.1.3, GDB was running all the way to the marker4 # breakpoint before stopping for the watchpoint. I don't know why. if {[istarget "hppa*-*-*"]} { test_watchpoint_triggered_in_syscall diff --git a/gdb/testsuite/gdb.base/watchpoints.exp b/gdb/testsuite/gdb.base/watchpoints.exp index d8e4d63..0d21315 100644 --- a/gdb/testsuite/gdb.base/watchpoints.exp +++ b/gdb/testsuite/gdb.base/watchpoints.exp @@ -94,13 +94,13 @@ with_test_prefix "before inferior start" { gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival1\r\n\[ \t]+breakpoint already hit 3 times.*" "watchpoint ival1 hit count is 3" # Disable ival1 watchpoint gdb_test_no_output "disable 2" "" - + # Continue until the next change, from 1 to 2. gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 1.*New value = 2.*ival3 = count; ival4 = count;.*" "watchpoint hit, third time" # Check that the hit count is reported correctly gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival3\r\n\[ \t]+breakpoint already hit 3 times.*" "watchpoint hit count is 3" - + # Continue until the next change, from 2 to 3. gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 2.*New value = 3.*ival3 = count; ival4 = count;.*" "watchpoint hit, fourth time" diff --git a/gdb/testsuite/gdb.base/whatis-exp.exp b/gdb/testsuite/gdb.base/whatis-exp.exp index 7b2ff0e..ffcfc44 100644 --- a/gdb/testsuite/gdb.base/whatis-exp.exp +++ b/gdb/testsuite/gdb.base/whatis-exp.exp @@ -23,7 +23,7 @@ # computing the value, but just the type # of the result. It goes through the evaluate_subexp_standard # with the EVAL_AVOID_SIDE_EFFECTS flag rather than EVAL_NORMAL -# +# # # test running programs diff --git a/gdb/testsuite/gdb.base/whatis-ptype-typedefs.exp b/gdb/testsuite/gdb.base/whatis-ptype-typedefs.exp index 3709cff..744c6ee 100644 --- a/gdb/testsuite/gdb.base/whatis-ptype-typedefs.exp +++ b/gdb/testsuite/gdb.base/whatis-ptype-typedefs.exp @@ -30,7 +30,7 @@ standard_testfile proc prepare {lang} { global srcfile testfile - if [target_info exists no_long_long] { + if {[target_info exists no_long_long]} { set options [list debug additional_flags=-DNO_LONG_LONG] } else { set options [list debug] diff --git a/gdb/testsuite/gdb.base/whatis.exp b/gdb/testsuite/gdb.base/whatis.exp index 10f5320..5fa29af 100644 --- a/gdb/testsuite/gdb.base/whatis.exp +++ b/gdb/testsuite/gdb.base/whatis.exp @@ -19,7 +19,7 @@ # test running programs # -if [target_info exists no_long_long] { +if {[target_info exists no_long_long]} { set exec_opts [list debug additional_flags=-DNO_LONG_LONG] } else { set exec_opts [list debug] @@ -122,7 +122,7 @@ proc do_test {dir options} { "whatis unsigned long" - if ![target_info exists no_long_long] { + if {![target_info exists no_long_long]} { gdb_test "whatis v_unsigned_long_long" \ "type = (unsigned long long|long long unsigned int)" \ "whatis unsigned long long" @@ -192,7 +192,7 @@ proc do_test {dir options} { "type = (unsigned (int|long|long int)|long unsigned int) \\\[2\\\]" \ "whatis unsigned long array" - if ![target_info exists no_long_long] { + if {![target_info exists no_long_long]} { gdb_test "whatis v_unsigned_long_long_array" \ "type = (unsigned long long|long long unsigned int) \\\[2\\\]" \ "whatis unsigned long long array" @@ -260,7 +260,7 @@ proc do_test {dir options} { "type = (unsigned (int|long|long int)|long unsigned int) \\*" \ "whatis unsigned long pointer" - if ![target_info exists no_long_long] { + if {![target_info exists no_long_long]} { gdb_test "whatis v_long_long_pointer" \ "type = long long(| int) \\*" \ "whatis long long pointer" @@ -464,7 +464,7 @@ proc do_test {dir options} { "type = (unsigned (int|long|long int)|long unsigned int) \\($void\\)" \ "whatis unsigned long function" - if ![target_info exists no_long_long] { + if {![target_info exists no_long_long]} { gdb_test "whatis v_long_long_func" \ "type = long long(| int) \\($void\\)" \ "whatis long long function" diff --git a/gdb/testsuite/gdb.base/with.exp b/gdb/testsuite/gdb.base/with.exp index d766e5d..eb1c85a 100644 --- a/gdb/testsuite/gdb.base/with.exp +++ b/gdb/testsuite/gdb.base/with.exp @@ -214,7 +214,7 @@ with_test_prefix "run control" { clean_restart gdb_load $binfile - if ![runto_main] { + if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.base/wrap-line.exp b/gdb/testsuite/gdb.base/wrap-line.exp index 2ba2123..f763588 100644 --- a/gdb/testsuite/gdb.base/wrap-line.exp +++ b/gdb/testsuite/gdb.base/wrap-line.exp @@ -30,11 +30,11 @@ proc fill_line { width } { # Take into account that the prompt also takes space. set prefix [string length "(gdb) "] - set start [expr $prefix + 1] + set start [expr {$prefix + 1}] # Print chars. for { set i $start } { $i <= $width } { incr i } { - set c [expr $i % 10] + set c [expr {$i % 10}] send_gdb $c append res $c } @@ -93,7 +93,7 @@ proc test_wrap { width_auto_detected } { if { $wrap_mode == $wrap_mode_terminal } { gdb_assert { $gdb_width == $readline_width } } elseif { $wrap_mode == $wrap_mode_readline } { - gdb_assert { $gdb_width == [expr $readline_width + 1] } + gdb_assert { $gdb_width == [expr {$readline_width + 1}] } } else { set have_wrap 0 } diff --git a/gdb/testsuite/gdb.base/wrong_frame_bt_full.exp b/gdb/testsuite/gdb.base/wrong_frame_bt_full.exp index fc4e9d5..56efd29 100644 --- a/gdb/testsuite/gdb.base/wrong_frame_bt_full.exp +++ b/gdb/testsuite/gdb.base/wrong_frame_bt_full.exp @@ -42,7 +42,7 @@ if {[gdb_compile \ clean_restart ${main_testfile} -if ![runto opaque_routine] { +if {![runto opaque_routine]} { untested "could not run to opaque_routine" return -1 } diff --git a/gdb/testsuite/gdb.btrace/vdso.exp b/gdb/testsuite/gdb.btrace/vdso.exp index 0484da1..8bf63ac 100644 --- a/gdb/testsuite/gdb.btrace/vdso.exp +++ b/gdb/testsuite/gdb.btrace/vdso.exp @@ -47,7 +47,7 @@ with_test_prefix "replay" { set replay_gettimeofday [capture_command_output "disassemble gettimeofday" ""] # the two disassemblies must be identical - if ![string compare $live_gettimeofday $replay_gettimeofday] { + if {![string compare $live_gettimeofday $replay_gettimeofday]} { pass "disassemble gettimeofday" } else { fail "disassemble gettimeofday" diff --git a/gdb/testsuite/gdb.compile/compile-ifunc.exp b/gdb/testsuite/gdb.compile/compile-ifunc.exp index 72c1142..dbe84d5 100644 --- a/gdb/testsuite/gdb.compile/compile-ifunc.exp +++ b/gdb/testsuite/gdb.compile/compile-ifunc.exp @@ -35,7 +35,7 @@ with_test_prefix "nodebug" { return -1 } - if ![runto_main] { + if {![runto_main]} { return -1 } @@ -65,7 +65,7 @@ with_test_prefix "debug" { return -1 } - if ![runto_main] { + if {![runto_main]} { return -1 } # gnu_ifunc (10): error: too many arguments to function 'gnu_ifunc' diff --git a/gdb/testsuite/gdb.cp/abstract-origin.exp b/gdb/testsuite/gdb.cp/abstract-origin.exp index c9d4194..f54cb9a 100644 --- a/gdb/testsuite/gdb.cp/abstract-origin.exp +++ b/gdb/testsuite/gdb.cp/abstract-origin.exp @@ -19,7 +19,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.cp/annota2.exp b/gdb/testsuite/gdb.cp/annota2.exp index 14fe8ef..16344bd 100644 --- a/gdb/testsuite/gdb.cp/annota2.exp +++ b/gdb/testsuite/gdb.cp/annota2.exp @@ -42,7 +42,7 @@ set frames_invalid "\r\n\032\032frames-invalid\r\n" # set main_line 25 -# The commands we test here produce many lines of output; disable "press +# The commands we test here produce many lines of output; disable "press # <return> to continue" prompts. gdb_test_no_output "set height 0" @@ -64,7 +64,7 @@ gdb_test "break 25" \ set old_gdb_prompt $gdb_prompt set gdb_prompt "\r\n\032\032pre-prompt\r\n$gdb_prompt \r\n\032\032prompt\r\n" -send_gdb "set annotate 2\n" +send_gdb "set annotate 2\n" gdb_expect { -re "set annotate 2\r\n$gdb_prompt$" { pass "annotation set at level 2" } -re ".*$gdb_prompt$" { fail "annotation set at level 2" } @@ -175,7 +175,7 @@ gdb_expect { } # -# break at first line of main. +# break at first line of main. # set pat [multi_line "" \ "\032\032post-prompt" \ @@ -205,7 +205,7 @@ gdb_test_multiple "run" "run until main breakpoint, second time" { } # -# set up a watch point on a.x +# set up a watch point on a.x # set pat [multi_line "" \ "\032\032post-prompt" \ @@ -266,12 +266,12 @@ gdb_test_multiple "next" "watch triggered on a.x" { # -# send ^C to gdb, so that the quit() function gets called +# send ^C to gdb, so that the quit() function gets called # and annotate-quit is tested # test: # annotate-quit # -if ![target_info exists gdb,nointerrupts] { +if {![target_info exists gdb,nointerrupts]} { send_gdb "\003" gdb_expect { -re "\r\n\032\032error-begin\r\nQuit\r\n\r\n\032\032quit\r\n$gdb_prompt$" \ @@ -282,9 +282,9 @@ if ![target_info exists gdb,nointerrupts] { } # -# FIXME: the testsuite does not currently have tests for +# FIXME: the testsuite does not currently have tests for # annotate_catchpoints and annotate_function_call -# and a few variants of the annotations that are +# and a few variants of the annotations that are # tested (marked by FIXME on the annot?.exp files) # diff --git a/gdb/testsuite/gdb.cp/annota3.exp b/gdb/testsuite/gdb.cp/annota3.exp index c1f96ac..db3f696 100644 --- a/gdb/testsuite/gdb.cp/annota3.exp +++ b/gdb/testsuite/gdb.cp/annota3.exp @@ -39,7 +39,7 @@ require target_can_use_run_cmd # set main_line 25 -# The commands we test here produce many lines of output; disable "press +# The commands we test here produce many lines of output; disable "press # <return> to continue" prompts. gdb_test_no_output "set height 0" @@ -61,7 +61,7 @@ gdb_test "break 25" \ set old_gdb_prompt $gdb_prompt set gdb_prompt "\r\n\032\032pre-prompt\r\n$gdb_prompt \r\n\032\032prompt\r\n" -send_gdb "set annotate 3\n" +send_gdb "set annotate 3\n" gdb_expect_list "annotation set at level 3" "\r\n$gdb_prompt$" { "set annotate 3" } @@ -131,7 +131,7 @@ gdb_expect { } # -# break at first line of main. +# break at first line of main. # send_gdb "break 22\n" gdb_expect_list "break at main" "$gdb_prompt$" { @@ -158,7 +158,7 @@ gdb_expect_list "second run until main breakpoint" "$gdb_prompt$" { } # -# set up a watch point on a.x +# set up a watch point on a.x # send_gdb "watch a.x\n" gdb_expect_list "set watch on a.x" "$gdb_prompt$" { @@ -177,12 +177,12 @@ gdb_test_multiple "next" "watch triggered on a.x" { } # -# send ^C to gdb, so that the quit() function gets called +# send ^C to gdb, so that the quit() function gets called # and annotate-quit is tested # test: # annotate-quit # -if ![target_info exists gdb,nointerrupts] { +if {![target_info exists gdb,nointerrupts]} { send_gdb "\003" gdb_expect_list "annotate-quit" "$gdb_prompt$" { "\r\n\032\032error-begin\r\n" @@ -192,9 +192,9 @@ if ![target_info exists gdb,nointerrupts] { } # -# FIXME: the testsuite does not currently have tests for +# FIXME: the testsuite does not currently have tests for # annotate_catchpoints and annotate_function_call -# and a few variants of the annotations that are +# and a few variants of the annotations that are # tested (marked by FIXME on the annot?.exp files) # diff --git a/gdb/testsuite/gdb.cp/anon-union.exp b/gdb/testsuite/gdb.cp/anon-union.exp index ae19f3b..fb36b49 100644 --- a/gdb/testsuite/gdb.cp/anon-union.exp +++ b/gdb/testsuite/gdb.cp/anon-union.exp @@ -77,7 +77,7 @@ gdb_test "print foo" \ # Modify the member just set gdb_test_no_output "set var foo.cloth = 35" "set var foo.cloth" -# Now print out anon union again to see if the right member was set +# Now print out anon union again to see if the right member was set gdb_test "print foo" \ "\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 0, x = \{rock = 0, rock2 = 0\}, \{qux = 0, mux = 0\}, boulder = 0\}, \{paper = 35, cloth = 35\}, num2 = \{two = 0, three = 0\}\}" \ "print foo 3" @@ -86,7 +86,7 @@ gdb_test "print foo" \ gdb_test "next" "42\[ \t\]*foo.mux = 55;" "next 3" -# Now print out anon union again +# Now print out anon union again gdb_test "print foo" \ "\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 44, x = \{rock = 44, rock2 = 0\}, \{qux = 44, mux = 44\}, boulder = 44\}, \{paper = 35, cloth = 35\}, num2 = \{two = 0, three = 0\}\}" \ "print foo 4" @@ -94,7 +94,7 @@ gdb_test "print foo" \ # Modify the member just set gdb_test_no_output "set var foo.pebble = 45" "set var foo.pebble" -# Now print out anon union again to see if the right member was set +# Now print out anon union again to see if the right member was set gdb_test "print foo" \ "\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 45, x = \{rock = 45, rock2 = 0\}, \{qux = 45, mux = 45\}, boulder = 45\}, \{paper = 35, cloth = 35\}, num2 = \{two = 0, three = 0\}\}" \ "print foo 5" @@ -102,7 +102,7 @@ gdb_test "print foo" \ # Modify another member at a different level gdb_test_no_output "set var foo.qux = 46" "set var foo.qux" -# Now print out anon union again to see if the right member was set +# Now print out anon union again to see if the right member was set gdb_test "print foo" \ "\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 46, x = \{rock = 46, rock2 = 0\}, \{qux = 46, mux = 46\}, boulder = 46\}, \{paper = 35, cloth = 35\}, num2 = \{two = 0, three = 0\}\}" \ "print foo 6" @@ -150,7 +150,7 @@ gdb_test "print w" "\\$\[0-9\]* = 45" "print w 2" # See if z shows the same value gdb_test "print z" "\\$\[0-9\]* = 45" "print z 2" -# Set the anon union member +# Set the anon union member gdb_test_no_output "set var z = 27" "set var z" # See if the change in value is noticed diff --git a/gdb/testsuite/gdb.cp/call-method-register.exp b/gdb/testsuite/gdb.cp/call-method-register.exp index b736312..522da0a 100644 --- a/gdb/testsuite/gdb.cp/call-method-register.exp +++ b/gdb/testsuite/gdb.cp/call-method-register.exp @@ -108,7 +108,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.cp/casts.exp b/gdb/testsuite/gdb.cp/casts.exp index 42c5d1f..c03a946 100644 --- a/gdb/testsuite/gdb.cp/casts.exp +++ b/gdb/testsuite/gdb.cp/casts.exp @@ -70,12 +70,12 @@ gdb_test "print * (B *) a" ".* = {<A> = {a = 42}, b = 1729}" \ gdb_test "print * b" ".* = {<A> = {a = 42}, b = 1729}" \ "let compiler cast base class pointer to derived class pointer" -# Check upcasting (it is trivial but still). +# Check upcasting (it is trivial but still). gdb_test "print * (A *) b" ".* = {a = 42}" \ "cast derived class pointer to base class pointer" # Casting References. -# Check upcasting. +# Check upcasting. gdb_test "print (A &) br" ".* = .A &.* {a = 42}" \ "cast derived class reference to base class reference" diff --git a/gdb/testsuite/gdb.cp/classes.exp b/gdb/testsuite/gdb.cp/classes.exp index cb6a862..ad63749 100644 --- a/gdb/testsuite/gdb.cp/classes.exp +++ b/gdb/testsuite/gdb.cp/classes.exp @@ -203,7 +203,7 @@ proc test_ptype_class_objects {} { # # gcc 2.X with stabs (stabs or stabs+?) used to have a problem with # static methods whose name is the same as their argument mangling. - + cp_test_ptype_class \ "class Static" "" "class" "Static" \ { @@ -413,7 +413,7 @@ proc test_ptype_class_objects {} { # Test simple access to class members. proc test_non_inherited_member_access {} { - + # Print non-inherited members of g_A. gdb_test "print g_A.a" ".* = 1" gdb_test "print g_A.x" ".* = 2" diff --git a/gdb/testsuite/gdb.cp/cmpd-minsyms.exp b/gdb/testsuite/gdb.cp/cmpd-minsyms.exp index 62952bd..cb31bae 100644 --- a/gdb/testsuite/gdb.cp/cmpd-minsyms.exp +++ b/gdb/testsuite/gdb.cp/cmpd-minsyms.exp @@ -36,7 +36,7 @@ foreach sym $min_syms { set tst "setting breakpoint at '$sym'" if {[gdb_breakpoint "'$sym'"]} { pass $tst - } + } } diff --git a/gdb/testsuite/gdb.cp/cpexprs.exp.tcl b/gdb/testsuite/gdb.cp/cpexprs.exp.tcl index 5c3dfd6..6766cce 100644 --- a/gdb/testsuite/gdb.cp/cpexprs.exp.tcl +++ b/gdb/testsuite/gdb.cp/cpexprs.exp.tcl @@ -130,7 +130,7 @@ set ADDR "0x$HEX+"; # address # are (none need character escaping -- "add" will take care of that): # add name type print_name list -# NAME,type: value is type of function +# NAME,type: value is type of function # NAME,print: value is print name of function (careful w/inherited/virtual!) # NAME,list: value is comment in source code on first line of function # (without the leading "//") diff --git a/gdb/testsuite/gdb.cp/cplusfuncs.exp b/gdb/testsuite/gdb.cp/cplusfuncs.exp index e785909..d1b4ecb 100644 --- a/gdb/testsuite/gdb.cp/cplusfuncs.exp +++ b/gdb/testsuite/gdb.cp/cplusfuncs.exp @@ -424,7 +424,7 @@ proc test_lookup_operator_functions {} { # operator[] needs double backslashes, so that a single backslash # will be sent to GDB, preventing the square brackets from being - # evaluated as a regular expression. + # evaluated as a regular expression. info_func "operator\\\[\\\](" "void foo::operator\[\]($dm_type_foo_ref);" # These are gnarly because they might end with 'static'. @@ -493,7 +493,7 @@ proc test_paddr_operator_functions {} { gdb_test "print &foo::operator new" \ " = .* $hex <foo::operator new\\(.*\\)(| static)>" gdb_test "print &foo::operator new\[\]" \ - " = .* $hex <foo::operator new\\\[\\\]\\(.*\\)(| static)>" + " = .* $hex <foo::operator new\\\[\\\]\\(.*\\)(| static)>" print_addr "foo::operator delete($dm_type_void_star)" print_addr "foo::operator delete\[\]($dm_type_void_star)" diff --git a/gdb/testsuite/gdb.cp/demangle.exp b/gdb/testsuite/gdb.cp/demangle.exp index 8da4377..420d1df 100644 --- a/gdb/testsuite/gdb.cp/demangle.exp +++ b/gdb/testsuite/gdb.cp/demangle.exp @@ -36,7 +36,7 @@ proc set_demangling_style {style} { fail "$style: set demangle-style" error "set_demangling_style: set style" } - timeout { + timeout { fail "$style: set demangle-style (timeout)" error "set_demangling_style: set style" } @@ -44,15 +44,15 @@ proc set_demangling_style {style} { gdb_test_multiple "show demangle-style" \ "$style: check demangling style" { - -re "The current C\[+\]+ demangling style is \"$style\".\r\n$gdb_prompt $" { + -re "The current C\[+\]+ demangling style is \"$style\".\r\n$gdb_prompt $" { pass "$style: check demangling style" } -re ".*$gdb_prompt $" { fail "$style: check demangling style" error "set_demangling_style: check style" } - timeout { - fail "$style: check demangling style (timeout)" + timeout { + fail "$style: check demangling style (timeout)" error "set_demangling_style: check style" } } @@ -89,13 +89,13 @@ proc test_demangling_core {tester test result} { ### Why don't we just pass the STYLE and NAME as two separate ### arguments, or let the style be a global variable? That would be ### cleaner. However, doing it this way means that: -### +### ### 1) the name of the test, as recorded in the summary and log, ### appears verbatim in the script, and -### +### ### 2) that test names are unique, even though we try to demangle the same ### identifiers using several different mangling styles. -### +### ### This makes it a lot easier for people tracking down failures to ### find the one they care about. @@ -157,14 +157,14 @@ proc test_gnuv3_style_demangling {} { } proc catch_demangling_errors {command} { - if {[catch $command result]} { + if {[catch {$command} result]} { puts "ERROR: demangle.exp: while running $command: $result" } } # Test support for different demangling styles. Note that this does # not depend upon running the test program and does not depend upon -# gdb being able to lookup any C++ symbols. It simply calls the +# gdb being able to lookup any C++ symbols. It simply calls the # internal demangler with synthesized strings and tests the results. proc do_tests {} { diff --git a/gdb/testsuite/gdb.cp/derivation.exp b/gdb/testsuite/gdb.cp/derivation.exp index f61e35c..bb3dcce 100644 --- a/gdb/testsuite/gdb.cp/derivation.exp +++ b/gdb/testsuite/gdb.cp/derivation.exp @@ -19,7 +19,7 @@ # This file is part of the gdb testsuite # tests for inheritance, with several derivations types combinations -# (private, public, protected) +# (private, public, protected) # classes have simple members and member functions. set ws "\[\r\n\t \]+" diff --git a/gdb/testsuite/gdb.cp/destrprint.exp b/gdb/testsuite/gdb.cp/destrprint.exp index 10f66b6..5ce7134 100644 --- a/gdb/testsuite/gdb.cp/destrprint.exp +++ b/gdb/testsuite/gdb.cp/destrprint.exp @@ -19,7 +19,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.cp/dispcxx.exp b/gdb/testsuite/gdb.cp/dispcxx.exp index 3d4703f..107e967 100644 --- a/gdb/testsuite/gdb.cp/dispcxx.exp +++ b/gdb/testsuite/gdb.cp/dispcxx.exp @@ -23,7 +23,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} { if {![runto_main]} { return -} +} gdb_breakpoint [gdb_get_line_number "Break here"] gdb_continue_to_breakpoint here diff --git a/gdb/testsuite/gdb.cp/empty-enum.exp b/gdb/testsuite/gdb.cp/empty-enum.exp index f640e34..487d561 100644 --- a/gdb/testsuite/gdb.cp/empty-enum.exp +++ b/gdb/testsuite/gdb.cp/empty-enum.exp @@ -51,7 +51,7 @@ gdb_test "print arg2" " = 4" # Xfail for missing DW_AT_type in DW_TAG_enumeration_type, gcc PR debug/16063. -set have_xfail [expr [test_compiler_info gcc-*] && [gcc_major_version] < 5] +set have_xfail [expr {[test_compiler_info gcc-*] && [gcc_major_version] < 5}] gdb_test_multiple "ptype arg1" "" { -re -wrap "type = enum enum1 : unsigned int \\{\\}" { diff --git a/gdb/testsuite/gdb.cp/except-multi-location.exp b/gdb/testsuite/gdb.cp/except-multi-location.exp index 3780447..0c3222d 100644 --- a/gdb/testsuite/gdb.cp/except-multi-location.exp +++ b/gdb/testsuite/gdb.cp/except-multi-location.exp @@ -57,7 +57,7 @@ proc test_multi_libstdcpp {static_bin static_lib} { gdb_load ${binfile} gdb_load_shlib $binfile_lib - if ![runto_main] { + if {![runto_main]} { return 0 } diff --git a/gdb/testsuite/gdb.cp/exception.exp b/gdb/testsuite/gdb.cp/exception.exp index cb20f17..45fa299 100644 --- a/gdb/testsuite/gdb.cp/exception.exp +++ b/gdb/testsuite/gdb.cp/exception.exp @@ -33,7 +33,7 @@ set nl "\[\r\n\]+" require allow_stl_tests standard_testfile .cc - + if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} { return -1 } @@ -101,7 +101,7 @@ gdb_test_multiple "info breakpoints" $name { gdb_test "break catcher" "Breakpoint \[0-9\]+ at.*" # Get the first exception thrown - + gdb_test "continue" \ "Continuing.${ws}Catchpoint \[0-9\]+ \\(exception thrown\\).*" \ "continue to first throw" diff --git a/gdb/testsuite/gdb.cp/exceptprint.exp b/gdb/testsuite/gdb.cp/exceptprint.exp index 09e35fd..8f034e4 100644 --- a/gdb/testsuite/gdb.cp/exceptprint.exp +++ b/gdb/testsuite/gdb.cp/exceptprint.exp @@ -49,7 +49,7 @@ proc do_exceptprint_tests {prefix output} { do_continue_to_catchpoint "continue to catch" gdb_test "print \$_exception" " = $output" \ "print exception value at catch" - + do_continue_to_catchpoint "continue to rethrow" gdb_test "print \$_exception" " = $output" \ "print exception value at rethrow" diff --git a/gdb/testsuite/gdb.cp/expand-sals.exp b/gdb/testsuite/gdb.cp/expand-sals.exp index 8d54247..df6fb6a 100644 --- a/gdb/testsuite/gdb.cp/expand-sals.exp +++ b/gdb/testsuite/gdb.cp/expand-sals.exp @@ -19,7 +19,7 @@ set srcfile expand-sals.cc if { [prepare_for_testing "failed to prepare" expand-sals $srcfile {debug c++}] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.cp/formatted-ref.exp b/gdb/testsuite/gdb.cp/formatted-ref.exp index 0c974ad..bf0aae3 100644 --- a/gdb/testsuite/gdb.cp/formatted-ref.exp +++ b/gdb/testsuite/gdb.cp/formatted-ref.exp @@ -15,9 +15,9 @@ # Author: P. N. Hilfinger, AdaCore, Inc. -# This test checks the behavior of formatted print when applied to a +# This test checks the behavior of formatted print when applied to a # reference value. The intended behavior is that a formatted print of -# such a value should display the same value as a plain print, +# such a value should display the same value as a plain print, # modulo format, of course. Older versions of GDB would instead print # the reference's address value itself when doing a formatted print, # rather than printing both that and the dereferenced value. We also @@ -44,7 +44,7 @@ proc get_address { var } { -re "\\$\[0-9\]+ = \\(.*\\) (0x\[0-9a-f\]+).*$gdb_prompt $" { return $expect_out(1,string) } - timeout { + timeout { perror "couldn't find address of $var" return "" } @@ -59,7 +59,7 @@ proc test_p_x { var type val addr } { gdb_test_multiple $test $test { -re "\\$\[0-9\]+ = \\([string_to_regexp $type]\\) @0x\[a-f0-9\]+: [string_to_regexp $val].*$gdb_prompt $" { pass $test - } + } -re "\\$\[0-9\]+ = $addr.*$gdb_prompt $" { fail "$test (prints just address)" } @@ -77,7 +77,7 @@ proc test_p_x_addr { var addr } { gdb_test_multiple $test $test { -re "\\$\[0-9\]+ = $addr.*$gdb_prompt $" { pass $test - } + } -re "\\$\[0-9\]+ = 0x\[a-f0-9+\]+.*$gdb_prompt $" { fail "$test (prints unexpected address)" } diff --git a/gdb/testsuite/gdb.cp/gdb1355.exp b/gdb/testsuite/gdb.cp/gdb1355.exp index 3120b1f..c54723d 100644 --- a/gdb/testsuite/gdb.cp/gdb1355.exp +++ b/gdb/testsuite/gdb.cp/gdb1355.exp @@ -35,7 +35,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} { if {![runto_main]} { return -} +} # See http://sources.redhat.com/gdb/bugs/1355 # See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12066 diff --git a/gdb/testsuite/gdb.cp/incomplete-type-overload.exp b/gdb/testsuite/gdb.cp/incomplete-type-overload.exp index aa582e0..efb1fd3 100644 --- a/gdb/testsuite/gdb.cp/incomplete-type-overload.exp +++ b/gdb/testsuite/gdb.cp/incomplete-type-overload.exp @@ -33,11 +33,11 @@ set flags_nodebug {} lappend flags_nodebug nodebug lappend flags_nodebug c++ -if [prepare_for_testing "failed to prepare" $testfile $srcfile $flags_debug] { +if {[prepare_for_testing "failed to prepare" $testfile $srcfile $flags_debug]} { return } -if ![runto_main] { +if {![runto_main]} { return } @@ -171,12 +171,12 @@ Dwarf::assemble ${asm_file} { } } -if [prepare_for_testing "failed to prepare" $testfile \ - [list $asm_file $srcfile] $flags_nodebug] { +if {[prepare_for_testing "failed to prepare" $testfile \ + [list $asm_file $srcfile] $flags_nodebug]} { return } -if ![runto_main] { +if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.cp/infcall-nodebug.exp.tcl b/gdb/testsuite/gdb.cp/infcall-nodebug.exp.tcl index 764d31d..b743498 100644 --- a/gdb/testsuite/gdb.cp/infcall-nodebug.exp.tcl +++ b/gdb/testsuite/gdb.cp/infcall-nodebug.exp.tcl @@ -19,7 +19,7 @@ # the rest of the test can be complied with debug information. Whilst we # are at it, also test functions with debug information and C functions too. -if [target_info exists gdb,cannot_call_functions] { +if {[target_info exists gdb,cannot_call_functions]} { unsupported "this target can not call functions" continue } diff --git a/gdb/testsuite/gdb.cp/iostream.exp b/gdb/testsuite/gdb.cp/iostream.exp index 8d96a9f..621695f 100644 --- a/gdb/testsuite/gdb.cp/iostream.exp +++ b/gdb/testsuite/gdb.cp/iostream.exp @@ -24,7 +24,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.cp/local.exp b/gdb/testsuite/gdb.cp/local.exp index 621f2f6..7c13de0 100644 --- a/gdb/testsuite/gdb.cp/local.exp +++ b/gdb/testsuite/gdb.cp/local.exp @@ -174,7 +174,7 @@ gdb_test_multiple "ptype Local" "local out of scope" { kfail gdb/825 "Local out of scope" } } - + # DTS CLLbs14316 and CLLbs17058 # coulter - I added a clause for HP's aCC compiler. We print out the type @@ -182,7 +182,7 @@ gdb_test_multiple "ptype Local" "local out of scope" { # because of two reasons: # There is a number at the end of InnerLocal4 which should not be there, # DTS CLLbs14316 -# The line number for the class +# The line number for the class # setup_xfail "hppa*-*-*" CLLbs14316 # --- diff --git a/gdb/testsuite/gdb.cp/m-static.exp b/gdb/testsuite/gdb.cp/m-static.exp index 6b10804..1769ba7 100644 --- a/gdb/testsuite/gdb.cp/m-static.exp +++ b/gdb/testsuite/gdb.cp/m-static.exp @@ -45,7 +45,7 @@ if {![runto_main]} { } get_debug_format -set non_dwarf [expr ! [test_debug_format "DWARF \[0-9\]"]] +set non_dwarf [expr {! [test_debug_format "DWARF \[0-9\]"]}] # First, run to after we've constructed all the objects: diff --git a/gdb/testsuite/gdb.cp/many-args.exp b/gdb/testsuite/gdb.cp/many-args.exp index b7e5a8e..fcb0a36 100644 --- a/gdb/testsuite/gdb.cp/many-args.exp +++ b/gdb/testsuite/gdb.cp/many-args.exp @@ -27,7 +27,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.cp/mb-inline.exp b/gdb/testsuite/gdb.cp/mb-inline.exp index d6b30b8..579bcc6 100644 --- a/gdb/testsuite/gdb.cp/mb-inline.exp +++ b/gdb/testsuite/gdb.cp/mb-inline.exp @@ -69,7 +69,7 @@ gdb_test_multiple "info break" "disabled breakpoint 1.2" { # will loose. The heuristic of GDB should be improved. setup_kfail gdb/12924 "*-*-uclinux*" fail "disabled breakpoint 1.2" - } + } } # Make sure we can set a breakpoint on a source statement that spans diff --git a/gdb/testsuite/gdb.cp/mb-templates.exp b/gdb/testsuite/gdb.cp/mb-templates.exp index 0354a5a..b067cb0 100644 --- a/gdb/testsuite/gdb.cp/mb-templates.exp +++ b/gdb/testsuite/gdb.cp/mb-templates.exp @@ -61,7 +61,7 @@ gdb_test "break $srcfile:$bp_location" \ gdb_test_no_output {condition $bpnum i==1} \ "separate condition: set condition" - + gdb_run_cmd gdb_test "" "Breakpoint $bkptno_num_re,.*foo<int> \\(i=1\\).*" "separate condition: run to breakpoint" diff --git a/gdb/testsuite/gdb.cp/method-call-in-c.exp b/gdb/testsuite/gdb.cp/method-call-in-c.exp index 6cbdda0..b0201ad 100644 --- a/gdb/testsuite/gdb.cp/method-call-in-c.exp +++ b/gdb/testsuite/gdb.cp/method-call-in-c.exp @@ -45,7 +45,7 @@ foreach_with_prefix lang { c++ c } { gdb_test "print foo.func (b, f)" " = ${result}" incr result - set result [expr $result + 3] + set result [expr {$result + 3}] gdb_test "print foo += b" \ " = \\((?:struct )?foo_type &\\) @${hex}: \\\{var = ${result}\\\}" diff --git a/gdb/testsuite/gdb.cp/method.exp b/gdb/testsuite/gdb.cp/method.exp index 2e0f412..410647a 100644 --- a/gdb/testsuite/gdb.cp/method.exp +++ b/gdb/testsuite/gdb.cp/method.exp @@ -60,7 +60,7 @@ gdb_test "print x" \ "\\$\[0-9\]* = 20" \ "print x in A::foo" -# Check access to this pointer +# Check access to this pointer gdb_test "print this" \ "\\$\[0-9\]* = \\((class |)A *\\* *(const|)\\) $hex" \ @@ -82,7 +82,7 @@ gdb_test "print x" \ "\\$\[0-9\]* = 33" \ "print x in A::bar" -# Check access to this pointer +# Check access to this pointer get_debug_format @@ -123,7 +123,7 @@ gdb_test "print data_" \ "\\$\[0-9\]* = 33" \ "print data_ in funk::getFunky" -# Check access to this pointer +# Check access to this pointer gdb_test "print this" \ "\\$\[0-9\]* = \\((class |)funk *\\* *(const|)\\) $hex" \ @@ -157,7 +157,7 @@ gdb_test_multiple "cont" "finish program" { pass "finish program" } -re "Continuing.* EXIT code 0.*$inferior_exited_re normally.*$gdb_prompt $" { - pass "finish program (exit wrapper)" + pass "finish program (exit wrapper)" } } diff --git a/gdb/testsuite/gdb.cp/misc.exp b/gdb/testsuite/gdb.cp/misc.exp index 6d3e000..6400395 100644 --- a/gdb/testsuite/gdb.cp/misc.exp +++ b/gdb/testsuite/gdb.cp/misc.exp @@ -49,12 +49,12 @@ proc test_expr { args } { if { [llength $args] % 2 } { warning "an even # of arguments should be passed to test_expr" } - set last_ent [expr [llength $args] - 1] + set last_ent [expr {[llength $args] - 1}] set testname [lindex $args $last_ent] gdb_test_no_output [lindex $args 0] "$testname, setup" - for {set x 1} {$x < $last_ent} {set x [expr $x + 2]} { - gdb_test [lindex $args $x] [lindex $args [expr $x + 1]] "$testname, [lindex $args $x]" + for {set x 1} {$x < $last_ent} {set x [expr {$x + 2}]} { + gdb_test [lindex $args $x] [lindex $args [expr {$x + 1}]] "$testname, [lindex $args $x]" } } @@ -72,7 +72,7 @@ test_expr "set language c++" \ "print as bool" # Test bool type printing, etc. -# Note: Language is already set to C++ above! +# Note: Language is already set to C++ above! gdb_test "print v_bool" "\\$\[0-9\]* = false" "print a bool var" # set a bool variable diff --git a/gdb/testsuite/gdb.cp/namespace.exp b/gdb/testsuite/gdb.cp/namespace.exp index 0ba8387..6569f79 100644 --- a/gdb/testsuite/gdb.cp/namespace.exp +++ b/gdb/testsuite/gdb.cp/namespace.exp @@ -89,10 +89,10 @@ setup_xfail hppa*-*-*11* CLLbs14869 gdb_test_multiple "info func xyzq" "info func xyzq" { -re "All functions.*File.*namespace.cc:\r\n.*\tint AAA::A_xyzq\\(int\\);\r\n.*\tint BBB::B_xyzq\\(int\\);\r\n.*\tchar AAA::xyzq\\(char\\);\r\n.*\tchar BBB::xyzq\\(char\\);\r\n.*\tchar BBB::CCC::xyzq\\(char\\);\r\n.*\tchar BBB::Class::xyzq\\(char\\);\r\n$gdb_prompt $" { pass "info func xyzq" - } + } -re "All functions.*File.*namespace.cc:\r\n.*\tint AAA::A_xyzq\\(int\\);\r\n.*\tchar AAA::xyzq\\(char\\);\r\n.*\tint BBB::B_xyzq\\(int\\);\r\n.*\tchar BBB::CCC::xyzq\\(char\\);\r\n.*\tchar BBB::Class::xyzq\\(char\\);\r\n.*\tchar BBB::xyzq\\(char\\);\r\n$gdb_prompt $" { pass "info func xyzq" - } + } } # Call a function in a namespace @@ -120,7 +120,7 @@ gdb_test "print 'BBB::CCC::xyzq'('x')" \ gdb_test "print BBB::CCC::xyzq('x')" \ "\\$\[0-9\]* = 122 'z'" - + # Break on a function in a nested namespace gdb_test "break BBB::CCC::xyzq" \ @@ -153,9 +153,9 @@ gdb_test "whatis ::C::cOtherFileVar" "type = const C::cOtherFileType" gdb_test "print C::cOtherFileVar" "\\$\[0-9\].* = 319" gdb_test "print ::C::cOtherFileVar" "\\$\[0-9\].* = 319" -if $xfail_class_types { setup_xfail *-*-* } +if {$xfail_class_types} { setup_xfail *-*-* } gdb_test "whatis C::OtherFileClass::cOtherFileClassType" "type = short" -if $xfail_class_types { setup_xfail *-*-* } +if {$xfail_class_types} { setup_xfail *-*-* } gdb_test "whatis ::C::OtherFileClass::cOtherFileClassType" "type = short" gdb_test "print C::OtherFileClass::cOtherFileClassVar" " = 318" @@ -171,8 +171,8 @@ gdb_test_multiple $test $test { } -re "\\$\[0-9\].* = 318\r\n$gdb_prompt $" { # Do not permit to XFAIL on recent GCCs. - if $xfail_class_types { - setup_xfail *-*-* + if {$xfail_class_types} { + setup_xfail *-*-* fail $test # Unresolved means human intervention is required to determine # whether the test passed or failed. Since the previous test @@ -226,9 +226,9 @@ gdb_test "ptype C::OtherFileClass" "No symbol \"OtherFileClass\" in namespace \" # Test class typedefs printing. set expect "type = class C::OtherFileClass \{\r\n.*\r\n *typedef short cOtherFileClassType;\r\n *typedef long cOtherFileClassType2;\r\n\}" -if $xfail_class_types { setup_xfail *-*-* } +if {$xfail_class_types} { setup_xfail *-*-* } gdb_test "ptype OtherFileClass" $expect "ptype OtherFileClass typedefs" -if $xfail_class_types { setup_xfail *-*-* } +if {$xfail_class_types} { setup_xfail *-*-* } gdb_test "ptype ::C::OtherFileClass" $expect "ptype ::C::OtherFileClass typedefs" # Some anonymous namespace tests. diff --git a/gdb/testsuite/gdb.cp/nested-types.exp b/gdb/testsuite/gdb.cp/nested-types.exp index 620b4f2..28ce8e0 100644 --- a/gdb/testsuite/gdb.cp/nested-types.exp +++ b/gdb/testsuite/gdb.cp/nested-types.exp @@ -60,7 +60,7 @@ proc build_node {id} { # (the source only uses that at the root struct). # We also don't create nodes not in the source file # (id >= 60). - if {[expr {$n % 10}] != 0 && $n < 60} { + if {$n % 10 != 0 && $n < 60} { lappend nodes($id,children) $n } } @@ -96,7 +96,7 @@ proc make_source {} { send_log "int\nmain \(\)\n\{\n" set plist {} for {set i 10} {$i < 60} {incr i} { - if {$i > 10 && [expr {$i % 10}] == 0} { + if {$i > 10 && $i % 10 == 0} { incr i set plist {"S10"} send_log "\n" diff --git a/gdb/testsuite/gdb.cp/nextoverthrow.exp b/gdb/testsuite/gdb.cp/nextoverthrow.exp index 2548305..e3aae28 100644 --- a/gdb/testsuite/gdb.cp/nextoverthrow.exp +++ b/gdb/testsuite/gdb.cp/nextoverthrow.exp @@ -24,7 +24,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} { if {![runto_main]} { return -} +} if {![skip_unwinder_tests]} { unsupported "nextoverthrow.exp could not find _Unwind_DebugHook" diff --git a/gdb/testsuite/gdb.cp/nsusing.exp b/gdb/testsuite/gdb.cp/nsusing.exp index 988bf2f..90fd9fe 100644 --- a/gdb/testsuite/gdb.cp/nsusing.exp +++ b/gdb/testsuite/gdb.cp/nsusing.exp @@ -125,7 +125,7 @@ if { [test_compiler_info {gcc-[0-3]-*}] || # Xfail for incorrect decl_line on DW_TAG_imported_module, # gcc PR debug/108716. set have_gcc108716_xfail \ - [expr [test_compiler_info gcc-*] && [gcc_major_version] < 13] + [expr {[test_compiler_info gcc-*] && [gcc_major_version] < 13}] gdb_test_multiple "print x" "print x, before using statement" { -re -wrap "No symbol .x. in current context.*" { diff --git a/gdb/testsuite/gdb.cp/overload-const.exp b/gdb/testsuite/gdb.cp/overload-const.exp index 75176b9..6b6056e 100644 --- a/gdb/testsuite/gdb.cp/overload-const.exp +++ b/gdb/testsuite/gdb.cp/overload-const.exp @@ -25,6 +25,6 @@ if {[prepare_for_testing "failed to prepare" $testfile $testfile.cc {c++ debug}] gdb_test_no_output "set language c++" -if [gdb_breakpoint "myclass::func"] { +if {[gdb_breakpoint "myclass::func"]} { pass "setting breakpoint at myclass::func" } diff --git a/gdb/testsuite/gdb.cp/overload.exp b/gdb/testsuite/gdb.cp/overload.exp index af5b23b..aa1daa4 100644 --- a/gdb/testsuite/gdb.cp/overload.exp +++ b/gdb/testsuite/gdb.cp/overload.exp @@ -346,8 +346,8 @@ with_test_prefix "list all overloads" { set line_bar_A [gdb_get_line_number "int bar (A)"] set line_bar_B [gdb_get_line_number "int bar (B)"] - set lines1 [line_range_pattern [expr $line_bar_A - 5] [expr $line_bar_A + 4]] - set lines2 [line_range_pattern [expr $line_bar_B - 5] [expr $line_bar_B + 4]] + set lines1 [line_range_pattern [expr {$line_bar_A - 5}] [expr {$line_bar_A + 4}]] + set lines2 [line_range_pattern [expr {$line_bar_B - 5}] [expr {$line_bar_B + 4}]] set any "\[^\r\n\]*" set h1_re "file: \"${any}overload.cc\", line number: $line_bar_A, symbol: \"bar\\(A\\)\"" diff --git a/gdb/testsuite/gdb.cp/ovldbreak.exp b/gdb/testsuite/gdb.cp/ovldbreak.exp index fd9fb94..9b8c6d1 100644 --- a/gdb/testsuite/gdb.cp/ovldbreak.exp +++ b/gdb/testsuite/gdb.cp/ovldbreak.exp @@ -253,7 +253,7 @@ gdb_test "info break" $bptable "breakpoint info, after setting one-by-one" # Test choice "cancel". # This is copy-and-paste from set_bp_overloaded. -send_gdb "break foo::overload1arg\n" +send_gdb "break foo::overload1arg\n" gdb_expect { -re "$menu_overload1arg" { pass "bp menu for foo::overload1arg choice cancel" @@ -333,7 +333,7 @@ gdb_test "info breakpoints" "No breakpoints, watchpoints, tracepoints, or catchp # This is copy-and-paste from set_bp_overloaded. incr bpnum -send_gdb "break foo::overload1arg\n" +send_gdb "break foo::overload1arg\n" gdb_expect { -re "$menu_overload1arg" { pass "bp menu for foo::overload1arg choice all" @@ -402,7 +402,7 @@ proc continue_to_bp_overloaded {bpnumber might_fail line argtype argument} { } -re "Continuing.\r\n\r\nBreakpoint $bkptno_num_re, foo::overload1arg \\(this=${hex}, arg=.*\\) at .*$srcfile:$line\r\n$decimal\[\t \]+{ $body }.*$gdb_prompt $" { - if $might_kfail { + if {$might_kfail} { kfail "c++/8130" "continue to bp overloaded : $argtype" } else { fail "continue to bp overloaded : $argtype" diff --git a/gdb/testsuite/gdb.cp/pass-by-ref.exp b/gdb/testsuite/gdb.cp/pass-by-ref.exp index 75b5257..4c12666 100644 --- a/gdb/testsuite/gdb.cp/pass-by-ref.exp +++ b/gdb/testsuite/gdb.cp/pass-by-ref.exp @@ -115,7 +115,7 @@ proc generate_member_function { classname signature length state } { set definition "$classname\:\:$signature { data\[0\] = $CUSTOM; - data\[[expr $length - 1]\] = $CUSTOM; + data\[[expr {$length - 1}]\] = $CUSTOM; tracer = $TRACE; }\n" } @@ -177,7 +177,7 @@ proc generate_class { classname length states } { $classname\:\:$classname (void) { data\[0\] = $ORIGINAL; - data\[[expr $length - 1]\] = $ORIGINAL; + data\[[expr {$length - 1}]\] = $ORIGINAL; } $definitions @@ -398,7 +398,7 @@ proc test_for_class { prefix states cbvfun data_field length} { gdb_test "print ${name}_var.${data_field}\[0\]" " = $ORIGINAL" \ "cbv argument should not change, item 0" if {$length > 1} { - set last_index [expr $length - 1] + set last_index [expr {$length - 1}] gdb_test "print ${name}_var.${data_field}\[$last_index\]" \ " = $ORIGINAL" \ "cbv argument should not change, item $last_index" diff --git a/gdb/testsuite/gdb.cp/psmang.exp b/gdb/testsuite/gdb.cp/psmang.exp index 67bc9cd9..7f9ce69 100644 --- a/gdb/testsuite/gdb.cp/psmang.exp +++ b/gdb/testsuite/gdb.cp/psmang.exp @@ -25,7 +25,7 @@ # sure the test still fails: # # 2002-08-29 Jim Blandy <jimb@redhat.com> -# +# # * symtab.c (lookup_symbol_aux): In the cases where we find a # minimal symbol of an appropriate name and use its address to # select a symtab to read and search, use `name' (as passed to us) @@ -35,14 +35,14 @@ # The original bug was that you'd try to set a breakpoint on a method # (e.g., `break s::method1'), and you'd get an error, but if you # repeated the command, it would work the second time: -# +# # (gdb) break s::method1 # the class s does not have any method named method1 # Hint: try 's::method1<TAB> or 's::method1<ESC-?> # (Note leading single quote.) # (gdb) break s::method1 # Breakpoint 1 at 0x804841b: file psmang1.cc, line 13. -# (gdb) +# (gdb) # # We observed this bug first using Stabs, and then using Dwarf 2. # diff --git a/gdb/testsuite/gdb.cp/rvalue-ref-params.exp b/gdb/testsuite/gdb.cp/rvalue-ref-params.exp index 267dbc7..91f79ea 100644 --- a/gdb/testsuite/gdb.cp/rvalue-ref-params.exp +++ b/gdb/testsuite/gdb.cp/rvalue-ref-params.exp @@ -49,7 +49,7 @@ gdb_test "print static_cast<int&&> (global_int)" " = \\(int &&\\) @$hex: 7" gdb_test "print static_cast<float&> (global_float)" " = \\(float &\\) @$hex: 3\\.$decimal" gdb_test "print static_cast<float&&> (global_float)" " = \\(float &&\\) @$hex: 3\\.$decimal" -set t "print value of f2 on (Child&&) in main" +set t "print value of f2 on (Child&&) in main" gdb_start_again "marker1 here" $t gdb_test "print f2(static_cast<Child&&>(Q))" ".* = 40.*" $t diff --git a/gdb/testsuite/gdb.cp/rvalue-ref-types.exp b/gdb/testsuite/gdb.cp/rvalue-ref-types.exp index 571ab81..596abe7 100644 --- a/gdb/testsuite/gdb.cp/rvalue-ref-types.exp +++ b/gdb/testsuite/gdb.cp/rvalue-ref-types.exp @@ -38,7 +38,7 @@ if {![runto 'marker1']} { gdb_test "up" ".*main.*" "up from marker1 1" -gdb_test "print rrt" " = \\(short( int)? &&\\) @$hex: -1" "print value of rrt" +gdb_test "print rrt" " = \\(short( int)? &&\\) @$hex: -1" "print value of rrt" gdb_test "ptype rrt" "type = short( int)? &&" diff --git a/gdb/testsuite/gdb.cp/save-bp-qualified.exp b/gdb/testsuite/gdb.cp/save-bp-qualified.exp index f59be3b..ae7a9d5 100644 --- a/gdb/testsuite/gdb.cp/save-bp-qualified.exp +++ b/gdb/testsuite/gdb.cp/save-bp-qualified.exp @@ -26,7 +26,7 @@ proc restart {} { clean_restart $testfile - if ![runto_main] { + if {![runto_main]} { return 0 } # Delete all breakpoints, watchpoints, tracepoints, and catchpoints so that @@ -37,7 +37,7 @@ proc restart {} { } with_test_prefix "save" { - if ![restart] { + if {![restart]} { return -1 } @@ -55,7 +55,7 @@ with_test_prefix "save" { } with_test_prefix "restore" { - if ![restart] { + if {![restart]} { return -1 } diff --git a/gdb/testsuite/gdb.cp/static-typedef-print.exp b/gdb/testsuite/gdb.cp/static-typedef-print.exp index 1f0387f..1f06dee 100644 --- a/gdb/testsuite/gdb.cp/static-typedef-print.exp +++ b/gdb/testsuite/gdb.cp/static-typedef-print.exp @@ -21,7 +21,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.cp/step-and-next-inline.exp b/gdb/testsuite/gdb.cp/step-and-next-inline.exp index 492a46f..92caed1 100644 --- a/gdb/testsuite/gdb.cp/step-and-next-inline.exp +++ b/gdb/testsuite/gdb.cp/step-and-next-inline.exp @@ -81,7 +81,7 @@ proc do_test { use_header } { clean_restart $executable - if ![runto $main_location qualified] { + if {![runto $main_location qualified]} { return } @@ -105,7 +105,7 @@ proc do_test { use_header } { # that some easier heuristic could be figured out). Still, it is # not certain that the first failure wouldn't also be fixed by # having location view support, so for now it is tagged as such. - set have_kfail [expr [test_compiler_info gcc*] && !$use_header] + set have_kfail [expr {[test_compiler_info gcc*] && !$use_header}] set ok 1 gdb_test_multiple "next" "next step 1" { @@ -206,7 +206,7 @@ proc do_test { use_header } { clean_restart ${executable} - if ![runto_main] { + if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.cp/subtypes.exp b/gdb/testsuite/gdb.cp/subtypes.exp index e3b8de0..540086c 100644 --- a/gdb/testsuite/gdb.cp/subtypes.exp +++ b/gdb/testsuite/gdb.cp/subtypes.exp @@ -31,7 +31,7 @@ if {[prepare_for_testing "failed to prepare" $testfile \ } # Xfail for superfluous DW_TAG_lexical_block, gcc PR debug/55541. -set have_xfail [expr [test_compiler_info gcc-*] && [gcc_major_version] < 5] +set have_xfail [expr {[test_compiler_info gcc-*] && [gcc_major_version] < 5}] gdb_test "ptype Outer::Inner::InnerInner" \ "type = struct Outer::Inner::InnerInner.*" diff --git a/gdb/testsuite/gdb.cp/temargs.exp b/gdb/testsuite/gdb.cp/temargs.exp index d2f70fa..750f739 100644 --- a/gdb/testsuite/gdb.cp/temargs.exp +++ b/gdb/testsuite/gdb.cp/temargs.exp @@ -76,13 +76,13 @@ gdb_test "break $srcfile:$line" "Breakpoint 7.*" \ gdb_continue_to_breakpoint "continue to first breakpoint for temargs" -if $have_older_template_gcc { setup_xfail "*-*-*" } +if {$have_older_template_gcc} { setup_xfail "*-*-*" } gdb_test "ptype T" "double" "test type of T in base_m" -if $have_older_template_gcc { setup_xfail "*-*-*" } +if {$have_older_template_gcc} { setup_xfail "*-*-*" } gdb_test "print I" " = 23" "test value of I in base_m" -if $have_older_template_gcc { setup_xfail "*-*-*" } +if {$have_older_template_gcc} { setup_xfail "*-*-*" } gdb_test "print P == &a_global" " = true" "test value of P in base_m" if {!$have_pr_41736_fixed} { setup_xfail *-*-* } @@ -101,7 +101,7 @@ gdb_test "ptype T" "long" "test type of T in inner_m" if {!$have_pr_45024_fixed} { setup_xfail *-*-* } gdb_test "print I" " = 47" "test value of I in inner_m" -if $have_older_template_gcc { setup_xfail "*-*-*" +if {$have_older_template_gcc} { setup_xfail "*-*-*" } elseif {[test_compiler_info {gcc-[0-3]-*}] || [test_compiler_info {gcc-4-[0-5]-*}]} { # gcc-4.5.x still does not emit inner DW_TAG_structure_type. @@ -112,7 +112,7 @@ gdb_test "print P == &a_global" " = true" "test value of P in inner_m" if {!$have_pr_41736_fixed} { setup_xfail *-*-* } gdb_test "print MP" "&S::f" "test value of MP in inner_m" -if $have_older_template_gcc { setup_xfail "*-*-*" +if {$have_older_template_gcc} { setup_xfail "*-*-*" } elseif {[test_compiler_info {gcc-[0-3]-*}] || [test_compiler_info {gcc-4-[0-5]-*}]} { # gcc-4.5.x still does not emit outer DW_TAG_structure_type. @@ -126,17 +126,17 @@ gdb_test "whatis Z" "float" "test type of Z in inner_m" gdb_continue_to_breakpoint "continue to third breakpoint for temargs" -if $have_older_template_gcc { setup_xfail "*-*-*" } +if {$have_older_template_gcc} { setup_xfail "*-*-*" } gdb_test "ptype T" "unsigned char" "test type of T in func" -if $have_older_template_gcc { setup_xfail "*-*-*" } +if {$have_older_template_gcc} { setup_xfail "*-*-*" } gdb_test "print I" " = 91" "test value of I in func" # PR symtab/16842 - gdb used to crash here. -if $have_older_template_gcc { setup_xfail "*-*-*" } +if {$have_older_template_gcc} { setup_xfail "*-*-*" } gdb_test "info addr I" "Symbol \"I\" is constant." "test address of I in func" -if $have_older_template_gcc { setup_xfail "*-*-*" } +if {$have_older_template_gcc} { setup_xfail "*-*-*" } gdb_test "print P == &a_global" " = true" "test value of P in func" if {!$have_pr_41736_fixed} { setup_xfail *-*-* } @@ -148,23 +148,23 @@ gdb_test "print MP" "&S::f" "test value of MP in func" gdb_continue_to_breakpoint "continue to fourth breakpoint for temargs" -if $have_older_template_gcc { setup_xfail "*-*-*" } +if {$have_older_template_gcc} { setup_xfail "*-*-*" } gdb_test "ptype T" "double" "test type of T in templ_m" -if $have_older_template_gcc { setup_xfail "*-*-*" } +if {$have_older_template_gcc} { setup_xfail "*-*-*" } gdb_test "print I" " = 23" "test value of I in templ_m" # PR symtab/16842 - gdb used to crash here. -if $have_older_template_gcc { setup_xfail "*-*-*" } +if {$have_older_template_gcc} { setup_xfail "*-*-*" } gdb_test "info addr I" "Symbol \"I\" is constant." "test address of I in templ_m" -if $have_older_template_gcc { setup_xfail "*-*-*" } +if {$have_older_template_gcc} { setup_xfail "*-*-*" } gdb_test "print P == &a_global" " = true" "test value of P in templ_m" if {!$have_pr_41736_fixed} { setup_xfail *-*-* } gdb_test "print MP" "&S::f" "test value of MP in templ_m" -if $have_older_template_gcc { setup_xfail "*-*-*" } +if {$have_older_template_gcc} { setup_xfail "*-*-*" } gdb_test "whatis Q" "short" "test type of Q in templ_m" # @@ -173,7 +173,7 @@ gdb_test "whatis Q" "short" "test type of Q in templ_m" gdb_continue_to_breakpoint "continue to fifth breakpoint for temargs" -if $have_older_template_gcc { setup_xfail "*-*-*" } +if {$have_older_template_gcc} { setup_xfail "*-*-*" } gdb_test "ptype F" "type = void \\\(S::\\\*\\\)\\\(S \\\* const\\\)" \ "test type of F in k2_m" @@ -189,11 +189,11 @@ gdb_test "print F" "&S::somefunc" "test value of F in k2_m" gdb_continue_to_breakpoint "continue to sixth breakpoint for temargs" -if $have_older_template_gcc { setup_xfail "*-*-*" +if {$have_older_template_gcc} { setup_xfail "*-*-*" } elseif { $using_gcc } { setup_xfail gcc/49546 "*-*-*" } gdb_test "ptype F" {type = void \(\*\)\(int\)} "test type of F in k3_m" -if $have_older_template_gcc { setup_xfail "*-*-*" +if {$have_older_template_gcc} { setup_xfail "*-*-*" } elseif { $using_gcc } { setup_xfail gcc/49546 "*-*-*" } gdb_test "print F" { = \(void \(\*\)\(int\)\) 0x[0-9a-f]+ <S3::m\(int\)>} \ "test value of F in k3_m" diff --git a/gdb/testsuite/gdb.cp/templates.exp b/gdb/testsuite/gdb.cp/templates.exp index 52d0229..6dd4e66 100644 --- a/gdb/testsuite/gdb.cp/templates.exp +++ b/gdb/testsuite/gdb.cp/templates.exp @@ -143,7 +143,7 @@ proc test_template_breakpoints {} { "constructor breakpoint (bad menu choices)" } } - + gdb_test_multiple "break T5<int>::~T5" "destructor_breakpoint" { -re "Breakpoint.*at.* file .*${testfile}.cc, line.*$gdb_prompt $" { @@ -154,7 +154,7 @@ proc test_template_breakpoints {} { kfail "gdb/8217" "destructor breakpoint" } } - + gdb_test "break T5<int>::value" \ "Breakpoint.*at.* file .*${testfile}.cc, line.*" \ "value method breakpoint" @@ -191,7 +191,7 @@ proc test_template_breakpoints {} { proc test_template_calls {} { global gdb_prompt - if [target_info exists gdb,cannot_call_functions] { + if {[target_info exists gdb,cannot_call_functions]} { unsupported "this target can not call functions" return } @@ -264,7 +264,7 @@ proc do_tests {} { test_template_typedef test_template_args - if [ runto_main] { + if {[ runto_main]} { test_template_calls } } diff --git a/gdb/testsuite/gdb.cp/typedef-base.exp b/gdb/testsuite/gdb.cp/typedef-base.exp index 2421b59..a6780da 100644 --- a/gdb/testsuite/gdb.cp/typedef-base.exp +++ b/gdb/testsuite/gdb.cp/typedef-base.exp @@ -23,7 +23,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.cp/typedef-operator.exp b/gdb/testsuite/gdb.cp/typedef-operator.exp index 94232d7..9214371 100644 --- a/gdb/testsuite/gdb.cp/typedef-operator.exp +++ b/gdb/testsuite/gdb.cp/typedef-operator.exp @@ -27,7 +27,7 @@ gdb_test_no_output "set language c++" gdb_test "p *u" {You can't do that without a process to debug.} "test crash" -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.cp/typeid.exp b/gdb/testsuite/gdb.cp/typeid.exp index e45239a..bd97b26 100644 --- a/gdb/testsuite/gdb.cp/typeid.exp +++ b/gdb/testsuite/gdb.cp/typeid.exp @@ -63,7 +63,7 @@ with_test_prefix "before starting" { do_typeid_tests 0 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.cp/userdef.exp b/gdb/testsuite/gdb.cp/userdef.exp index 27f981d..05ff8b7 100644 --- a/gdb/testsuite/gdb.cp/userdef.exp +++ b/gdb/testsuite/gdb.cp/userdef.exp @@ -32,7 +32,7 @@ if {![runto_main]} { } gdb_test "break marker1" \ - "Breakpoint .*${srcfile}.*" + "Breakpoint .*${srcfile}.*" gdb_test "cont" \ "Break.* marker1(\\(\\)|) \\(\\) at .*:$decimal.*" \ @@ -58,7 +58,7 @@ gdb_test_multiple "frame" "re-selected 'main' frame after inferior call" { pass "re-selected 'main' frame after inferior call" } } - + gdb_test "print one - two" "\\\$\[0-9\]* = {x = -2, y = -2}" gdb_test "print one * two" "\\\$\[0-9\]* = {x = 8, y = 15}" diff --git a/gdb/testsuite/gdb.cp/virtfunc.exp b/gdb/testsuite/gdb.cp/virtfunc.exp index 391844d..e63d64a 100644 --- a/gdb/testsuite/gdb.cp/virtfunc.exp +++ b/gdb/testsuite/gdb.cp/virtfunc.exp @@ -176,7 +176,7 @@ proc test_virtual_calls {} { global gdb_prompt global nl - if [target_info exists gdb,cannot_call_functions] { + if {[target_info exists gdb,cannot_call_functions]} { unsupported "this target can not call functions" return 0 } diff --git a/gdb/testsuite/gdb.cp/vla-cxx.exp b/gdb/testsuite/gdb.cp/vla-cxx.exp index 8f19552..10f598d 100644 --- a/gdb/testsuite/gdb.cp/vla-cxx.exp +++ b/gdb/testsuite/gdb.cp/vla-cxx.exp @@ -23,7 +23,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $flags] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp b/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp index 292be70..9078068 100644 --- a/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp +++ b/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp @@ -160,7 +160,7 @@ proc_with_prefix no_url { } { # Generate a core file and test that GDB cannot find the # executable. clean_restart ${::testfile}2 - if ![runto_main] { + if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/anon-ns-fn.exp b/gdb/testsuite/gdb.dwarf2/anon-ns-fn.exp index 4f6701f..4017744 100644 --- a/gdb/testsuite/gdb.dwarf2/anon-ns-fn.exp +++ b/gdb/testsuite/gdb.dwarf2/anon-ns-fn.exp @@ -17,7 +17,7 @@ require allow_cplus_tests standard_testfile .cc -if [prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}] { +if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/bad-regnum.exp b/gdb/testsuite/gdb.dwarf2/bad-regnum.exp index eea13af..f81826f 100644 --- a/gdb/testsuite/gdb.dwarf2/bad-regnum.exp +++ b/gdb/testsuite/gdb.dwarf2/bad-regnum.exp @@ -65,7 +65,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/bitfield-parent-optimized-out.exp b/gdb/testsuite/gdb.dwarf2/bitfield-parent-optimized-out.exp index 82eaed7..59330ac 100644 --- a/gdb/testsuite/gdb.dwarf2/bitfield-parent-optimized-out.exp +++ b/gdb/testsuite/gdb.dwarf2/bitfield-parent-optimized-out.exp @@ -69,11 +69,11 @@ Dwarf::assemble $asm_file { } } -if [prepare_for_testing "failed to prepare" $executable "${asm_file} ${srcfile}" {}] { +if {[prepare_for_testing "failed to prepare" $executable "${asm_file} ${srcfile}" {}]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/break-inline-psymtab.exp b/gdb/testsuite/gdb.dwarf2/break-inline-psymtab.exp index a9eddc3..ff9f41f 100644 --- a/gdb/testsuite/gdb.dwarf2/break-inline-psymtab.exp +++ b/gdb/testsuite/gdb.dwarf2/break-inline-psymtab.exp @@ -20,7 +20,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} $sources] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/callframecfa.exp b/gdb/testsuite/gdb.dwarf2/callframecfa.exp index 712e51e..2dd036f 100644 --- a/gdb/testsuite/gdb.dwarf2/callframecfa.exp +++ b/gdb/testsuite/gdb.dwarf2/callframecfa.exp @@ -27,7 +27,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/clztest.exp b/gdb/testsuite/gdb.dwarf2/clztest.exp index 93c2ced..554077a 100644 --- a/gdb/testsuite/gdb.dwarf2/clztest.exp +++ b/gdb/testsuite/gdb.dwarf2/clztest.exp @@ -29,7 +29,7 @@ if { [prepare_for_testing "failed to prepare" "${test}" ${test}.S \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/comp-unit-lang.exp b/gdb/testsuite/gdb.dwarf2/comp-unit-lang.exp index f4d9195..b1e890c 100644 --- a/gdb/testsuite/gdb.dwarf2/comp-unit-lang.exp +++ b/gdb/testsuite/gdb.dwarf2/comp-unit-lang.exp @@ -59,7 +59,7 @@ proc do_test {cu_lang gdb_lang} { return -1 } - if ![runto func] { + if {![runto func]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/count.exp b/gdb/testsuite/gdb.dwarf2/count.exp index 4d2ec31..92b0ebf 100644 --- a/gdb/testsuite/gdb.dwarf2/count.exp +++ b/gdb/testsuite/gdb.dwarf2/count.exp @@ -130,7 +130,7 @@ if { [prepare_for_testing "failed to prepare" $testfile \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/data-loc.exp b/gdb/testsuite/gdb.dwarf2/data-loc.exp index 94b9e09..615d04b 100644 --- a/gdb/testsuite/gdb.dwarf2/data-loc.exp +++ b/gdb/testsuite/gdb.dwarf2/data-loc.exp @@ -124,7 +124,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/debug-names-duplicate-cu.exp b/gdb/testsuite/gdb.dwarf2/debug-names-duplicate-cu.exp index 28f2157..583b230 100644 --- a/gdb/testsuite/gdb.dwarf2/debug-names-duplicate-cu.exp +++ b/gdb/testsuite/gdb.dwarf2/debug-names-duplicate-cu.exp @@ -59,8 +59,8 @@ Dwarf::assemble { } } -if [prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" \ - [list ldflags=-nostartfiles]] { +if {[prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" \ + [list ldflags=-nostartfiles]]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/debug-names-missing-cu.exp b/gdb/testsuite/gdb.dwarf2/debug-names-missing-cu.exp index 77db144..936cfe5 100644 --- a/gdb/testsuite/gdb.dwarf2/debug-names-missing-cu.exp +++ b/gdb/testsuite/gdb.dwarf2/debug-names-missing-cu.exp @@ -66,8 +66,8 @@ Dwarf::assemble { } } -if [prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" \ - [list ldflags=-nostartfiles]] { +if {[prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" \ + [list ldflags=-nostartfiles]]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/debug-names-tu.exp.tcl b/gdb/testsuite/gdb.dwarf2/debug-names-tu.exp.tcl index 4de96ff..19d618f 100644 --- a/gdb/testsuite/gdb.dwarf2/debug-names-tu.exp.tcl +++ b/gdb/testsuite/gdb.dwarf2/debug-names-tu.exp.tcl @@ -83,8 +83,8 @@ Dwarf::assemble { } } -if [prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" \ - [list ldflags=-nostartfiles]] { +if {[prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" \ + [list ldflags=-nostartfiles]]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/debug-names.exp b/gdb/testsuite/gdb.dwarf2/debug-names.exp index 7f63af2..d099aa9 100644 --- a/gdb/testsuite/gdb.dwarf2/debug-names.exp +++ b/gdb/testsuite/gdb.dwarf2/debug-names.exp @@ -58,8 +58,8 @@ Dwarf::assemble { } } -if [prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" \ - [list ldflags=-nostartfiles]] { +if {[prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" \ + [list ldflags=-nostartfiles]]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw-form-strx-out-of-bounds.exp b/gdb/testsuite/gdb.dwarf2/dw-form-strx-out-of-bounds.exp index cb24b19..f312885 100644 --- a/gdb/testsuite/gdb.dwarf2/dw-form-strx-out-of-bounds.exp +++ b/gdb/testsuite/gdb.dwarf2/dw-form-strx-out-of-bounds.exp @@ -24,7 +24,7 @@ require !readnow set prepare_for_testing_done 0 source $srcdir/$subdir/dw-form-strx.exp.tcl -require {expr $prepare_for_testing_done == 1} +require {expr {$prepare_for_testing_done == 1}} set re_dwarf_error \ [string_list_to_regexp \ diff --git a/gdb/testsuite/gdb.dwarf2/dw-form-strx.exp b/gdb/testsuite/gdb.dwarf2/dw-form-strx.exp index 3f739c4..7153314 100644 --- a/gdb/testsuite/gdb.dwarf2/dw-form-strx.exp +++ b/gdb/testsuite/gdb.dwarf2/dw-form-strx.exp @@ -20,6 +20,6 @@ set int_str_idx 0 set prepare_for_testing_done 0 source $srcdir/$subdir/dw-form-strx.exp.tcl -require {expr $prepare_for_testing_done == 1} +require {expr {$prepare_for_testing_done == 1}} gdb_test "ptype global_var" "type = int" diff --git a/gdb/testsuite/gdb.dwarf2/dw2-align.exp b/gdb/testsuite/gdb.dwarf2/dw2-align.exp index dfb11af8..84f016b 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-align.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-align.exp @@ -71,7 +71,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bad-elf.exp b/gdb/testsuite/gdb.dwarf2/dw2-bad-elf.exp index a0ae498..429386f 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-bad-elf.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-bad-elf.exp @@ -173,7 +173,7 @@ proc run_test { goto_main } { clean_restart ${::testfile} if { $goto_main } { - if ![runto_main] { + if {![runto_main]} { return -1 } } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bfloat16.exp b/gdb/testsuite/gdb.dwarf2/dw2-bfloat16.exp index b8f96a1..271b6ec 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-bfloat16.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-bfloat16.exp @@ -71,7 +71,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-canonicalize-type.exp b/gdb/testsuite/gdb.dwarf2/dw2-canonicalize-type.exp index 73567ad..b5ad32b 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-canonicalize-type.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-canonicalize-type.exp @@ -23,8 +23,8 @@ set additional_flags [gdb_target_symbol_prefix_flags_asm] standard_testfile .S set executable ${testfile} -if [prepare_for_testing "failed to prepare" $testfile $srcfile \ - [list nodebug $additional_flags]] { +if {[prepare_for_testing "failed to prepare" $testfile $srcfile \ + [list nodebug $additional_flags]]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp b/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp index afe23a6..13015a3 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp @@ -19,7 +19,7 @@ require dwarf2_support standard_testfile .c -debug.S -if [is_ilp32_target] { +if {[is_ilp32_target]} { set ptrbits 32 } else { set ptrbits 64 diff --git a/gdb/testsuite/gdb.dwarf2/dw2-complex-parts.exp b/gdb/testsuite/gdb.dwarf2/dw2-complex-parts.exp index 509924a..2ad358f 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-complex-parts.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-complex-parts.exp @@ -31,8 +31,8 @@ require dwarf2_support standard_testfile main.c -debug.S -if [prepare_for_testing "failed to prepare" $testfile \ - "${srcfile}" {}] { +if {[prepare_for_testing "failed to prepare" $testfile \ + "${srcfile}" {}]} { return -1 } @@ -67,19 +67,19 @@ Dwarf::assemble $asm_file { declare_labels cf_type cd_type cld_type cf_type: DW_TAG_base_type { - DW_AT_byte_size [expr 2 * $::float_size] DW_FORM_sdata + DW_AT_byte_size [expr {2 * $::float_size}] DW_FORM_sdata DW_AT_encoding @DW_ATE_complex_float DW_AT_name "complex float" } cd_type: DW_TAG_base_type { - DW_AT_byte_size [expr 2 * $::double_size] DW_FORM_sdata + DW_AT_byte_size [expr {2 * $::double_size}] DW_FORM_sdata DW_AT_encoding @DW_ATE_complex_float DW_AT_name "complex double" } cld_type: DW_TAG_base_type { - DW_AT_byte_size [expr 2 * $::long_double_size] DW_FORM_sdata + DW_AT_byte_size [expr {2 * $::long_double_size}] DW_FORM_sdata DW_AT_encoding @DW_ATE_complex_float DW_AT_name "complex long double" } @@ -105,7 +105,7 @@ Dwarf::assemble $asm_file { declare_labels ci_type ci_type: DW_TAG_base_type { - DW_AT_byte_size [expr 2 * $::int_size] DW_FORM_sdata + DW_AT_byte_size [expr {2 * $::int_size}] DW_FORM_sdata DW_AT_encoding @DW_ATE_lo_user DW_AT_name "complex int" } @@ -122,7 +122,7 @@ Dwarf::assemble $asm_file { declare_labels clang_cf_type clang_cd_type clang_cld_type clang_cf_type: DW_TAG_base_type { - DW_AT_byte_size [expr 2 * $::float_size] DW_FORM_sdata + DW_AT_byte_size [expr {2 * $::float_size}] DW_FORM_sdata DW_AT_encoding @DW_ATE_complex_float DW_AT_name "complex" } @@ -133,7 +133,7 @@ Dwarf::assemble $asm_file { } clang_cd_type: DW_TAG_base_type { - DW_AT_byte_size [expr 2 * $::double_size] DW_FORM_sdata + DW_AT_byte_size [expr {2 * $::double_size}] DW_FORM_sdata DW_AT_encoding @DW_ATE_complex_float DW_AT_name "complex" } @@ -144,7 +144,7 @@ Dwarf::assemble $asm_file { } clang_cld_type: DW_TAG_base_type { - DW_AT_byte_size [expr 2 * $::long_double_size] DW_FORM_sdata + DW_AT_byte_size [expr {2 * $::long_double_size}] DW_FORM_sdata DW_AT_encoding @DW_ATE_complex_float DW_AT_name "complex" } @@ -157,12 +157,12 @@ Dwarf::assemble $asm_file { } } -if [prepare_for_testing "failed to prepare" $testfile \ - "${asm_file} ${srcfile}" {}] { +if {[prepare_for_testing "failed to prepare" $testfile \ + "${asm_file} ${srcfile}" {}]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } @@ -191,7 +191,7 @@ proc do_test { type {clang 0}} { gdb_test "ptype '$ctype'" \ "type = $ctype" - eval set type_size \$::${type_id}_size + set type_size [subst \$::${type_id}_size] gdb_test "p sizeof ('$type')" \ " = $type_size" @@ -200,7 +200,7 @@ proc do_test { type {clang 0}} { # With clang, the ctype name does not uniquely map to a type, # so the size is unpredictable. gdb_test "p sizeof ('$ctype')" \ - " = [expr 2 * $type_size]" + " = [expr {2 * $type_size}]" } set re_kfail \ diff --git a/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp b/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp index 696ccfa..8cf941d 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp @@ -449,7 +449,7 @@ remote_exec host "sh -c \"for d in $dircreatelist; do cp ${srcdir}/${subdir}/${s clean_restart ${testfile} -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-disasm-over-non-stmt.exp b/gdb/testsuite/gdb.dwarf2/dw2-disasm-over-non-stmt.exp index ddbab26..eb7a6d8 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-disasm-over-non-stmt.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-disasm-over-non-stmt.exp @@ -97,7 +97,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-dos-drive.exp b/gdb/testsuite/gdb.dwarf2/dw2-dos-drive.exp index 66368ca..3bbd5b8 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-dos-drive.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-dos-drive.exp @@ -29,8 +29,8 @@ gdb_test_no_output "set breakpoint pending off" gdb_test "break 'z:file.c':func" {Breakpoint [0-9]+ at .*} -set dos [expr [istarget "*-*-cygwin*"] || [istarget "i?86-*-mingw*"] \ - || [istarget "*-*-msdosdjgpp*"] || [istarget "*-*-go32*"] ] +set dos [expr {[istarget "*-*-cygwin*"] || [istarget "i?86-*-mingw*"] \ + || [istarget "*-*-msdosdjgpp*"] || [istarget "*-*-go32*"]}] if { $dos } { gdb_test "break file.c:func" {Breakpoint [0-9]+ at .*} diff --git a/gdb/testsuite/gdb.dwarf2/dw2-dup-frame.exp b/gdb/testsuite/gdb.dwarf2/dw2-dup-frame.exp index b1980e8..6274bbf 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-dup-frame.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-dup-frame.exp @@ -26,7 +26,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile {nodebug nopie} return -1 } -if ![runto stop_frame] { +if {![runto stop_frame]} { perror "Failed to stop in stop_frame" return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-entry-pc.exp b/gdb/testsuite/gdb.dwarf2/dw2-entry-pc.exp index 1a0eeba..1099edb 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-entry-pc.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-entry-pc.exp @@ -32,7 +32,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } @@ -60,7 +60,7 @@ foreach var { r1_s r1_e r2_s r2_e r3_s r3_e } { # Line on which 'foo' is declared. Used in generated debug. set foo_decl_line [gdb_get_line_number "foo decl line"] -if [is_ilp32_target] { +if {[is_ilp32_target]} { set ptr_type "data4" } else { set ptr_type "data8" @@ -87,7 +87,7 @@ proc build_and_runto_main { suffix asm_file } { return false } - if ![runto_main] { + if {![runto_main]} { return false } @@ -244,7 +244,7 @@ proc_with_prefix use_low_high_bounds_with_entry_offset { dwarf_version } { declare_labels lines_table - set foo_offset [expr $::foo_middle_addr - $::foo_start_addr] + set foo_offset [expr {$::foo_middle_addr - $::foo_start_addr}] cu { version $::dwarf_version } { compile_unit { @@ -420,7 +420,7 @@ proc_with_prefix use_ranges_with_entry_offset { dwarf_version } { declare_labels lines_table ranges_label - set foo_offset [expr $::foo_middle_addr - $::r1_s] + set foo_offset [expr {$::foo_middle_addr - $::r1_s}] cu { version $::dwarf_version } { compile_unit { diff --git a/gdb/testsuite/gdb.dwarf2/dw2-entry-points.exp b/gdb/testsuite/gdb.dwarf2/dw2-entry-points.exp index 97194d5..2dda0e5 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-entry-points.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-entry-points.exp @@ -176,7 +176,7 @@ if {[prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } @@ -201,7 +201,7 @@ gdb_test "bt" [multi_line \ clean_restart ${testfile} -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-entry-value.exp b/gdb/testsuite/gdb.dwarf2/dw2-entry-value.exp index e0f208c..fed0d2e 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-entry-value.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-entry-value.exp @@ -21,7 +21,7 @@ if { [prepare_for_testing "failed to prepare" "dw2-entry-value" {dw2-entry-value return -1 } -if ![runto f] { +if {![runto f]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin.exp.tcl b/gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin.exp.tcl index 7e60b6e..9c0622c 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin.exp.tcl +++ b/gdb/testsuite/gdb.dwarf2/dw2-epilogue-begin.exp.tcl @@ -169,7 +169,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-fixed-point.exp b/gdb/testsuite/gdb.dwarf2/dw2-fixed-point.exp index 7666089..e8a8083 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-fixed-point.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-fixed-point.exp @@ -117,7 +117,7 @@ if { [prepare_for_testing ${testfile}.exp ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-gas-workaround.exp b/gdb/testsuite/gdb.dwarf2/dw2-gas-workaround.exp index 6611bf3..8c09406 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-gas-workaround.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-gas-workaround.exp @@ -30,7 +30,7 @@ with_shared_gdb { proc line_for { l } { global srcfile set line [gdb_get_line_number "$l:" $srcfile] - return [expr $line + 1] + return [expr {$line + 1}] } # A helper proc to create the DWARF assembly for the test. diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.exp b/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.exp index ef48038..0a1f5d8 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.exp @@ -62,7 +62,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto func] { +if {![runto func]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp index ecf0614..99f0080 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp @@ -157,7 +157,7 @@ proc do_test { start_label func_name tag } { return -1 } - if ![runto_main] { + if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp index 3d08ac0..8d68aa1 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp @@ -145,7 +145,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp index ad914b9..77a64a2 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp @@ -134,7 +134,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-many-frames.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-many-frames.exp index e8668e0..e97f325 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-inline-many-frames.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-many-frames.exp @@ -289,7 +289,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-param.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-param.exp index 938f16d..c4cc63c 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-inline-param.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-param.exp @@ -42,7 +42,7 @@ gdb_unload set objcopy_program [gdb_find_objcopy] set command "$objcopy_program -N block_start -N block_end -N break_at ${binfile} ${binfile_stripped}" verbose -log "Executing: $command" -set result [catch "exec $command" output] +set result [catch {exec {*}$command} output] verbose "result is $result" verbose "output is $output" if {$result != 0} { @@ -51,7 +51,7 @@ if {$result != 0} { gdb_load ${binfile_stripped} -if ![runto "*${break_at}"] { +if {![runto "*${break_at}"]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.exp index a4309d4..0e9b0a2 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.exp @@ -123,7 +123,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-stepping.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-stepping.exp index a544616..e20e355 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-inline-stepping.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-stepping.exp @@ -126,7 +126,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inter-cu-error-2.exp b/gdb/testsuite/gdb.dwarf2/dw2-inter-cu-error-2.exp index 8e99cb4..f517807 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-inter-cu-error-2.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-inter-cu-error-2.exp @@ -43,8 +43,8 @@ Dwarf::assemble $asm_file { } } -if [build_executable "failed to prepare" $testfile \ - [list $asm_file $srcfile] {nodebug}] { +if {[build_executable "failed to prepare" $testfile \ + [list $asm_file $srcfile] {nodebug}]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inter-cu-error.exp b/gdb/testsuite/gdb.dwarf2/dw2-inter-cu-error.exp index ded5f10..6d3d86b 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-inter-cu-error.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-inter-cu-error.exp @@ -45,8 +45,8 @@ Dwarf::assemble $asm_file { } } -if [build_executable "failed to prepare" $testfile \ - [list $asm_file $srcfile] {nodebug}] { +if {[build_executable "failed to prepare" $testfile \ + [list $asm_file $srcfile] {nodebug}]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inter-cu-forth-and-back.exp b/gdb/testsuite/gdb.dwarf2/dw2-inter-cu-forth-and-back.exp index 0ae6004..b15d13d 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-inter-cu-forth-and-back.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-inter-cu-forth-and-back.exp @@ -55,8 +55,8 @@ Dwarf::assemble $asm_file { } } -if [prepare_for_testing "failed to prepare" $testfile \ - [list $asm_file $srcfile] {nodebug}] { +if {[prepare_for_testing "failed to prepare" $testfile \ + [list $asm_file $srcfile] {nodebug}]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inter-cu-symbol.exp b/gdb/testsuite/gdb.dwarf2/dw2-inter-cu-symbol.exp index fc72cf7..7fbe22e 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-inter-cu-symbol.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-inter-cu-symbol.exp @@ -77,7 +77,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto main] { +if {![runto main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-is-stmt-2.exp b/gdb/testsuite/gdb.dwarf2/dw2-is-stmt-2.exp index 77bac52..4da14d8 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-is-stmt-2.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-is-stmt-2.exp @@ -148,7 +148,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-is-stmt.exp b/gdb/testsuite/gdb.dwarf2/dw2-is-stmt.exp index 1b9ccaa..ff92fbd 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-is-stmt.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-is-stmt.exp @@ -99,7 +99,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.exp b/gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.exp index 144e62e..c51f710 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.exp @@ -113,7 +113,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } @@ -129,7 +129,7 @@ gdb_continue_to_breakpoint "bar2" "\[^\r\n\]*:41\r\n.*" gdb_test "n" "foo \\(2\\);" "bar2, 1st next" gdb_test "n" "foo \\(4\\);" "bar2, 2nd next" -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-lines.exp b/gdb/testsuite/gdb.dwarf2/dw2-lines.exp index 6eacf0b..fbaa53e 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-lines.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-lines.exp @@ -33,7 +33,7 @@ with_shared_gdb { proc line_for { l } { global srcfile set line [gdb_get_line_number "$l:" $srcfile] - return [expr $line + 1] + return [expr {$line + 1}] } # Execute test. @@ -119,7 +119,7 @@ proc test_1 { _cv _cdw64 _lv _ldw64 {_string_form ""}} { return -1 } - if ![runto_main] { + if {![runto_main]} { return -1 } @@ -135,9 +135,9 @@ proc test_1 { _cv _cdw64 _lv _ldw64 {_string_form ""}} { # Add unique test prefix. proc test { cv cdw64 lv ldw64 {string_form ""}} { with_test_prefix cv=$cv { - with_test_prefix cdw=[expr $cdw64 ? 64 : 32] { + with_test_prefix cdw=[expr {$cdw64 ? 64 : 32}] { with_test_prefix lv=$lv { - with_test_prefix ldw=[expr $ldw64 ? 64 : 32] { + with_test_prefix ldw=[expr {$ldw64 ? 64 : 32}] { if { $string_form == "" } { test_1 $cv $cdw64 $lv $ldw64 } else { diff --git a/gdb/testsuite/gdb.dwarf2/dw2-main-no-line-number.exp b/gdb/testsuite/gdb.dwarf2/dw2-main-no-line-number.exp index e05e4c9..f23366d 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-main-no-line-number.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-main-no-line-number.exp @@ -49,7 +49,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-minsym-in-cu.exp b/gdb/testsuite/gdb.dwarf2/dw2-minsym-in-cu.exp index cec3f15..05865f6 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-minsym-in-cu.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-minsym-in-cu.exp @@ -24,8 +24,8 @@ set additional_flags [gdb_target_symbol_prefix_flags_asm] standard_testfile .S -if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ - ${additional_flags}] { +if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ + ${additional_flags}]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-no-code-cu.exp b/gdb/testsuite/gdb.dwarf2/dw2-no-code-cu.exp index 6153def..7ff8a8a9 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-no-code-cu.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-no-code-cu.exp @@ -15,7 +15,7 @@ standard_testfile .c main.c -if [prepare_for_testing "failed to prepare" $testfile "$srcfile $srcfile2"] { +if {[prepare_for_testing "failed to prepare" $testfile "$srcfile $srcfile2"]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-noloc.exp b/gdb/testsuite/gdb.dwarf2/dw2-noloc.exp index 526f88a..00e2863 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-noloc.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-noloc.exp @@ -272,7 +272,7 @@ proc file_symbols {type} { file_symbols no-run -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-op-call.exp b/gdb/testsuite/gdb.dwarf2/dw2-op-call.exp index 5c412f4..26b2de2 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-op-call.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-op-call.exp @@ -34,7 +34,7 @@ gdb_test "p array2" " = 2" "array2 using DW_OP_call2" gdb_test "p array3" " = 3" "array3 using DW_OP_call4" # Location lists need PC. -if ![runto_main] { +if {![runto_main]} { return -1 } gdb_test "p arraynoloc" " = <optimized out>" diff --git a/gdb/testsuite/gdb.dwarf2/dw2-op-out-param.exp b/gdb/testsuite/gdb.dwarf2/dw2-op-out-param.exp index 14d5ab1..cc8985b 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-op-out-param.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-op-out-param.exp @@ -27,7 +27,7 @@ if { [prepare_for_testing "failed to prepare" "${test}" ${test}.S {nodebug}] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-opt-structptr.exp b/gdb/testsuite/gdb.dwarf2/dw2-opt-structptr.exp index 866df3a..76b9591 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-opt-structptr.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-opt-structptr.exp @@ -44,7 +44,7 @@ proc build_test_program {} { # Creating a CU with 4-byte addresses lets this test link on # both 32- and 64-bit machines. cu { addr_size 4 } { - + DW_TAG_compile_unit { DW_AT_language @DW_LANG_C99 DW_AT_name $srcfile @@ -58,7 +58,7 @@ proc build_test_program {} { DW_AT_encoding @DW_ATE_signed DW_AT_name integer } - + array_label: DW_TAG_array_type { DW_AT_name foo__array_type DW_AT_type :$int_label @@ -67,9 +67,9 @@ proc build_test_program {} { DW_AT_type :$int_label DW_AT_lower_bound 0 DW_FORM_data1 DW_AT_upper_bound 127 DW_FORM_data1 - } + } } - + struct_label: DW_TAG_structure_type { DW_AT_name "foo" DW_AT_byte_size 12 DW_FORM_sdata @@ -90,12 +90,12 @@ proc build_test_program {} { DW_AT_data_member_location 8 data1 } } - + pointer_label: DW_TAG_pointer_type { DW_AT_byte_size 4 DW_FORM_sdata DW_AT_type :$struct_label } - + DW_TAG_subprogram { DW_AT_name func01 DW_AT_type :$int_label @@ -108,7 +108,7 @@ proc build_test_program {} { DW_AT_location {} DW_FORM_block1 } } - + DW_TAG_subprogram { DW_AT_name main DW_AT_type :$int_label @@ -119,7 +119,7 @@ proc build_test_program {} { } } } - + set sources "$srcfile $asm_file" if {[build_executable "failed to compile" $testfile $sources {nodebug}]} { return -1 @@ -146,17 +146,17 @@ proc do_console_test {} { if {![runto func01]} { return -1 } - + gdb_test "info addr ptr" "Symbol \"ptr\" is optimized out." - + gdb_test "print ptr" "<optimized out>" - + gdb_test "print *ptr" "value has been optimized out" - + gdb_test "print ptr->a" "value has been optimized out" - + gdb_test "print ptr->x" "value has been optimized out" - + gdb_test "print ptr->y" "value has been optimized out" } } @@ -171,19 +171,19 @@ proc do_mi_test {} { global mi_gdb_prompt global binfile - + with_test_prefix "mi" { if {[mi_clean_restart $::testfile]} { return } - + # This causes GDB to dereference a pointer-to-structure when doing # -var-create. mi_gdb_test "-gdb-set print object on" ".*" "set print object on" - + mi_gdb_test "-break-insert main" ".*" "insert breakpoint main" mi_gdb_test "-break-insert func01" ".*" "insert breakpoint func01" - + # Run to main. Use an explicit expect here since the limited # debug info will result in output that isn't handled by the # MI test utilities. @@ -197,7 +197,7 @@ proc do_mi_test {} { fail "$test (timeout)" } } - + # Run to func01. Use an explicit expect here as above. set test "continue to func01" mi_send_resuming_command "exec-continue" "$test" @@ -209,14 +209,14 @@ proc do_mi_test {} { fail "$test (timeout)" } } - + # Test that -var-create for 'ptr' is successful. mi_create_varobj "var1" "ptr" "create varobj for ptr" set struct_foo_ptr \ [string cat \ [string_to_regexp "struct foo *"] "( $::re_address_class)?"] - + # Test that -var-list-children of 'ptr' is successful. mi_list_varobj_children "var1" \ [list \ diff --git a/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp b/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp index 70db471..76266ed 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp @@ -79,7 +79,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-param-error.exp b/gdb/testsuite/gdb.dwarf2/dw2-param-error.exp index 57ef6d0..e142292 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-param-error.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-param-error.exp @@ -24,7 +24,7 @@ if { [prepare_for_testing "failed to prepare" "${testfile}" \ return -1 } -if ![runto f] { +if {![runto f]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-prologue-end.exp b/gdb/testsuite/gdb.dwarf2/dw2-prologue-end.exp index 8e66abe..740ec44 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-prologue-end.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-prologue-end.exp @@ -83,7 +83,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } @@ -94,7 +94,7 @@ with_test_prefix "ignore-prologue-end" { clean_restart $::testfile gdb_test_no_output "maintenance set ignore-prologue-end-flag on" - if ![runto_main] { + if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp b/gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp index 9e39f6b..5e1f6cd 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp @@ -121,7 +121,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } @@ -163,7 +163,7 @@ gdb_test_multiple "maint info line-table gdb.dwarf2/dw2-ranges-base.c" \ exp_continue } -re "^$gdb_prompt $" { - gdb_assert [expr $end_seq_count == 3] $gdb_test_name + gdb_assert [expr {$end_seq_count == 3}] $gdb_test_name } -re ".*linetable: \\(\\(struct linetable \\*\\) 0x0\\):\r\nNo line table.\r\n" { exp_continue diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-func.exp b/gdb/testsuite/gdb.dwarf2/dw2-ranges-func.exp index 56aab60..6fc5ba5 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-func.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-func.exp @@ -203,7 +203,7 @@ proc do_test {suffix} { return -1 } - if ![runto_main] { + if {![runto_main]} { return -1 } @@ -234,12 +234,12 @@ proc do_test {suffix} { with_test_prefix "step-test-2" { clean_restart ${testfile} - if ![runto_main] { + if {![runto_main]} { return -1 } # Note that the RE used for the following test will fail when the - # breakpoint has been set on multiple locations. E.g. "(2 locations)". + # breakpoint has been set on multiple locations. E.g. "(2 locations)". # This is intentional since that behavior is one of the bugs that # this test case tests for. gdb_test "break foo" \ @@ -271,7 +271,7 @@ proc do_test {suffix} { } clean_restart ${testfile} - if ![runto_main] { + if {![runto_main]} { return -1 } @@ -363,7 +363,7 @@ proc do_test {suffix} { with_test_prefix "step-test-3" { clean_restart ${testfile} - if ![runto_main] { + if {![runto_main]} { return -1 } @@ -382,7 +382,7 @@ proc do_test {suffix} { # Tests in the "enable_foo_cold_stepping" section, below, did # not work prior to July, 2019. They had been disabled via # use of the "enable_foo_cold_stepping" flag. - # + # # As noted elsewhere, this test case causes foo_cold, # originally a separate function invoked via a subroutine # call, to be considered as part of foo via use of diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.exp b/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.exp index 75c874e..85e7bb1 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.exp @@ -70,7 +70,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto foo] { +if {![runto foo]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym-warning.exp b/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym-warning.exp index fa1e03b..d33fc5c 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym-warning.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym-warning.exp @@ -109,7 +109,7 @@ clean_restart gdb_load_no_complaints $binfile -if ![runto_main] { +if {![runto_main]} { return -1 } @@ -120,7 +120,7 @@ if ![runto_main] { # warning: (Internal error: pc 0x555555554619 in read in psymtab, # but not in symtab.) # ... -# (gdb) +# (gdb) gdb_test "break baz" \ "Breakpoint.*at.*" diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym.exp b/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym.exp index 6440722..c9df12a 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym.exp @@ -119,7 +119,7 @@ if { [build_executable "failed to prepare" ${testfile} \ clean_restart gdb_load_no_complaints $binfile -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.exp b/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.exp index ad35573..154023e 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.exp @@ -48,7 +48,7 @@ if { [prepare_for_testing_full "failed to prepare" \ } # First try referencing DW_AT_frame_base which is not defined. -if [runto func_nofb] { +if {[runto func_nofb]} { gdb_test "p func_nofb_var" {Could not find the frame base for "func_nofb".} "func_nofb print" gdb_test "bt full" " in main .* main_var = 1" "func_nofb backtrace" } @@ -58,7 +58,7 @@ clean_restart $executable # And now try referencing DW_AT_frame_base defined using a self-reference # (DW_OP_fbreg). -if [runto func_loopfb] { +if {[runto func_loopfb]} { gdb_test "p func_loopfb_var" "DWARF-2 expression error: Loop detected .*" "func_loopfb print" gdb_test "bt full" " in main .* main_var = 1" "func_loopfb backtrace" } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-reg-undefined.exp b/gdb/testsuite/gdb.dwarf2/dw2-reg-undefined.exp index 87e27d6..2de7484 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-reg-undefined.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-reg-undefined.exp @@ -26,7 +26,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile {nodebug nopie} return -1 } -if ![runto stop_frame] { +if {![runto stop_frame]} { perror "Failed to stop in stop_frame" return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-restore.exp b/gdb/testsuite/gdb.dwarf2/dw2-restore.exp index d1243dd..6c17b30 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-restore.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-restore.exp @@ -31,7 +31,7 @@ if {[prepare_for_testing "failed to prepare" $testfile [list $srcfile] \ return -1 } -if ![runto foo] { +if {![runto foo]} { return 0 } gdb_test "continue" "$hex in foo \\(\\)" diff --git a/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.exp b/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.exp index 2fe63c6..70c65be 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.exp @@ -17,7 +17,7 @@ load_lib dwarf.exp # Test multiple location breakpoints vs. prologue analysis on -O2 -g code. # when the first statement of a function is an inlined function GDB could # crash. Map of this testcase: -# +# # File name Line number Starting address # main.c 5 func_start # other.c 1 func0 @@ -37,7 +37,7 @@ require dwarf2_support standard_testfile set executable ${testfile} -if [is_ilp32_target] { +if {[is_ilp32_target]} { set ptrbits 32 } else { set ptrbits 64 @@ -53,10 +53,10 @@ if { [build_executable ${testfile}.exp ${executable} \ # We need those symbols global to access them from the .S file. set test "strip stub symbols" set objcopy_program [gdb_find_objcopy] -set result [catch "exec $objcopy_program \ +set result [catch {exec $objcopy_program \ -N func0 -N func1 -N func2 -N func3 -N func_start -N func_end \ -N fund0 -N fund1 -N fund2 -N fund3 -N fund -N fund_start \ - ${binfile}" output] + ${binfile}} output] verbose "result is $result" verbose "output is $output" if {$result != 0} { @@ -67,7 +67,7 @@ pass $test clean_restart $executable -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-step-between-different-inline-functions.exp b/gdb/testsuite/gdb.dwarf2/dw2-step-between-different-inline-functions.exp index 1eb1e38..d2f3a02 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-step-between-different-inline-functions.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-step-between-different-inline-functions.exp @@ -183,7 +183,7 @@ if {[prepare_for_testing "failed to prepare" "${::testfile}" \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-step-between-inline-func-blocks.exp b/gdb/testsuite/gdb.dwarf2/dw2-step-between-inline-func-blocks.exp index 1a76c58..05326a2 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-step-between-inline-func-blocks.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-step-between-inline-func-blocks.exp @@ -166,7 +166,7 @@ if {[prepare_for_testing "failed to prepare" "${::testfile}" \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-step-out-of-function-no-stmt.exp b/gdb/testsuite/gdb.dwarf2/dw2-step-out-of-function-no-stmt.exp index 3eaaa52..e9c405e 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-step-out-of-function-no-stmt.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-step-out-of-function-no-stmt.exp @@ -102,7 +102,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-undefined-ret-addr.exp b/gdb/testsuite/gdb.dwarf2/dw2-undefined-ret-addr.exp index cad64ef..5a6dc48 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-undefined-ret-addr.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-undefined-ret-addr.exp @@ -26,7 +26,7 @@ if {[prepare_for_testing "failed to prepare" "$testfile" $srcfile {nodebug nopie return -1 } -if ![runto "stop_frame"] { +if {![runto "stop_frame"]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-unexpected-entry-pc.exp b/gdb/testsuite/gdb.dwarf2/dw2-unexpected-entry-pc.exp index fb257f0..3c85b99 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-unexpected-entry-pc.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-unexpected-entry-pc.exp @@ -46,7 +46,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return } -if ![runto_main] { +if {![runto_main]} { return } @@ -60,7 +60,7 @@ foreach foo {foo_1 foo_2 foo_3 foo_4 foo_5 foo_6} { set foo_decl_line [gdb_get_line_number "foo decl line"] set bar_call_line [gdb_get_line_number "bar call line"] -if [is_ilp32_target] { +if {[is_ilp32_target]} { set ptr_type "data4" } else { set ptr_type "data8" @@ -142,11 +142,11 @@ proc run_test { entry_label dwarf_version with_line_table } { if {$with_line_table} { program { DW_LNE_set_address foo_label - line [expr $::bar_call_line - 2] + line [expr {$::bar_call_line - 2}] DW_LNS_copy DW_LNE_set_address foo_0 - line [expr $::bar_call_line - 1] + line [expr {$::bar_call_line - 1}] DW_LNS_copy DW_LNE_set_address foo_1 @@ -202,7 +202,7 @@ proc run_test { entry_label dwarf_version with_line_table } { return false } - if ![runto_main] { + if {![runto_main]} { return false } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-unresolved.exp b/gdb/testsuite/gdb.dwarf2/dw2-unresolved.exp index 9eff15e..ae3c27a 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-unresolved.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-unresolved.exp @@ -26,7 +26,7 @@ if { [prepare_for_testing "failed to prepare" "dw2-unresolved" \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-unspecified-type.exp b/gdb/testsuite/gdb.dwarf2/dw2-unspecified-type.exp index fece767..a21641e 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-unspecified-type.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-unspecified-type.exp @@ -91,12 +91,12 @@ Dwarf::assemble $asm_file { } } -if [prepare_for_testing "failed to prepare" $testfile \ - "${asm_file} ${srcfile} ${srcfile2}" {}] { +if {[prepare_for_testing "failed to prepare" $testfile \ + "${asm_file} ${srcfile} ${srcfile2}" {}]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-unusual-field-names.exp b/gdb/testsuite/gdb.dwarf2/dw2-unusual-field-names.exp index 6632a86..f5f22e6 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-unusual-field-names.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-unusual-field-names.exp @@ -41,7 +41,7 @@ set asm_file [standard_output_file $srcfile2] # For that, we ask GDB by debugging our test program. Any program # would do, but since we already have one specifically for this # testcase, might as well use that. -if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] { +if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} { return -1 } set int_size [get_sizeof "int" -1] @@ -112,7 +112,7 @@ proc run_test { field_name } { return -1 } - if ![runto_main] { + if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp b/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp index 6d8d9b1..122ee61 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp @@ -89,7 +89,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-var-zero-addr.exp b/gdb/testsuite/gdb.dwarf2/dw2-var-zero-addr.exp index c6234d5..e4977dd 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-var-zero-addr.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-var-zero-addr.exp @@ -19,8 +19,8 @@ require dwarf2_support standard_testfile .S main.c -if [prepare_for_testing "failed to prepare" ${testfile} \ - [list $srcfile $srcfile2] {nodebug}] { +if {[prepare_for_testing "failed to prepare" ${testfile} \ + [list $srcfile $srcfile2] {nodebug}]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.exp b/gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.exp index 6432c9d..e0ccd21 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.exp @@ -67,7 +67,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-weird-type-len.exp b/gdb/testsuite/gdb.dwarf2/dw2-weird-type-len.exp index 35eaa16..9109cc5 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-weird-type-len.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-weird-type-len.exp @@ -91,7 +91,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-wrong-mangled-name.exp b/gdb/testsuite/gdb.dwarf2/dw2-wrong-mangled-name.exp index f892d70..a986b19 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-wrong-mangled-name.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-wrong-mangled-name.exp @@ -57,7 +57,7 @@ if {[prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw4-sig-types.exp b/gdb/testsuite/gdb.dwarf2/dw4-sig-types.exp index 99bb4cc..1d9aed6 100644 --- a/gdb/testsuite/gdb.dwarf2/dw4-sig-types.exp +++ b/gdb/testsuite/gdb.dwarf2/dw4-sig-types.exp @@ -32,7 +32,7 @@ if { [prepare_for_testing "failed to prepare" "${testfile}" \ # Stress test gdb's handling of cached comp units, disable the cache. gdb_test_no_output "maint set dwarf max-cache-age 0" -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw4-toplevel-types.exp b/gdb/testsuite/gdb.dwarf2/dw4-toplevel-types.exp index 166ce6a..ef5834e 100644 --- a/gdb/testsuite/gdb.dwarf2/dw4-toplevel-types.exp +++ b/gdb/testsuite/gdb.dwarf2/dw4-toplevel-types.exp @@ -27,7 +27,7 @@ if { [prepare_for_testing "failed to prepare" "${testfile}" \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dw5-rnglist-test.exp b/gdb/testsuite/gdb.dwarf2/dw5-rnglist-test.exp index badb9c0..9a34157 100644 --- a/gdb/testsuite/gdb.dwarf2/dw5-rnglist-test.exp +++ b/gdb/testsuite/gdb.dwarf2/dw5-rnglist-test.exp @@ -28,7 +28,7 @@ if { [prepare_for_testing "failed to prepare" "${testfile}" \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dwp-sepdebug.exp b/gdb/testsuite/gdb.dwarf2/dwp-sepdebug.exp index 81b8354..e39da5d 100644 --- a/gdb/testsuite/gdb.dwarf2/dwp-sepdebug.exp +++ b/gdb/testsuite/gdb.dwarf2/dwp-sepdebug.exp @@ -18,7 +18,7 @@ standard_testfile if { [build_executable ${testfile}.exp ${testfile} ${srcfile}] == -1 } { return -1 } -if ![remote_file host exists [standard_output_file ${testfile}.dwp]] { +if {![remote_file host exists [standard_output_file ${testfile}.dwp]]} { unsupported "testsuite run does not produce dwp files" return 0 } @@ -29,7 +29,7 @@ if ![remote_file host exists [standard_output_file ${testfile}.dwp]] { # the name of a debuginfo only file. This file will be stored in the # gdb.base/ subdirectory. -if [gdb_gnu_strip_debug $binfile$EXEEXT] { +if {[gdb_gnu_strip_debug $binfile$EXEEXT]} { # check that you have a recent version of strip and objcopy installed unsupported "cannot produce separate debug info files" return -1 diff --git a/gdb/testsuite/gdb.dwarf2/dwp-symlink.exp b/gdb/testsuite/gdb.dwarf2/dwp-symlink.exp index 3846870..c2202cb 100644 --- a/gdb/testsuite/gdb.dwarf2/dwp-symlink.exp +++ b/gdb/testsuite/gdb.dwarf2/dwp-symlink.exp @@ -16,14 +16,14 @@ standard_testfile remote_file host delete [standard_output_file ${testfile}.dwp] -if [remote_file host exists [standard_output_file ${testfile}.dwp]] { +if {[remote_file host exists [standard_output_file ${testfile}.dwp]]} { unsupported "dwp file cannot be deleted" return 0 } if { [build_executable ${testfile}.exp ${testfile} ${srcfile}] == -1 } { return -1 } -if ![remote_file host exists [standard_output_file ${testfile}.dwp]] { +if {![remote_file host exists [standard_output_file ${testfile}.dwp]]} { unsupported "testsuite run does not produce dwp files" return 0 } @@ -34,11 +34,11 @@ remote_file host delete [standard_output_file ${thelink}] remote_file host delete [standard_output_file ${thelink}.dwp] # file link is only Tcl 8.4+. remote_exec host "ln -sf ${testfile} [standard_output_file $thelink]" -if ![remote_file host exists [standard_output_file $thelink]] { +if {![remote_file host exists [standard_output_file $thelink]]} { unsupported "host does not support symbolic links (binary symlink is missing)" return 0 } -if [remote_file host exists [standard_output_file $thelink.dwp]] { +if {[remote_file host exists [standard_output_file $thelink.dwp]]} { unsupported "host does not support symbolic links (we tried to delete a file and it is still there)" return 0 } @@ -55,11 +55,11 @@ gdb_test "ptype main" $main_type_re "binary symlink, dwp default" gdb_exit remote_exec host "mv -f [standard_output_file ${testfile}.dwp] [standard_output_file ${thelink}.dwp]" -if [remote_file host exists [standard_output_file ${testfile}.dwp]] { +if {[remote_file host exists [standard_output_file ${testfile}.dwp]]} { unsupported "host does not support symbolic links (binary symlink exists)" return 0 } -if ![remote_file host exists [standard_output_file ${thelink}.dwp]] { +if {![remote_file host exists [standard_output_file ${thelink}.dwp]]} { unsupported "host does not support symbolic links (dwp symlink is missing)" return 0 } @@ -125,7 +125,7 @@ remote_exec host "ln -sf ${dwp_dwp_dir}/${dwp_real_dwp} ${dwp_symlink_dir}/${dwp clean_restart "${dwp_symlink_dir}/${dwp_symlink_binary}" -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dwz.exp b/gdb/testsuite/gdb.dwarf2/dwz.exp index ebccea6..872e3a2 100644 --- a/gdb/testsuite/gdb.dwarf2/dwz.exp +++ b/gdb/testsuite/gdb.dwarf2/dwz.exp @@ -80,11 +80,11 @@ Dwarf::assemble $asm_file { } } -if [prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" {}] { +if {[prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" {}]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dyn-type-unallocated.exp b/gdb/testsuite/gdb.dwarf2/dyn-type-unallocated.exp index e4248d0..91beb79 100644 --- a/gdb/testsuite/gdb.dwarf2/dyn-type-unallocated.exp +++ b/gdb/testsuite/gdb.dwarf2/dyn-type-unallocated.exp @@ -129,7 +129,7 @@ if { [prepare_for_testing "failed to prepare" "${testfile}" \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dynarr-ptr.exp b/gdb/testsuite/gdb.dwarf2/dynarr-ptr.exp index 331cfc2..aeb0aa2 100644 --- a/gdb/testsuite/gdb.dwarf2/dynarr-ptr.exp +++ b/gdb/testsuite/gdb.dwarf2/dynarr-ptr.exp @@ -124,7 +124,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/enqueued-cu-base-addr.exp b/gdb/testsuite/gdb.dwarf2/enqueued-cu-base-addr.exp index 96287dd..7d8bc21 100644 --- a/gdb/testsuite/gdb.dwarf2/enqueued-cu-base-addr.exp +++ b/gdb/testsuite/gdb.dwarf2/enqueued-cu-base-addr.exp @@ -84,7 +84,7 @@ gdb_test_multiple "ptype foo" "" { } } -require {expr $cu1_expanded == 1} +require {expr {$cu1_expanded == 1}} # Now check that cu2 has an address range starting at main. set cu2_blockvector_re \ diff --git a/gdb/testsuite/gdb.dwarf2/fission-absolute-dwo.exp b/gdb/testsuite/gdb.dwarf2/fission-absolute-dwo.exp index 640d4d2..e5ef01a 100644 --- a/gdb/testsuite/gdb.dwarf2/fission-absolute-dwo.exp +++ b/gdb/testsuite/gdb.dwarf2/fission-absolute-dwo.exp @@ -116,7 +116,7 @@ if { [build_executable_and_dwo_files "${testfile}.exp" ${binfile} {nodebug} \ # Now we can start GDB. clean_restart ${testfile} -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/fission-base.exp b/gdb/testsuite/gdb.dwarf2/fission-base.exp index 9f70f30..2f115d1 100644 --- a/gdb/testsuite/gdb.dwarf2/fission-base.exp +++ b/gdb/testsuite/gdb.dwarf2/fission-base.exp @@ -28,16 +28,16 @@ standard_testfile .S set obj [standard_output_file "${testfile}.o"] set dwo [standard_output_file "${testfile}.dwo"] -if [build_executable_and_dwo_files "$testfile.exp" "${binfile}" {nodebug} \ - [list $srcfile \ - [list nodebug split-dwo additional_flags=-DDWO=\"$dwo\"] \ - $obj]] { +if {[build_executable_and_dwo_files "$testfile.exp" "${binfile}" {nodebug} \ + [list $srcfile \ + [list nodebug split-dwo additional_flags=-DDWO=\"$dwo\"] \ + $obj]]} { return -1 } clean_restart $::testfile -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/fission-loclists-pie.exp b/gdb/testsuite/gdb.dwarf2/fission-loclists-pie.exp index aa54718..62f80a7 100644 --- a/gdb/testsuite/gdb.dwarf2/fission-loclists-pie.exp +++ b/gdb/testsuite/gdb.dwarf2/fission-loclists-pie.exp @@ -33,16 +33,17 @@ standard_testfile .S set obj [standard_output_file "${testfile}.o"] set dwo [standard_output_file "${testfile}.dwo"] -if [build_executable_and_dwo_files "$testfile.exp" "${binfile}" \ - {nodebug pie} \ - [list $srcfile [list nodebug split-dwo additional_flags=-DDWO=\"$dwo\"] \ - $obj]] { +if {[build_executable_and_dwo_files "$testfile.exp" "${binfile}" \ + {nodebug pie} \ + [list $srcfile \ + [list nodebug split-dwo additional_flags=-DDWO=\"$dwo\"] \ + $obj]]} { return -1 } clean_restart $::testfile -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/fission-loclists.exp b/gdb/testsuite/gdb.dwarf2/fission-loclists.exp index 59cd10b..991725e 100644 --- a/gdb/testsuite/gdb.dwarf2/fission-loclists.exp +++ b/gdb/testsuite/gdb.dwarf2/fission-loclists.exp @@ -28,16 +28,16 @@ standard_testfile .S set obj [standard_output_file "${testfile}.o"] set dwo [standard_output_file "${testfile}.dwo"] -if [build_executable_and_dwo_files "$testfile.exp" "${binfile}" {nodebug} \ - [list $srcfile \ - [list nodebug split-dwo additional_flags=-DDWO=\"$dwo\"] \ - $obj]] { +if {[build_executable_and_dwo_files "$testfile.exp" "${binfile}" {nodebug} \ + [list $srcfile \ + [list nodebug split-dwo additional_flags=-DDWO=\"$dwo\"] \ + $obj]]} { return -1 } clean_restart $::testfile -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/fission-multi-cu.exp b/gdb/testsuite/gdb.dwarf2/fission-multi-cu.exp index ff498c9..13fb3bf 100644 --- a/gdb/testsuite/gdb.dwarf2/fission-multi-cu.exp +++ b/gdb/testsuite/gdb.dwarf2/fission-multi-cu.exp @@ -196,16 +196,16 @@ Dwarf::assemble $asm_file_2 { # Compile all of the input files, split the DWARF into the .dwo files. set obj1 [standard_output_file "${testfile}-1-dw.o"] set obj2 [standard_output_file "${testfile}-2-dw.o"] -if [build_executable_and_dwo_files "$testfile.exp" "${binfile}" {nodebug} \ - [list $asm_file_1 [list nodebug split-dwo] $obj1] \ - [list $asm_file_2 [list nodebug split-dwo] $obj2] \ - [list $srcfile [list nodebug]]] { +if {[build_executable_and_dwo_files "$testfile.exp" "${binfile}" {nodebug} \ + [list $asm_file_1 [list nodebug split-dwo] $obj1] \ + [list $asm_file_2 [list nodebug split-dwo] $obj2] \ + [list $srcfile [list nodebug]]]} { return -1 } clean_restart $::testfile -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/fission-relative-dwo.exp b/gdb/testsuite/gdb.dwarf2/fission-relative-dwo.exp index e605aef..b533f61 100644 --- a/gdb/testsuite/gdb.dwarf2/fission-relative-dwo.exp +++ b/gdb/testsuite/gdb.dwarf2/fission-relative-dwo.exp @@ -113,7 +113,7 @@ if { [build_executable_and_dwo_files "${testfile}.exp" ${testfile} {nodebug} \ # Now we can start GDB. clean_restart ${testfile} -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/fission-reread.exp b/gdb/testsuite/gdb.dwarf2/fission-reread.exp index 238afb1..8a12377 100644 --- a/gdb/testsuite/gdb.dwarf2/fission-reread.exp +++ b/gdb/testsuite/gdb.dwarf2/fission-reread.exp @@ -38,8 +38,8 @@ set dwo_options $options lappend dwo_options split-dwo lappend dwo_options additional_flags=-DDWO=\"$dwo\" -if [build_executable_and_dwo_files "$testfile.exp" "${binfile}" $options \ - [list $srcfile $dwo_options $obj]] { +if {[build_executable_and_dwo_files "$testfile.exp" "${binfile}" $options \ + [list $srcfile $dwo_options $obj]]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/formdata16.exp b/gdb/testsuite/gdb.dwarf2/formdata16.exp index c08183e..96d8211 100644 --- a/gdb/testsuite/gdb.dwarf2/formdata16.exp +++ b/gdb/testsuite/gdb.dwarf2/formdata16.exp @@ -22,7 +22,7 @@ standard_testfile main.c -dw.S # We need to know the endianess in order # to write some of the debugging info we'd like to generate. -if [prepare_for_testing "failed to prepare for endianness test" ${testfile} ${srcfile}] { +if {[prepare_for_testing "failed to prepare for endianness test" ${testfile} ${srcfile}]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/fortran-var-string.exp b/gdb/testsuite/gdb.dwarf2/fortran-var-string.exp index b751900..5517375 100644 --- a/gdb/testsuite/gdb.dwarf2/fortran-var-string.exp +++ b/gdb/testsuite/gdb.dwarf2/fortran-var-string.exp @@ -141,7 +141,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/gdb-index.exp b/gdb/testsuite/gdb.dwarf2/gdb-index.exp index f7c3337..41bd480 100644 --- a/gdb/testsuite/gdb.dwarf2/gdb-index.exp +++ b/gdb/testsuite/gdb.dwarf2/gdb-index.exp @@ -144,7 +144,7 @@ if {[run_on_host "touch binary" touch $host_binfile_with_index]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } gdb_test "mt print objfiles ${testfile}" \ diff --git a/gdb/testsuite/gdb.dwarf2/implptr-64bit.exp b/gdb/testsuite/gdb.dwarf2/implptr-64bit.exp index be3a648..e7894dd 100644 --- a/gdb/testsuite/gdb.dwarf2/implptr-64bit.exp +++ b/gdb/testsuite/gdb.dwarf2/implptr-64bit.exp @@ -125,11 +125,11 @@ proc test_1 { name dwarf_version offset_size addr_size ref_addr_size two_cu } { # 32-bit targets do not support any of the testcases; keep quiet there. set opts {quiet} set executable ${testfile}-${name} - if [prepare_for_testing "failed to prepare" $executable "${asm_file} ${srcfile}" $opts] { + if {[prepare_for_testing "failed to prepare" $executable "${asm_file} ${srcfile}" $opts]} { return -1 } - if ![runto_main] { + if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/implptr-optimized-out.exp b/gdb/testsuite/gdb.dwarf2/implptr-optimized-out.exp index 7feb983..701c79d 100644 --- a/gdb/testsuite/gdb.dwarf2/implptr-optimized-out.exp +++ b/gdb/testsuite/gdb.dwarf2/implptr-optimized-out.exp @@ -76,12 +76,12 @@ Dwarf::assemble $asm_file { } } -if [prepare_for_testing "failed to prepare" $executable "${asm_file} ${srcfile}" {}] { +if {[prepare_for_testing "failed to prepare" $executable "${asm_file} ${srcfile}" {}]} { return -1 } # DW_OP_GNU_implicit_pointer implementation requires a valid frame. -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/implptr.exp b/gdb/testsuite/gdb.dwarf2/implptr.exp index 78d5f4f..da7bc28 100644 --- a/gdb/testsuite/gdb.dwarf2/implptr.exp +++ b/gdb/testsuite/gdb.dwarf2/implptr.exp @@ -28,7 +28,7 @@ set opts {} lappend opts nopie -if [info exists COMPILE] { +if {[info exists COMPILE]} { # make check RUNTESTFLAGS='gdb.dwarf2/implptr.exp COMPILE=1 CC_FOR_TARGET=gcc\ -m32' set srcfile ${csrcfile} lappend opts debug optimize=-O2 @@ -41,7 +41,7 @@ if {[prepare_for_testing "failed to prepare" ${testfile} $srcfile $opts]} { # Additional test to verify the referenced CU is not aged out. gdb_test_no_output "maintenance set dwarf max-cache-age 0" -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/implptrconst.exp b/gdb/testsuite/gdb.dwarf2/implptrconst.exp index 8e735ca..5078296 100644 --- a/gdb/testsuite/gdb.dwarf2/implptrconst.exp +++ b/gdb/testsuite/gdb.dwarf2/implptrconst.exp @@ -88,7 +88,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/implptrpiece.exp b/gdb/testsuite/gdb.dwarf2/implptrpiece.exp index 58c5e66..1b9dc5e 100644 --- a/gdb/testsuite/gdb.dwarf2/implptrpiece.exp +++ b/gdb/testsuite/gdb.dwarf2/implptrpiece.exp @@ -106,7 +106,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/implref-array.exp b/gdb/testsuite/gdb.dwarf2/implref-array.exp index 1236537..9dec173 100644 --- a/gdb/testsuite/gdb.dwarf2/implref-array.exp +++ b/gdb/testsuite/gdb.dwarf2/implref-array.exp @@ -113,12 +113,12 @@ Dwarf::assemble ${asm_file} { } } -if [prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {}] { +if {[prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {}]} { return -1 } # DW_OP_GNU_implicit_pointer implementation requires a valid frame. -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/implref-const.exp b/gdb/testsuite/gdb.dwarf2/implref-const.exp index ec19eed..bf3892d 100644 --- a/gdb/testsuite/gdb.dwarf2/implref-const.exp +++ b/gdb/testsuite/gdb.dwarf2/implref-const.exp @@ -36,7 +36,7 @@ set asm_file [standard_output_file ${srcfile2}] # For that, we ask GDB by debugging our implref-const program. # Any program would do, but since we already have implref-const # specifically for this testcase, might as well use that. -if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] { +if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} { return -1 } @@ -92,12 +92,12 @@ Dwarf::assemble ${asm_file} { } } -if [prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {}] { +if {[prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {}]} { return -1 } # DW_OP_GNU_implicit_pointer implementation requires a valid frame. -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/implref-global.exp b/gdb/testsuite/gdb.dwarf2/implref-global.exp index cb885ef..a9397bd 100644 --- a/gdb/testsuite/gdb.dwarf2/implref-global.exp +++ b/gdb/testsuite/gdb.dwarf2/implref-global.exp @@ -36,7 +36,7 @@ set asm_file [standard_output_file ${srcfile2}] # For that, we ask GDB by debugging our implref-global program. # Any program would do, but since we already have implref-global # specifically for this testcase, might as well use that. -if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] { +if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} { return -1 } @@ -92,12 +92,12 @@ Dwarf::assemble ${asm_file} { } } -if [prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {}] { +if {[prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {}]} { return -1 } # DW_OP_GNU_implicit_pointer implementation requires a valid frame. -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/implref-struct.exp b/gdb/testsuite/gdb.dwarf2/implref-struct.exp index 9dc3b1b..450576e 100644 --- a/gdb/testsuite/gdb.dwarf2/implref-struct.exp +++ b/gdb/testsuite/gdb.dwarf2/implref-struct.exp @@ -36,7 +36,7 @@ set asm_file [standard_output_file ${srcfile2}] # For that, we ask GDB by debugging our implref-struct program. # Any program would do, but since we already have implref-struct # specifically for this testcase, might as well use that. -if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug c++}] { +if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug c++}]} { return -1 } @@ -129,12 +129,12 @@ Dwarf::assemble ${asm_file} { } } -if [prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {}] { +if {[prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {}]} { return -1 } # DW_OP_GNU_implicit_pointer implementation requires a valid frame. -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/imported-unit-abstract-const-value.exp b/gdb/testsuite/gdb.dwarf2/imported-unit-abstract-const-value.exp index 7141d6b..2f81317 100644 --- a/gdb/testsuite/gdb.dwarf2/imported-unit-abstract-const-value.exp +++ b/gdb/testsuite/gdb.dwarf2/imported-unit-abstract-const-value.exp @@ -28,7 +28,7 @@ set asm_file [standard_output_file ${srcfile2}] # We need to know the size of integer type in order # to write some of the debugging info we'd like to generate. -if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] { +if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/imported-unit-c.exp b/gdb/testsuite/gdb.dwarf2/imported-unit-c.exp index 4ccda52..6bfc8c7 100644 --- a/gdb/testsuite/gdb.dwarf2/imported-unit-c.exp +++ b/gdb/testsuite/gdb.dwarf2/imported-unit-c.exp @@ -10,7 +10,7 @@ set asm_file [standard_output_file ${srcfile2}] # We need to know the size of integer and address types in order # to write some of the debugging info we'd like to generate. -if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug}] { +if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug}]} { return -1 } @@ -96,7 +96,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/imported-unit-runto-main.exp b/gdb/testsuite/gdb.dwarf2/imported-unit-runto-main.exp index 12dc69e..432386a 100644 --- a/gdb/testsuite/gdb.dwarf2/imported-unit-runto-main.exp +++ b/gdb/testsuite/gdb.dwarf2/imported-unit-runto-main.exp @@ -25,7 +25,7 @@ set asm_file [standard_output_file ${srcfile2}] # We need to know the size of integer types in order to write some of the # debugging info we'd like to generate. -if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] { +if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/imported-unit.exp b/gdb/testsuite/gdb.dwarf2/imported-unit.exp index 2c17f2d..b51c07a 100644 --- a/gdb/testsuite/gdb.dwarf2/imported-unit.exp +++ b/gdb/testsuite/gdb.dwarf2/imported-unit.exp @@ -37,7 +37,7 @@ set asm_file [standard_output_file ${srcfile2}] # We need to know the size of integer and address types in order # to write some of the debugging info we'd like to generate. -if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug c++}] { +if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug c++}]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/info-locals-optimized-out.exp b/gdb/testsuite/gdb.dwarf2/info-locals-optimized-out.exp index 59c9669..3f4dd07 100644 --- a/gdb/testsuite/gdb.dwarf2/info-locals-optimized-out.exp +++ b/gdb/testsuite/gdb.dwarf2/info-locals-optimized-out.exp @@ -68,7 +68,7 @@ if { [prepare_for_testing ${testfile}.exp ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/inline.exp b/gdb/testsuite/gdb.dwarf2/inline.exp index a36110e..1aed55f 100644 --- a/gdb/testsuite/gdb.dwarf2/inline.exp +++ b/gdb/testsuite/gdb.dwarf2/inline.exp @@ -15,8 +15,8 @@ standard_testfile .c -if [prepare_for_testing "failed to prepare" $testfile $srcfile \ - {debug nowarnings}] { +if {[prepare_for_testing "failed to prepare" $testfile $srcfile \ + {debug nowarnings}]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/intbits.exp b/gdb/testsuite/gdb.dwarf2/intbits.exp index ec77c2d..fc5a2ae 100644 --- a/gdb/testsuite/gdb.dwarf2/intbits.exp +++ b/gdb/testsuite/gdb.dwarf2/intbits.exp @@ -25,7 +25,7 @@ standard_testfile .c .S set executable ${testfile} set asm_file [standard_output_file ${srcfile2}] -if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] { +if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp index 2a8b457..ba01137 100644 --- a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp +++ b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp @@ -89,8 +89,8 @@ if {[gdb_compile_shlib $libsrc $lib_so \ # Value returned is $1 = (B *) $hex <g_> # Note that this compilation is used for all GDB sessions. set exec_options [list debug shlib=$lib_so] -if [prepare_for_testing "failed to prepare" ${testfile} \ - ${::srcfile} $exec_options] { +if {[prepare_for_testing "failed to prepare" ${testfile} \ + ${::srcfile} $exec_options]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/macro-source-path.exp.tcl b/gdb/testsuite/gdb.dwarf2/macro-source-path.exp.tcl index b71d55d..df7101d 100644 --- a/gdb/testsuite/gdb.dwarf2/macro-source-path.exp.tcl +++ b/gdb/testsuite/gdb.dwarf2/macro-source-path.exp.tcl @@ -51,7 +51,7 @@ proc do_test { test_name lines_version DW_AT_name main_file_idx directories set ::directories $directories set ::file_names $file_names set ::is_64 $is_64 - set 32_or_64 [expr $is_64 ? 64 : 32] + set 32_or_64 [expr {$is_64 ? 64 : 32}] set asm_file [standard_output_file ${::testfile}-${test_name}-${32_or_64}.S] Dwarf::assemble $asm_file { @@ -149,7 +149,7 @@ proc do_test { test_name lines_version DW_AT_name main_file_idx directories } } - if ![runto_main] { + if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.dwarf2/missing-type-name-for-templates.exp b/gdb/testsuite/gdb.dwarf2/missing-type-name-for-templates.exp index ee6992b..5d97ba4 100644 --- a/gdb/testsuite/gdb.dwarf2/missing-type-name-for-templates.exp +++ b/gdb/testsuite/gdb.dwarf2/missing-type-name-for-templates.exp @@ -157,7 +157,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/missing-type-name.exp b/gdb/testsuite/gdb.dwarf2/missing-type-name.exp index 68a5552..6478991 100644 --- a/gdb/testsuite/gdb.dwarf2/missing-type-name.exp +++ b/gdb/testsuite/gdb.dwarf2/missing-type-name.exp @@ -100,7 +100,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/nonvar-access.exp b/gdb/testsuite/gdb.dwarf2/nonvar-access.exp index 93c3dea..abf34ad 100644 --- a/gdb/testsuite/gdb.dwarf2/nonvar-access.exp +++ b/gdb/testsuite/gdb.dwarf2/nonvar-access.exp @@ -201,7 +201,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/nullptr_t.exp b/gdb/testsuite/gdb.dwarf2/nullptr_t.exp index ab73554..4af3655 100644 --- a/gdb/testsuite/gdb.dwarf2/nullptr_t.exp +++ b/gdb/testsuite/gdb.dwarf2/nullptr_t.exp @@ -22,7 +22,7 @@ lappend opts debug lappend opts c++ lappend opts additional_flags=-std=c++11 -if [prepare_for_testing "failed to prepare" $testfile $srcfile $opts] { +if {[prepare_for_testing "failed to prepare" $testfile $srcfile $opts]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/opaque-type-lookup.exp b/gdb/testsuite/gdb.dwarf2/opaque-type-lookup.exp index b4d275c..2564dae 100644 --- a/gdb/testsuite/gdb.dwarf2/opaque-type-lookup.exp +++ b/gdb/testsuite/gdb.dwarf2/opaque-type-lookup.exp @@ -183,11 +183,11 @@ Dwarf::assemble $asm_file { } } -if [prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile} ${srcfile3}" {nodebug}] { +if {[prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile} ${srcfile3}" {nodebug}]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/per-bfd-sharing.exp b/gdb/testsuite/gdb.dwarf2/per-bfd-sharing.exp index 85f19c7..0ae3612 100644 --- a/gdb/testsuite/gdb.dwarf2/per-bfd-sharing.exp +++ b/gdb/testsuite/gdb.dwarf2/per-bfd-sharing.exp @@ -25,8 +25,8 @@ if { [build_executable "failed to prepare" $testfile $srcfile \ set host_binfile [gdb_remote_download host $binfile] set has_index_section [exec_has_index_section $binfile] -set uses_readnow [expr [string first "-readnow" $GDBFLAGS] != -1] -set expecting_index_cache_use [expr !$has_index_section && !$uses_readnow] +set uses_readnow [expr {[string first "-readnow" $GDBFLAGS] != -1}] +set expecting_index_cache_use [expr {!$has_index_section && !$uses_readnow}] lassign [remote_exec host mktemp -d] ret cache_dir diff --git a/gdb/testsuite/gdb.dwarf2/pieces-optimized-out.exp b/gdb/testsuite/gdb.dwarf2/pieces-optimized-out.exp index 65f5fad..259e7e9 100644 --- a/gdb/testsuite/gdb.dwarf2/pieces-optimized-out.exp +++ b/gdb/testsuite/gdb.dwarf2/pieces-optimized-out.exp @@ -30,7 +30,7 @@ if {[prepare_for_testing "failed to prepare" ${testfile} $srcfile $opts]} { return -1 } -if ![runto foo] { +if {![runto foo]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/pieces.exp b/gdb/testsuite/gdb.dwarf2/pieces.exp index 5641d16..a08cd82 100644 --- a/gdb/testsuite/gdb.dwarf2/pieces.exp +++ b/gdb/testsuite/gdb.dwarf2/pieces.exp @@ -26,7 +26,7 @@ if {[prepare_for_testing "failed to prepare" ${testfile} $srcfile]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/pr11465.exp b/gdb/testsuite/gdb.dwarf2/pr11465.exp index cf99fa0..c5b5714 100644 --- a/gdb/testsuite/gdb.dwarf2/pr11465.exp +++ b/gdb/testsuite/gdb.dwarf2/pr11465.exp @@ -19,7 +19,7 @@ require dwarf2_support standard_testfile .S -if [is_ilp32_target] { +if {[is_ilp32_target]} { set ptrbits 32 } else { set ptrbits 64 diff --git a/gdb/testsuite/gdb.dwarf2/self-spec.exp b/gdb/testsuite/gdb.dwarf2/self-spec.exp index 3d6c853..c5818b8 100644 --- a/gdb/testsuite/gdb.dwarf2/self-spec.exp +++ b/gdb/testsuite/gdb.dwarf2/self-spec.exp @@ -52,7 +52,7 @@ Dwarf::assemble $asm_file { } } -if [prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" {}] { +if {[prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" {}]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/struct-with-sig.exp b/gdb/testsuite/gdb.dwarf2/struct-with-sig.exp index 7e15999..f2165ff 100644 --- a/gdb/testsuite/gdb.dwarf2/struct-with-sig.exp +++ b/gdb/testsuite/gdb.dwarf2/struct-with-sig.exp @@ -113,7 +113,7 @@ set struct_s_j_re \ " int j;" \ "}"] -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/symbol_needs_eval_fail.exp b/gdb/testsuite/gdb.dwarf2/symbol_needs_eval_fail.exp index 6efd458..87ef2b2 100644 --- a/gdb/testsuite/gdb.dwarf2/symbol_needs_eval_fail.exp +++ b/gdb/testsuite/gdb.dwarf2/symbol_needs_eval_fail.exp @@ -47,7 +47,7 @@ if { [is_aarch64_target] } { standard_testfile symbol_needs_eval.c ${gdb_test_file_name}-dw.S -if [prepare_for_testing "failed to prepare" $testfile $srcfile {debug}] { +if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug}]} { return } @@ -107,7 +107,7 @@ if { [prepare_for_testing ${testfile}.exp ${testfile} \ # so an error should be reported. gdb_test "print/d a" "No frame selected." "variable a can't be printed" -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/symbol_needs_eval_timeout.exp b/gdb/testsuite/gdb.dwarf2/symbol_needs_eval_timeout.exp index 61a40eb..9f797a5 100644 --- a/gdb/testsuite/gdb.dwarf2/symbol_needs_eval_timeout.exp +++ b/gdb/testsuite/gdb.dwarf2/symbol_needs_eval_timeout.exp @@ -47,7 +47,7 @@ if { [is_aarch64_target] } { standard_testfile symbol_needs_eval.c ${gdb_test_file_name}-dw.S -if [prepare_for_testing "failed to prepare" $testfile $srcfile {debug}] { +if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug}]} { return } @@ -125,7 +125,7 @@ if { [prepare_for_testing ${testfile}.exp ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/template-specification-full-name.exp b/gdb/testsuite/gdb.dwarf2/template-specification-full-name.exp index 52d9b32..507c344 100644 --- a/gdb/testsuite/gdb.dwarf2/template-specification-full-name.exp +++ b/gdb/testsuite/gdb.dwarf2/template-specification-full-name.exp @@ -76,7 +76,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/typeddwarf.exp b/gdb/testsuite/gdb.dwarf2/typeddwarf.exp index b80ce97..0fa812a 100644 --- a/gdb/testsuite/gdb.dwarf2/typeddwarf.exp +++ b/gdb/testsuite/gdb.dwarf2/typeddwarf.exp @@ -37,7 +37,7 @@ if { [prepare_for_testing "failed to prepare" "${test}" ${sfile} $opts] } { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/valop.exp b/gdb/testsuite/gdb.dwarf2/valop.exp index 5de7f4e..d8c19e7 100644 --- a/gdb/testsuite/gdb.dwarf2/valop.exp +++ b/gdb/testsuite/gdb.dwarf2/valop.exp @@ -27,7 +27,7 @@ if {[prepare_for_testing "failed to prepare" $testfile \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/var-access.exp b/gdb/testsuite/gdb.dwarf2/var-access.exp index 6889cc2..3276b28 100644 --- a/gdb/testsuite/gdb.dwarf2/var-access.exp +++ b/gdb/testsuite/gdb.dwarf2/var-access.exp @@ -253,7 +253,7 @@ if { [prepare_for_testing ${testfile}.exp ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/variant.exp b/gdb/testsuite/gdb.dwarf2/variant.exp index 93abcbd..9c9716b 100644 --- a/gdb/testsuite/gdb.dwarf2/variant.exp +++ b/gdb/testsuite/gdb.dwarf2/variant.exp @@ -205,7 +205,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto func] { +if {![runto func]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/varval.exp b/gdb/testsuite/gdb.dwarf2/varval.exp index 8f132bb..97c4ef8 100644 --- a/gdb/testsuite/gdb.dwarf2/varval.exp +++ b/gdb/testsuite/gdb.dwarf2/varval.exp @@ -13,7 +13,7 @@ # 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 support for DW_OP_GNU_variable_value. +# Test support for DW_OP_GNU_variable_value. load_lib dwarf.exp @@ -33,7 +33,7 @@ set asm_file [standard_output_file ${srcfile2}] # For that, we ask GDB by debugging our varval program. # Any program would do, but since we already have varval # specifically for this testcase, might as well use that. -if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] { +if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} { return -1 } set int_size [get_sizeof "int" -1] @@ -44,7 +44,7 @@ proc setup_exec { arg_bad } { global asm_file executable srcfile bad set bad ${arg_bad} - # Create the DWARF. + # Create the DWARF. Dwarf::assemble ${asm_file} { global bad int_size addr_size @@ -314,7 +314,7 @@ proc setup_exec { arg_bad } { } } - if [prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {}] { + if {[prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {}]} { return -1 } } @@ -328,7 +328,7 @@ with_test_prefix "pre-main" { } # DW_OP_GNU_variable_value implementation requires a valid frame. -if ![runto_main] { +if {![runto_main]} { return -1 } @@ -357,7 +357,7 @@ if { [setup_exec 1] == -1 } { } # DW_OP_GNU_variable_value implementation requires a valid frame. -if ![runto_main] { +if {![runto_main]} { return -1 } gdb_test "print badval" "value has been optimized out" diff --git a/gdb/testsuite/gdb.dwarf2/void-type.exp b/gdb/testsuite/gdb.dwarf2/void-type.exp index 10f5738..963410f 100644 --- a/gdb/testsuite/gdb.dwarf2/void-type.exp +++ b/gdb/testsuite/gdb.dwarf2/void-type.exp @@ -96,7 +96,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.fortran/array-slices.exp b/gdb/testsuite/gdb.fortran/array-slices.exp index 7d4f96e..0a7851e 100644 --- a/gdb/testsuite/gdb.fortran/array-slices.exp +++ b/gdb/testsuite/gdb.fortran/array-slices.exp @@ -132,7 +132,7 @@ proc run_test { repack } { } } - if ($found_final_breakpoint) { + if {$found_final_breakpoint} { break } diff --git a/gdb/testsuite/gdb.fortran/associated.exp b/gdb/testsuite/gdb.fortran/associated.exp index 9297220..6d1a6d8 100644 --- a/gdb/testsuite/gdb.fortran/associated.exp +++ b/gdb/testsuite/gdb.fortran/associated.exp @@ -50,7 +50,7 @@ while { $test_count < 500 } { } } - if ($found_final_breakpoint) { + if {$found_final_breakpoint} { break } diff --git a/gdb/testsuite/gdb.fortran/assumedrank.exp b/gdb/testsuite/gdb.fortran/assumedrank.exp index 45e8c09..ce53841 100644 --- a/gdb/testsuite/gdb.fortran/assumedrank.exp +++ b/gdb/testsuite/gdb.fortran/assumedrank.exp @@ -64,7 +64,7 @@ while { $test_count < 500 } { continue } - if ($found_final_breakpoint) { + if {$found_final_breakpoint} { break } diff --git a/gdb/testsuite/gdb.fortran/huge.exp b/gdb/testsuite/gdb.fortran/huge.exp index f7c50d7..03ebdaa 100644 --- a/gdb/testsuite/gdb.fortran/huge.exp +++ b/gdb/testsuite/gdb.fortran/huge.exp @@ -46,7 +46,7 @@ for { set size [expr {$max}] } { $size >= $min } { set size [expr {$size / 2}] } set compilation_succeeded 1 break } -require {expr $compilation_succeeded} +require {expr {$compilation_succeeded}} # Start with a fresh gdb. clean_restart ${::testfile} diff --git a/gdb/testsuite/gdb.fortran/lbound-ubound.exp b/gdb/testsuite/gdb.fortran/lbound-ubound.exp index 143c5be..75b8feb 100644 --- a/gdb/testsuite/gdb.fortran/lbound-ubound.exp +++ b/gdb/testsuite/gdb.fortran/lbound-ubound.exp @@ -61,7 +61,7 @@ while { $test_count < 500 } { } } - if ($found_dealloc_breakpoint) { + if {$found_dealloc_breakpoint} { break } diff --git a/gdb/testsuite/gdb.fortran/rank.exp b/gdb/testsuite/gdb.fortran/rank.exp index e998ead..1fe20c6 100644 --- a/gdb/testsuite/gdb.fortran/rank.exp +++ b/gdb/testsuite/gdb.fortran/rank.exp @@ -50,7 +50,7 @@ while { $test_count < 500 } { } } - if ($found_final_breakpoint) { + if {$found_final_breakpoint} { break } diff --git a/gdb/testsuite/gdb.fortran/shape.exp b/gdb/testsuite/gdb.fortran/shape.exp index 7a6bc9b..4bcc2e7 100644 --- a/gdb/testsuite/gdb.fortran/shape.exp +++ b/gdb/testsuite/gdb.fortran/shape.exp @@ -50,7 +50,7 @@ while { $test_count < 500 } { } } - if ($found_final_breakpoint) { + if {$found_final_breakpoint} { break } diff --git a/gdb/testsuite/gdb.fortran/size.exp b/gdb/testsuite/gdb.fortran/size.exp index 5bc7db2..8cd702d 100644 --- a/gdb/testsuite/gdb.fortran/size.exp +++ b/gdb/testsuite/gdb.fortran/size.exp @@ -55,7 +55,7 @@ while { $test_count < 600 } { } } - if ($found_dealloc_breakpoint) { + if {$found_dealloc_breakpoint} { break } diff --git a/gdb/testsuite/gdb.fortran/sizeof.exp b/gdb/testsuite/gdb.fortran/sizeof.exp index c0a9fd3..d7eeb38 100644 --- a/gdb/testsuite/gdb.fortran/sizeof.exp +++ b/gdb/testsuite/gdb.fortran/sizeof.exp @@ -60,7 +60,7 @@ while { $test_count < 200 } { } } - if ($found_final_breakpoint) { + if {$found_final_breakpoint} { break } diff --git a/gdb/testsuite/gdb.gdb/unittest.exp b/gdb/testsuite/gdb.gdb/unittest.exp index 38955ca..500389d 100644 --- a/gdb/testsuite/gdb.gdb/unittest.exp +++ b/gdb/testsuite/gdb.gdb/unittest.exp @@ -115,7 +115,7 @@ if { $self_tests_enabled && ![is_remote host] } { # initialization order of GDB. with_test_prefix "reversed initialization" { save_vars { env(GDB_REVERSE_INIT_FUNCTIONS) } { - if [info exists env(GDB_REVERSE_INIT_FUNCTIONS)] { + if {[info exists env(GDB_REVERSE_INIT_FUNCTIONS)]} { unset env(GDB_REVERSE_INIT_FUNCTIONS) } else { set env(GDB_REVERSE_INIT_FUNCTIONS) 1 diff --git a/gdb/testsuite/gdb.linespec/cpcompletion.exp b/gdb/testsuite/gdb.linespec/cpcompletion.exp index 2f1cc84..f33bd39 100644 --- a/gdb/testsuite/gdb.linespec/cpcompletion.exp +++ b/gdb/testsuite/gdb.linespec/cpcompletion.exp @@ -1087,7 +1087,7 @@ proc_with_prefix incomplete-scope-colon {} { "${explicit_source} -function ${fqc}$prototype${fqc}"] { set complete_line "b $location" set start [string first $range_ss $complete_line] - set end [expr ($start + [string length $range_ss])] + set end [expr {($start + [string length $range_ss])}] test_complete_prefix_range $complete_line $start $end if {!$skip_check_bp} { check_bp_locations_match_list "b $location" [list "$prototype"] @@ -1200,7 +1200,7 @@ proc_with_prefix operator< {} { "-function $function -label label1"] { set cmd "b $location" - set input_line [string range $cmd 0 [expr [string length $cmd] - 3]] + set input_line [string range $cmd 0 [expr {[string length $cmd] - 3}]] test_gdb_complete_unique $input_line $cmd test_gdb_complete_unique $cmd $cmd diff --git a/gdb/testsuite/gdb.linespec/cpls-abi-tag.exp b/gdb/testsuite/gdb.linespec/cpls-abi-tag.exp index c207925..9388c7f 100644 --- a/gdb/testsuite/gdb.linespec/cpls-abi-tag.exp +++ b/gdb/testsuite/gdb.linespec/cpls-abi-tag.exp @@ -26,7 +26,7 @@ if { [test_compiler_info gcc-*] } { # cpls-abi-tag.cc:71:26: error: # ‘abi_tag’ attribute applied to non-function ‘s’ # See gcc PR65046. - require {expr [gcc_major_version] >= 5} + require {expr {[gcc_major_version] >= 5}} } if {[prepare_for_testing "failed to prepare" $testfile \ diff --git a/gdb/testsuite/gdb.mi/dw2-ref-missing-frame.exp b/gdb/testsuite/gdb.mi/dw2-ref-missing-frame.exp index 0565681..074defa 100644 --- a/gdb/testsuite/gdb.mi/dw2-ref-missing-frame.exp +++ b/gdb/testsuite/gdb.mi/dw2-ref-missing-frame.exp @@ -46,7 +46,7 @@ if {[mi_clean_restart $::testfile]} { return } -if [mi_runto func_nofb_marker] { +if {[mi_runto func_nofb_marker]} { # First try referencing DW_AT_frame_base which is not defined. mi_gdb_test "300-stack-list-locals --thread 1 --frame 1 --all-values" \ "300\\^done,locals=\\\[\{name=\"func_nofb_var\",value=\"\\\<error reading variable: Could not find the frame base for \\\\\"func_nofb\\\\\"\\\.\\\>\"\},\{name=\"func_nofb_var2\",value=\"\\\<error reading variable: Could not find the frame base for \\\\\"func_nofb\\\\\"\\\.\\\>\"\}\\\].*" \ @@ -60,7 +60,7 @@ if {[mi_clean_restart $::testfile]} { # And now try referencing DW_AT_frame_base defined using a self-reference # (DW_OP_fbreg). -if [mi_runto func_loopfb_marker] { +if {[mi_runto func_loopfb_marker]} { mi_gdb_test "301-stack-list-locals --thread 1 --frame 1 --all-values" \ "301\\^done,locals=\\\[\{name=\"func_loopfb_var\",value=\"\\\<error reading variable: DWARF-2 expression error: Loop detected.*\"\},\{name=\"func_loopfb_var2\",value=\"\\\<error reading variable: DWARF-2 expression error: Loop detected.*\"\}\\\]" \ "test func_loopfb_var" diff --git a/gdb/testsuite/gdb.mi/gdb680.exp b/gdb/testsuite/gdb.mi/gdb680.exp index 6eb8928..bffdfa1 100644 --- a/gdb/testsuite/gdb.mi/gdb680.exp +++ b/gdb/testsuite/gdb.mi/gdb680.exp @@ -30,7 +30,7 @@ proc do_test {count} { "-data-list-register-names -1, try $count" } -# Tests a bug with ui-out and nested uiout types. When +# Tests a bug with ui-out and nested uiout types. When # an error is encountered building a nest typed, like # lists or tuples, the uiout is not reset to some sane # state. As a result, uiout still thinks it is building diff --git a/gdb/testsuite/gdb.mi/gdb792.exp b/gdb/testsuite/gdb.mi/gdb792.exp index 64f218a..a2d17aa 100644 --- a/gdb/testsuite/gdb.mi/gdb792.exp +++ b/gdb/testsuite/gdb.mi/gdb792.exp @@ -36,7 +36,7 @@ mi_create_varobj "var1" "a" "create var for class A" mi_list_varobj_children "var1" { {var1.public public 2} - {var1.private private 2} + {var1.private private 2} {var1.protected protected 2} } "list children of class A" diff --git a/gdb/testsuite/gdb.mi/list-thread-groups-available.exp b/gdb/testsuite/gdb.mi/list-thread-groups-available.exp index b41c768..b68cca6 100644 --- a/gdb/testsuite/gdb.mi/list-thread-groups-available.exp +++ b/gdb/testsuite/gdb.mi/list-thread-groups-available.exp @@ -29,7 +29,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb return -1 } -if [mi_gdb_start] { +if {[mi_gdb_start]} { return } diff --git a/gdb/testsuite/gdb.mi/mi-add-inferior.exp b/gdb/testsuite/gdb.mi/mi-add-inferior.exp index 8c4926f..d7c959a 100644 --- a/gdb/testsuite/gdb.mi/mi-add-inferior.exp +++ b/gdb/testsuite/gdb.mi/mi-add-inferior.exp @@ -73,14 +73,31 @@ set inf_line [string range "${inf_line}" $idx end] regexp "^(${decimal} \\(\[^)\]+\\))" $inf_line conn_info set conn_pattern [string_to_regexp "${conn_info}"] +# When using the 'remote' protocol, the connection cannot be shared +# between the original inferior, and the inferior created by +# 'add-inferior'. Remember, the 'remote' protocol doesn't allow new +# inferiors to be started. As a result, some of GDB's output will +# change. +set is_remote_conn [string equal [target_info gdb_protocol] "remote"] + # Now add a new inferior, this should use the connection of the # current inferior. -mi_gdb_test "-add-inferior" \ - [multi_line "=thread-group-added,id=\"\[^\"\]+\"" \ - "~\"\\\[New inferior 2\\\]\\\\n\"" \ - "\~\"Added inferior 2 on connection ${conn_pattern}\\\\n\"" \ - "\\^done,inferior=\"\[^\"\]+\",connection=\{number=\"$decimal\",name=\"\[^\"\]+\"\}" ] \ - "mi add inferior" +if { $is_remote_conn } { + mi_gdb_test "-add-inferior" \ + [multi_line "=thread-group-added,id=\"\[^\"\]+\"" \ + "~\"\\\[New inferior 2\\\]\\\\n\"" \ + "&\"warning: can't share connection 1 \\(remote \[^\r\n\]+\\) between inferiors\\\\n\"" \ + "\~\"Added inferior 2\\\\n\"" \ + "\\^done,inferior=\"\[^\"\]+\"" ] \ + "mi add inferior" +} else { + mi_gdb_test "-add-inferior" \ + [multi_line "=thread-group-added,id=\"\[^\"\]+\"" \ + "~\"\\\[New inferior 2\\\]\\\\n\"" \ + "\~\"Added inferior 2 on connection ${conn_pattern}\\\\n\"" \ + "\\^done,inferior=\"\[^\"\]+\",connection=\{number=\"$decimal\",name=\"\[^\"\]+\"\}" ] \ + "mi add inferior" +} # Now run 'info inferiors' again to check that the currently selected # inferior has not changed. @@ -107,7 +124,16 @@ gdb_test_multiple "info inferiors" \ } -re "^~\"\\s+2\\s+\[^\r\n\]+\\s+${conn_pattern}\\s+\[^\r\n\]+\r\n" { - set saw_new_inferior true + if { ! $is_remote_conn } { + set saw_new_inferior true + } + exp_continue + } + + -re "^~\"\\s+2\\s+<null>\\s*\[^\r\n\]+\r\n" { + if { $is_remote_conn } { + set saw_new_inferior true + } exp_continue } diff --git a/gdb/testsuite/gdb.mi/mi-async.exp b/gdb/testsuite/gdb.mi/mi-async.exp index 1c4e06c..11ba52f 100644 --- a/gdb/testsuite/gdb.mi/mi-async.exp +++ b/gdb/testsuite/gdb.mi/mi-async.exp @@ -55,8 +55,8 @@ proc linux_async_tests {} { global hex set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] - set line_main_next [expr $line_main_head + 3] + set line_main_body [expr {$line_main_head + 2}] + set line_main_next [expr {$line_main_head + 3}] mi_send_resuming_command_raw "start" "start: send" mi_expect_stop "breakpoint-hit" "main" "" ".*basics.c" "$line_main_body" { "" "disp=\"del\"" } "start: stop" diff --git a/gdb/testsuite/gdb.mi/mi-basics.exp b/gdb/testsuite/gdb.mi/mi-basics.exp index 2add9db..3038a2c 100644 --- a/gdb/testsuite/gdb.mi/mi-basics.exp +++ b/gdb/testsuite/gdb.mi/mi-basics.exp @@ -45,7 +45,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb # procedures work, so it makes no sense using them here. gdb_exit -if [mi_gdb_start separate-inferior-tty] { +if {[mi_gdb_start separate-inferior-tty]} { return } @@ -61,9 +61,9 @@ proc test_mi_interpreter_selection {} { # All this test expects is to get the prompt back # with no syntax error message - if ![mi_gdb_test "-gdb-version" "~\"GNU gdb.*" "acceptance of MI operations"] { + if {![mi_gdb_test "-gdb-version" "~\"GNU gdb.*" "acceptance of MI operations"]} { return 1 - } + } note "Skipping all other MI tests." return 0 @@ -73,7 +73,7 @@ proc test_exec_and_symbol_mi_operatons {} { global mi_gdb_prompt global binfile testfile - if [is_remote host] { + if {[is_remote host]} { set filename ${testfile} remote_download host ${binfile} ${filename} } else { @@ -84,8 +84,8 @@ proc test_exec_and_symbol_mi_operatons {} { # Tests: # -file-exec-and-symbols - if [mi_gdb_test "-file-exec-and-symbols ${filename}" "\\\^done" \ - "file-exec-and-symbols operation"] { + if {[mi_gdb_test "-file-exec-and-symbols ${filename}" "\\\^done" \ + "file-exec-and-symbols operation"]} { note "Skipping all other MI tests." return 0 } @@ -144,7 +144,7 @@ proc test_dir_specification {} { # Add to the search directories, display, then reset back to default # Tests: # -environment-directory arg - # -environment-directory + # -environment-directory # -environment-directory -r mi_gdb_test "202-environment-directory ${testsubdir}" \ @@ -176,7 +176,7 @@ proc test_cwd_specification {} { # The canonical name of the working directory may differ on a # remote host from that on the build system. - if ![is_remote host] { + if {![is_remote host]} { mi_gdb_test "206-environment-pwd" \ "206\\\^done,cwd=\"${escapedobjdir}\"" \ "environment-pwd operation" @@ -192,9 +192,9 @@ proc test_path_specification {} { global envirodir global expect_out - # Add to the path, display, then reset + # Add to the path, display, then reset # Tests: - # -environment-path + # -environment-path # -environment-path dir1 dir2 # -environment-path -r dir # -environment-path -r @@ -220,7 +220,7 @@ proc test_path_specification {} { "210\\\^done,path=\"$orig_path\"" \ "environment-path -r operation" -} +} proc test_setshow_inferior_tty {} { global mi_gdb_prompt diff --git a/gdb/testsuite/gdb.mi/mi-break.exp b/gdb/testsuite/gdb.mi/mi-break.exp index cb7c14b..2064efe 100644 --- a/gdb/testsuite/gdb.mi/mi-break.exp +++ b/gdb/testsuite/gdb.mi/mi-break.exp @@ -32,17 +32,17 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb # Locate line numbers in basics.c. set line_callee4_head [gdb_get_line_number "callee4 ("] -set line_callee4_body [expr $line_callee4_head + 2] +set line_callee4_body [expr {$line_callee4_head + 2}] set line_callee3_head [gdb_get_line_number "callee3 ("] -set line_callee3_body [expr $line_callee3_head + 2] +set line_callee3_body [expr {$line_callee3_head + 2}] set line_callee2_head [gdb_get_line_number "callee2 ("] -set line_callee2_body [expr $line_callee2_head + 2] +set line_callee2_body [expr {$line_callee2_head + 2}] set line_callee1_head [gdb_get_line_number "callee1 ("] -set line_callee1_body [expr $line_callee1_head + 2] +set line_callee1_body [expr {$line_callee1_head + 2}] set line_main_head [gdb_get_line_number "main ("] -set line_main_body [expr $line_main_head + 2] +set line_main_body [expr {$line_main_head + 2}] set line_callme_head [gdb_get_line_number "callme ("] -set line_callme_body [expr $line_callme_head + 2] +set line_callme_body [expr {$line_callme_head + 2}] set fullname "fullname=\"${fullname_syntax}${srcfile}\"" @@ -362,7 +362,7 @@ proc_with_prefix test_forced_conditions {} { "${warning}\\^done" \ "invalid condition is forced" set args [list -cond "bad == 42" -locations "\\\[$loc\\\]"] - set bp [eval mi_make_breakpoint_multi $args] + set bp [mi_make_breakpoint_multi {*}$args] mi_gdb_test "-break-info 16" \ "\\^done,[mi_make_breakpoint_table [list $bp]]" \ "invalid condition is defined" @@ -398,7 +398,7 @@ proc test_break {mi_mode} { } else { set start_ops "" } - if [mi_clean_restart $::testfile $start_ops ] { + if {[mi_clean_restart $::testfile $start_ops ]} { return } diff --git a/gdb/testsuite/gdb.mi/mi-breakpoint-multiple-locations.exp b/gdb/testsuite/gdb.mi/mi-breakpoint-multiple-locations.exp index 7995846..fe50cdc 100644 --- a/gdb/testsuite/gdb.mi/mi-breakpoint-multiple-locations.exp +++ b/gdb/testsuite/gdb.mi/mi-breakpoint-multiple-locations.exp @@ -34,7 +34,7 @@ if {[gdb_compile "$srcdir/$subdir/$srcfile" $binfile executable {debug c++}] != proc make_breakpoints_pattern { expect_fixed_output bp_num loc1_en loc2_en } { - if $expect_fixed_output { + if {$expect_fixed_output} { return "bkpt=\{number=\"${bp_num}\",type=\"breakpoint\",.*,locations=\\\[\{number=\"${bp_num}\\.1\",enabled=\"${loc1_en}\",.*\},\{number=\"${bp_num}\\.2\",enabled=\"${loc2_en}\",.*\}\\\]\}" } else { return "bkpt=\{number=\"${bp_num}\",type=\"breakpoint\",.*\},\{number=\"${bp_num}\\.1\",enabled=\"${loc1_en}\",.*\},\{number=\"${bp_num}\\.2\",enabled=\"${loc2_en}\",.*\}" @@ -60,7 +60,7 @@ proc do_test { mi_version use_fix_flag expect_fixed_output } { mi_runto_main - if $use_fix_flag { + if {$use_fix_flag} { mi_gdb_test "-fix-multi-location-breakpoint-output" "\\^done" \ "send -fix-multi-location-breakpoint-output" } diff --git a/gdb/testsuite/gdb.mi/mi-breakpoint-script.exp b/gdb/testsuite/gdb.mi/mi-breakpoint-script.exp index ce30d44..e4242a3 100644 --- a/gdb/testsuite/gdb.mi/mi-breakpoint-script.exp +++ b/gdb/testsuite/gdb.mi/mi-breakpoint-script.exp @@ -30,7 +30,7 @@ if {[gdb_compile "$srcdir/$subdir/$srcfile" $binfile executable {debug}] != "" } # script field, else expect it to output the broken pre-mi4 format. proc make_pattern { expect_fixed_output } { - if $expect_fixed_output { + if {$expect_fixed_output} { return "bkpt=\{number=\"${::decimal}\",type=\"breakpoint\",.*,script=\\\[\"abc\",\"def\"\\\],.*" } else { return "bkpt=\{number=\"${::decimal}\",type=\"breakpoint\",.*,script=\\\{\"abc\",\"def\"\\\},.*" @@ -54,7 +54,7 @@ proc do_test { mi_version use_fix_flag expect_fixed_output } { mi_clean_restart $::testfile } - if $use_fix_flag { + if {$use_fix_flag} { mi_gdb_test "-fix-breakpoint-script-output" "\\^done" \ "send -fix-multi-location-breakpoint-output" } diff --git a/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.exp b/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.exp index ec023e6..802d0be 100644 --- a/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.exp +++ b/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.exp @@ -31,7 +31,7 @@ mi_clean_restart $::testfile if {[mi_runto_main] < 0} { return -1 } -set libstdcxx_probe_tests_supported [expr ![mi_skip_libstdcxx_probe_tests]] +set libstdcxx_probe_tests_supported [expr {![mi_skip_libstdcxx_probe_tests]}] # Grab some line numbers we'll need. set catch_1_lineno [gdb_get_line_number "Catch 1"] diff --git a/gdb/testsuite/gdb.mi/mi-cli.exp b/gdb/testsuite/gdb.mi/mi-cli.exp index b59a5ed..7763689 100644 --- a/gdb/testsuite/gdb.mi/mi-cli.exp +++ b/gdb/testsuite/gdb.mi/mi-cli.exp @@ -59,14 +59,14 @@ mi_gdb_test "-interpreter-exec console \"file $binfile\"" \ mi_runto_main set line_main_head [gdb_get_line_number "main ("] -set line_main_body [expr $line_main_head + 2] +set line_main_body [expr {$line_main_head + 2}] set line_main_hello [gdb_get_line_number "Hello, World!"] -set line_main_return [expr $line_main_hello + 2] -set line_main_callme_2 [expr $line_main_return + 1] +set line_main_return [expr {$line_main_hello + 2}] +set line_main_callme_2 [expr {$line_main_return + 1}] set line_callee4_head [gdb_get_line_number "callee4 ("] -set line_callee4_body [expr $line_callee4_head + 2] -set line_callee4_next [expr $line_callee4_body + 1] -set line_callee4_next_step [expr $line_callee4_next + 3] +set line_callee4_body [expr {$line_callee4_head + 2}] +set line_callee4_next [expr {$line_callee4_body + 1}] +set line_callee4_next_step [expr {$line_callee4_next + 3}] mi_gdb_test "-interpreter-exec console \"set args foobar\"" \ ".*=cmd-param-changed,param=\"args\",value=\"foobar\".*\\^done" \ @@ -233,7 +233,7 @@ mi_gdb_test "-interpreter-exec console \"set listsize 10\"" \ "-interpreter-exec console \"set listsize 10\"" # "list" should show 10 lines centered on where the program stopped. -set first_list_line [expr $line_main_callme_2 - 5] +set first_list_line [expr {$line_main_callme_2 - 5}] mi_gdb_test "-interpreter-exec console \"list\"" \ ".*\~\"$first_list_line.*\\^done" \ "-interpreter-exec console \"list\" at basics.c:\$line_main_callme_2" diff --git a/gdb/testsuite/gdb.mi/mi-cmd-error.exp b/gdb/testsuite/gdb.mi/mi-cmd-error.exp index 195bced..81b3a23 100644 --- a/gdb/testsuite/gdb.mi/mi-cmd-error.exp +++ b/gdb/testsuite/gdb.mi/mi-cmd-error.exp @@ -70,7 +70,9 @@ set cmdnames { for {set i 0} {$i < [llength $procs]} {incr i} { for {set j 0} {$j < [llength $procs]} {incr j} { with_test_prefix "[lindex $cmdnames $i] first ($i x $j)" { + # tclint-disable-next-line command-args with_test_prefix "1st" [lindex $procs $i] + # tclint-disable-next-line command-args with_test_prefix "2nd" [lindex $procs $j] } } diff --git a/gdb/testsuite/gdb.mi/mi-condbreak-fail.exp b/gdb/testsuite/gdb.mi/mi-condbreak-fail.exp index 5bd8993..34e9494 100644 --- a/gdb/testsuite/gdb.mi/mi-condbreak-fail.exp +++ b/gdb/testsuite/gdb.mi/mi-condbreak-fail.exp @@ -22,7 +22,7 @@ set MIFLAGS "-i=mi" standard_testfile -if [build_executable ${testfile}.exp ${binfile} ${srcfile}] { +if {[build_executable ${testfile}.exp ${binfile} ${srcfile}]} { return -1 } diff --git a/gdb/testsuite/gdb.mi/mi-condbreak-throw.exp b/gdb/testsuite/gdb.mi/mi-condbreak-throw.exp index b4960a8..1b4f817 100644 --- a/gdb/testsuite/gdb.mi/mi-condbreak-throw.exp +++ b/gdb/testsuite/gdb.mi/mi-condbreak-throw.exp @@ -25,7 +25,7 @@ set MIFLAGS "-i=mi" standard_testfile .cc -if [build_executable ${testfile}.exp ${binfile} ${srcfile} {debug c++}] { +if {[build_executable ${testfile}.exp ${binfile} ${srcfile} {debug c++}]} { return -1 } diff --git a/gdb/testsuite/gdb.mi/mi-console.exp b/gdb/testsuite/gdb.mi/mi-console.exp index 861ef42..710c2c8 100644 --- a/gdb/testsuite/gdb.mi/mi-console.exp +++ b/gdb/testsuite/gdb.mi/mi-console.exp @@ -91,5 +91,5 @@ mi_gdb_test "220-exec-next" \ set line [gdb_get_line_number "after-hello"] mi_expect_stop "end-stepping-range" "main" "" ".*mi-console.c" $line "" \ "finished step over hello" - + mi_gdb_exit diff --git a/gdb/testsuite/gdb.mi/mi-corefile.exp b/gdb/testsuite/gdb.mi/mi-corefile.exp index b491486..d663eec 100644 --- a/gdb/testsuite/gdb.mi/mi-corefile.exp +++ b/gdb/testsuite/gdb.mi/mi-corefile.exp @@ -33,7 +33,7 @@ if {$corefile == ""} { return 0 } -if [mi_gdb_start] { +if {[mi_gdb_start]} { return } diff --git a/gdb/testsuite/gdb.mi/mi-disassemble.exp b/gdb/testsuite/gdb.mi/mi-disassemble.exp index 90f79e3..6c6d05d 100644 --- a/gdb/testsuite/gdb.mi/mi-disassemble.exp +++ b/gdb/testsuite/gdb.mi/mi-disassemble.exp @@ -36,7 +36,7 @@ proc test_disassembly_only {} { global decimal set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] + set line_main_body [expr {$line_main_head + 2}] # Test disassembly more only for the current function. # Tests: @@ -76,7 +76,7 @@ proc test_disassembly_with_opcodes {} { global decimal set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] + set line_main_body [expr {$line_main_head + 2}] # Test disassembly with opcodes for the current function. # Tests: @@ -106,7 +106,7 @@ proc test_disassembly_lines_limit {} { global decimal set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] + set line_main_body [expr {$line_main_head + 2}] # Test disassembly more only for the current function. # Tests: @@ -136,7 +136,7 @@ proc test_disassembly_mixed {} { global fullname_syntax set line_callee2_head [gdb_get_line_number "callee2 ("] - set line_callee2_open_brace [expr $line_callee2_head + 1] + set line_callee2_open_brace [expr {$line_callee2_head + 1}] # Test disassembly more only for the current function. # Tests: @@ -164,7 +164,7 @@ proc test_disassembly_mixed_with_opcodes {} { global fullname_syntax set line_callee2_head [gdb_get_line_number "callee2 ("] - set line_callee2_open_brace [expr $line_callee2_head + 1] + set line_callee2_open_brace [expr {$line_callee2_head + 1}] # Test disassembly mixed with opcodes for the current function. # Tests: @@ -192,8 +192,8 @@ proc test_disassembly_mixed_lines_limit {} { global fullname_syntax set line_main_head [gdb_get_line_number "main ("] - set line_main_open_brace [expr $line_main_head + 1] - set line_main_body [expr $line_main_head + 2] + set line_main_open_brace [expr {$line_main_head + 1}] + set line_main_body [expr {$line_main_head + 2}] # Test disassembly more only for the current function. # Tests: @@ -220,7 +220,7 @@ proc test_disassembly_bogus_args {} { global hex set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] + set line_main_body [expr {$line_main_head + 2}] # Test that bogus input to disassembly command is rejected. # Tests: @@ -321,7 +321,7 @@ proc test_disassembly_opcode_format {} { # Load the actual byte value from memory, and check it matches # the opcode byte reported in the disassembler output. - set addr 0x[format %x [expr $longest_insn_addr + $idx]] + set addr 0x[format %x [expr {$longest_insn_addr + $idx}]] set actual [format %02x [mi_get_valueof "/x" "*((unsigned char *) $addr)" "XX"]] gdb_assert [string equal $actual "$b"] \ "byte at $addr matches" @@ -335,7 +335,7 @@ proc test_disassembly_opcode_format {} { # Figure out an end address at which to stop the disassembly. set byte_count [llength $split_bytes] - set end_addr 0x[format %x [expr $longest_insn_addr + $byte_count]] + set end_addr 0x[format %x [expr {$longest_insn_addr + $byte_count}]] set start_addr $longest_insn_addr verbose -log "Instruction is ${byte_count} bytes, end address ${end_addr}" diff --git a/gdb/testsuite/gdb.mi/mi-dprintf.exp b/gdb/testsuite/gdb.mi/mi-dprintf.exp index 9d0b95a..5d2d508 100644 --- a/gdb/testsuite/gdb.mi/mi-dprintf.exp +++ b/gdb/testsuite/gdb.mi/mi-dprintf.exp @@ -129,7 +129,7 @@ mi_continue_dprintf "gdb" # The "call" style depends on having I/O functions available, so test. set has_stderr_symbol [mi_gdb_is_stderr_available] -if ![target_info exists gdb,noinferiorio] { +if {![target_info exists gdb,noinferiorio]} { # Now switch styles and rerun; in the absence of redirection the # output should be the same. @@ -165,7 +165,7 @@ gdb_expect { } } -if $target_can_dprintf { +if {$target_can_dprintf} { if {[mi_run_cmd] < 0} { # This likely means we failed to use target side commands in # combination with software breakpoints. IOW, the target @@ -174,7 +174,7 @@ if $target_can_dprintf { unsupported "send dprintf to target" } - if $target_can_dprintf { + if {$target_can_dprintf} { mi_expect_stop ".*" ".*" ".*" ".*" ".*" "" "mi expect stop" mi_send_resuming_command "exec-continue" "mi 1st dprintf continue, agent" diff --git a/gdb/testsuite/gdb.mi/mi-eval.exp b/gdb/testsuite/gdb.mi/mi-eval.exp index 2b21895..eafdf69 100644 --- a/gdb/testsuite/gdb.mi/mi-eval.exp +++ b/gdb/testsuite/gdb.mi/mi-eval.exp @@ -37,10 +37,10 @@ if {[mi_clean_restart $::testfile]} { } set line_callee4_head [gdb_get_line_number "callee4 ("] -set line_callee4_body [expr $line_callee4_head + 2] +set line_callee4_body [expr {$line_callee4_head + 2}] mi_runto callee4 -mi_next_to "callee4" "" "basics.c" [expr $line_callee4_body + 1] "next at callee4" +mi_next_to "callee4" "" "basics.c" [expr {$line_callee4_body + 1}] "next at callee4" mi_gdb_test "211-data-evaluate-expression A" "211\\^done,value=\"1\"" "eval A" diff --git a/gdb/testsuite/gdb.mi/mi-exec-run.exp b/gdb/testsuite/gdb.mi/mi-exec-run.exp index 43406cf..04283a1 100644 --- a/gdb/testsuite/gdb.mi/mi-exec-run.exp +++ b/gdb/testsuite/gdb.mi/mi-exec-run.exp @@ -59,7 +59,7 @@ proc test {inftty_mode mi_mode force_fail} { lappend start_ops "separate-mi-tty" } - if [mi_gdb_start $start_ops] { + if {[mi_gdb_start $start_ops]} { return } diff --git a/gdb/testsuite/gdb.mi/mi-file.exp b/gdb/testsuite/gdb.mi/mi-file.exp index 68c9e34..9b03936 100644 --- a/gdb/testsuite/gdb.mi/mi-file.exp +++ b/gdb/testsuite/gdb.mi/mi-file.exp @@ -44,7 +44,7 @@ proc test_file_list_exec_source_file {} { # get the path and absolute path to the current executable set line_main_head [gdb_get_line_number "main ("] - set line_main_prologue [expr $line_main_head + 1] + set line_main_prologue [expr {$line_main_head + 1}] set line_default $line_main_prologue mi_gdb_test "111-file-list-exec-source-file" \ diff --git a/gdb/testsuite/gdb.mi/mi-fill-memory.exp b/gdb/testsuite/gdb.mi/mi-fill-memory.exp index ab7e03a..bf0bcb1 100644 --- a/gdb/testsuite/gdb.mi/mi-fill-memory.exp +++ b/gdb/testsuite/gdb.mi/mi-fill-memory.exp @@ -21,7 +21,7 @@ load_lib mi-support.exp set MIFLAGS "-i=mi" standard_testfile "mi-read-memory" - + if { [gdb_compile "${srcdir}/${subdir}/${srcfile}.c" "${binfile}" executable {debug}] != "" } { untested "failed to compile" return -1 diff --git a/gdb/testsuite/gdb.mi/mi-fortran-modules.exp b/gdb/testsuite/gdb.mi/mi-fortran-modules.exp index 48391bc..9b5d71a 100644 --- a/gdb/testsuite/gdb.mi/mi-fortran-modules.exp +++ b/gdb/testsuite/gdb.mi/mi-fortran-modules.exp @@ -100,7 +100,7 @@ gdb_test_multiple $cmd $test -prompt $mi_gdb_prompt$ { } else { fail $gdb_test_name } - } + } } mi_gdb_test "105-symbol-info-module-functions --name _all" \ @@ -161,5 +161,5 @@ gdb_test_multiple $cmd $test -prompt $mi_gdb_prompt$ { } else { fail $gdb_test_name } - } + } } diff --git a/gdb/testsuite/gdb.mi/mi-frame-regs.exp b/gdb/testsuite/gdb.mi/mi-frame-regs.exp index 990abd5..d34f244 100644 --- a/gdb/testsuite/gdb.mi/mi-frame-regs.exp +++ b/gdb/testsuite/gdb.mi/mi-frame-regs.exp @@ -80,7 +80,7 @@ proc_with_prefix do_floating_varobj_test {} { # Run to a breakpoint in each callee function in succession. # Note that we can't use mi_runto because we need the # breakpoint to be persistent, so we can use its address. - set bpnum [expr $i + 1] + set bpnum [expr {$i + 1}] mi_create_breakpoint \ "basics.c:callee$i" \ "insert breakpoint at basics.c:callee$i" \ @@ -101,7 +101,7 @@ proc_with_prefix do_floating_varobj_test {} { if {$bpaddr == ""} { return } # Check that the addresses are the same. - gdb_assert [expr $bpaddr == $pcval] "\$pc equals address of breakpoint in callee$i" + gdb_assert [expr {$bpaddr == $pcval}] "\$pc equals address of breakpoint in callee$i" } } diff --git a/gdb/testsuite/gdb.mi/mi-info-os.exp b/gdb/testsuite/gdb.mi/mi-info-os.exp index c70dac6..79307f3 100644 --- a/gdb/testsuite/gdb.mi/mi-info-os.exp +++ b/gdb/testsuite/gdb.mi/mi-info-os.exp @@ -27,8 +27,8 @@ require allow_xml_test standard_testfile basics.c -if [build_executable "Failed to build $testfile" $testfile $srcfile \ - debug] { +if {[build_executable "Failed to build $testfile" $testfile $srcfile \ + debug]} { return -1; } diff --git a/gdb/testsuite/gdb.mi/mi-logging.exp b/gdb/testsuite/gdb.mi/mi-logging.exp index 8235591..7fad225 100644 --- a/gdb/testsuite/gdb.mi/mi-logging.exp +++ b/gdb/testsuite/gdb.mi/mi-logging.exp @@ -19,7 +19,7 @@ set MIFLAGS "-i=mi" standard_testfile basics.c set opts {debug} -if [build_executable $testfile.exp $testfile $srcfile $opts] { +if {[build_executable $testfile.exp $testfile $srcfile $opts]} { untested "failed to compile" return -1 } @@ -51,7 +51,7 @@ close $chan set mi_log_prompt "\[(\]gdb\[)\] \[\r\n\]+" -if [regexp "\\^done\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent] { +if {[regexp "\\^done\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent]} { pass "log file contents" } else { fail "log file contents" @@ -74,7 +74,7 @@ set chan [open $milogfile] set logcontent [read $chan] close $chan -if [regexp "1001\\^done\[\r\n\]+$mi_log_prompt.*1002\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt.*1003\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent] { +if {[regexp "1001\\^done\[\r\n\]+$mi_log_prompt.*1002\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt.*1003\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent]} { pass "redirect log file contents" } else { fail "redirect log file contents" diff --git a/gdb/testsuite/gdb.mi/mi-multi-commands.exp b/gdb/testsuite/gdb.mi/mi-multi-commands.exp index 3bc63eb..052d600 100644 --- a/gdb/testsuite/gdb.mi/mi-multi-commands.exp +++ b/gdb/testsuite/gdb.mi/mi-multi-commands.exp @@ -38,7 +38,7 @@ proc run_test { args } { global mi_gdb_prompt global decimal - if [mi_clean_restart "" $args] { + if {[mi_clean_restart "" $args]} { return } @@ -119,7 +119,7 @@ proc run_test { args } { # checking different command lengths. The actual bug this # test checks for would result in a timeout, so we don't want # to risk lots more timeouts. - if { ! [expr $seen_first_message && $seen_second_message ] } { + if { ! ($seen_first_message && $seen_second_message) } { break } } diff --git a/gdb/testsuite/gdb.mi/mi-nonstop.exp b/gdb/testsuite/gdb.mi/mi-nonstop.exp index 1ba37a3..07cf899 100644 --- a/gdb/testsuite/gdb.mi/mi-nonstop.exp +++ b/gdb/testsuite/gdb.mi/mi-nonstop.exp @@ -63,7 +63,7 @@ mi_check_thread_states {"running" "stopped" "stopped"} "thread state, stop 1" mi_gdb_test "-thread-select 2" "\\^done.*" "select thread 2" mi_create_varobj I_W0 "i" "create varobj in first thread" mi_gdb_test "-thread-select 3" "\\^done.*" "select thread 3" -mi_create_varobj I_W1 "i" "create varobj in second thread" +mi_create_varobj I_W1 "i" "create varobj in second thread" mi_nonstop_resume "exec-continue --thread 2" "resume 1" mi_check_thread_states {"running" "running" "stopped"} "thread state, resume 1" @@ -95,7 +95,7 @@ mi_expect_stop "breakpoint-hit" "break_at_me" "\[^\n\]*" "non-stop.c" "\[0-9\]*" mi_expect_stop "breakpoint-hit" "break_at_me" ".*" "non-stop.c" ".*" {"" "disp=\"keep\""} "w1,i2 stop" # At this point, thread 1 (main) is running, and worker threads are stopped. -# Check that we can modify breakpoint condition, even when operating on a +# Check that we can modify breakpoint condition, even when operating on a # running thread. mi_gdb_test "-break-condition --thread 1 2 id==1" "\\^done" "set condition, 1" diff --git a/gdb/testsuite/gdb.mi/mi-pending.exp b/gdb/testsuite/gdb.mi/mi-pending.exp index eb0719c..4231671 100644 --- a/gdb/testsuite/gdb.mi/mi-pending.exp +++ b/gdb/testsuite/gdb.mi/mi-pending.exp @@ -105,7 +105,7 @@ mi_expect_stop "breakpoint-hit" "pendfunc1" ".*" ".*" ".*" \ mi_send_resuming_command "exec-continue" "continuing execution to skip conditional bp" -# We should not stop on the conditional breakpoint yet, but we stop on the original bp. +# We should not stop on the conditional breakpoint yet, but we stop on the original bp. mi_expect_stop "breakpoint-hit" "pendfunc1" ".*" ".*" ".*" \ { "" "disp=\"keep\"" } \ "Run till MI pending breakpoint on pendfunc1 a second time" diff --git a/gdb/testsuite/gdb.mi/mi-pthreads.exp b/gdb/testsuite/gdb.mi/mi-pthreads.exp index 117b2de..13ea6ba 100644 --- a/gdb/testsuite/gdb.mi/mi-pthreads.exp +++ b/gdb/testsuite/gdb.mi/mi-pthreads.exp @@ -28,7 +28,7 @@ proc check_mi_thread_command_set {} { mi_runto done_making_threads set thread_list [get_mi_thread_list "in check_mi_thread_command_set"] - + mi_gdb_test "-thread-select" \ {\^error,msg="-thread-select: USAGE: threadnum."} \ "check_mi_thread_command_set: -thread-select" diff --git a/gdb/testsuite/gdb.mi/mi-reg-undefined.exp b/gdb/testsuite/gdb.mi/mi-reg-undefined.exp index ef102ce..d3ca0bc 100644 --- a/gdb/testsuite/gdb.mi/mi-reg-undefined.exp +++ b/gdb/testsuite/gdb.mi/mi-reg-undefined.exp @@ -33,7 +33,7 @@ if {[mi_clean_restart $::testfile]} { return } -if ![mi_runto stop_frame] { +if {![mi_runto stop_frame]} { perror "Failed to stop in stop_frame" return -1 } diff --git a/gdb/testsuite/gdb.mi/mi-return.exp b/gdb/testsuite/gdb.mi/mi-return.exp index 998a1ff..665be99 100644 --- a/gdb/testsuite/gdb.mi/mi-return.exp +++ b/gdb/testsuite/gdb.mi/mi-return.exp @@ -40,8 +40,8 @@ proc test_return_simple {} { global hex fullname_syntax srcfile set line_callee3_head [gdb_get_line_number "callee3 ("] - set line_callee3_call [expr $line_callee3_head + 2] - set line_callee3_close_brace [expr $line_callee3_head + 3] + set line_callee3_call [expr {$line_callee3_head + 2}] + set line_callee3_close_brace [expr {$line_callee3_head + 3}] mi_gdb_test "111-exec-return" "111\\^done,frame=\{level=\"0\",addr=\"$hex\",func=\"callee3\",args=\\\[.*\\\],file=\".*basics.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"($line_callee3_call|$line_callee3_close_brace)\",arch=\"\[^\"\]+\"\}" "return from callee4 now" } diff --git a/gdb/testsuite/gdb.mi/mi-reverse.exp b/gdb/testsuite/gdb.mi/mi-reverse.exp index aa25255..5f6eb3f 100644 --- a/gdb/testsuite/gdb.mi/mi-reverse.exp +++ b/gdb/testsuite/gdb.mi/mi-reverse.exp @@ -42,11 +42,11 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb mi_clean_restart $::testfile mi_runto_main -if [supports_process_record] { +if {[supports_process_record]} { # Activate process record/replay - if [mi_gdb_test "-interpreter-exec console record" \ - "=record-started,thread-group=\"i1\",method=\"full\"\r\n\\^done" \ - "Turn on process record"] { + if {[mi_gdb_test "-interpreter-exec console record" \ + "=record-started,thread-group=\"i1\",method=\"full\"\r\n\\^done" \ + "Turn on process record"]} { warning "Fail to activate process record/replay, tests in this group will not be performed.\n" return -1 } @@ -54,20 +54,20 @@ if [supports_process_record] { # Locate line numbers in basics.c. set line_callee4_head [gdb_get_line_number "callee4 ("] -set line_callee4_body [expr $line_callee4_head + 2] +set line_callee4_body [expr {$line_callee4_head + 2}] set line_callee3_head [gdb_get_line_number "callee3 ("] -set line_callee3_body [expr $line_callee3_head + 2] -set line_callee3_close [expr $line_callee3_head + 3] +set line_callee3_body [expr {$line_callee3_head + 2}] +set line_callee3_close [expr {$line_callee3_head + 3}] set line_callee2_head [gdb_get_line_number "callee2 ("] -set line_callee2_body [expr $line_callee2_head + 2] -set line_callee2_close [expr $line_callee2_head + 3] +set line_callee2_body [expr {$line_callee2_head + 2}] +set line_callee2_close [expr {$line_callee2_head + 3}] set line_callee1_head [gdb_get_line_number "callee1 ("] -set line_callee1_body [expr $line_callee1_head + 2] -set line_callee1_close [expr $line_callee1_head + 3] +set line_callee1_body [expr {$line_callee1_head + 2}] +set line_callee1_close [expr {$line_callee1_head + 3}] set line_callme_head [gdb_get_line_number "callme"] -set line_callme_body [expr $line_callme_head + 2] +set line_callme_body [expr {$line_callme_head + 2}] set line_main_head [gdb_get_line_number "main ("] -set line_main_body [expr $line_main_head + 2] +set line_main_body [expr {$line_main_head + 2}] set line_main_hello [gdb_get_line_number "Hello, World!"] set line_main_callme_1 [gdb_get_line_number "callme (1"] diff --git a/gdb/testsuite/gdb.mi/mi-simplerun.exp b/gdb/testsuite/gdb.mi/mi-simplerun.exp index 5ee7881..b34097e 100644 --- a/gdb/testsuite/gdb.mi/mi-simplerun.exp +++ b/gdb/testsuite/gdb.mi/mi-simplerun.exp @@ -42,13 +42,13 @@ proc test_breakpoints_creation_and_listing {} { global srcfile set line_callee4_head [gdb_get_line_number "callee4 ("] - set line_callee4_body [expr $line_callee4_head + 2] + set line_callee4_body [expr {$line_callee4_head + 2}] set line_callee3_head [gdb_get_line_number "callee3 ("] - set line_callee3_body [expr $line_callee3_head + 2] + set line_callee3_body [expr {$line_callee3_head + 2}] set line_callee2_head [gdb_get_line_number "callee2 ("] - set line_callee2_body [expr $line_callee2_head + 2] + set line_callee2_body [expr {$line_callee2_head + 2}] set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] + set line_main_body [expr {$line_main_head + 2}] # Insert some breakpoints and list them # Also, disable some so they do not interfere with other tests @@ -96,7 +96,7 @@ proc test_breakpoints_creation_and_listing {} { proc test_running_the_program {} { set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] + set line_main_body [expr {$line_main_head + 2}] # Run the program without args, then specify srgs and rerun the program # Tests: @@ -115,14 +115,14 @@ proc test_controlled_execution {} { global hex set line_callee4_head [gdb_get_line_number "callee4 ("] - set line_callee4_body [expr $line_callee4_head + 2] + set line_callee4_body [expr {$line_callee4_head + 2}] set line_callee3_head [gdb_get_line_number "callee3 ("] - set line_callee3_call [expr $line_callee3_head + 2] - set line_callee3_close_brace [expr $line_callee3_head + 3] + set line_callee3_call [expr {$line_callee3_head + 2}] + set line_callee3_close_brace [expr {$line_callee3_head + 3}] set line_callee1_head [gdb_get_line_number "callee1 ("] - set line_callee1_body [expr $line_callee1_head + 2] + set line_callee1_body [expr {$line_callee1_head + 2}] set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] + set line_main_body [expr {$line_main_head + 2}] # Continue execution until a breakpoint is reached, step into calls, verifying # if the arguments are correctly shown, continue to the end of a called @@ -133,7 +133,7 @@ proc test_controlled_execution {} { # -exec-step # -exec-finish - mi_next_to "main" "" "basics.c" [expr $line_main_body + 1] "next at main" + mi_next_to "main" "" "basics.c" [expr {$line_main_body + 1}] "next at main" # FIXME: A string argument is not printed right; should be fixed and # we should look for the right thing here. diff --git a/gdb/testsuite/gdb.mi/mi-stack.exp b/gdb/testsuite/gdb.mi/mi-stack.exp index 89f58c8..ebd685f 100644 --- a/gdb/testsuite/gdb.mi/mi-stack.exp +++ b/gdb/testsuite/gdb.mi/mi-stack.exp @@ -87,7 +87,7 @@ proc test_stack_args_listing {} { # -stack-list-arguments 1 # -stack-list-arguments 1 1 1 # -stack-list-arguments 1 1 3 - # -stack-list-arguments + # -stack-list-arguments # -stack-list-arguments 1 1 300 # -stack-list-arguments 2 1 1 # -stack-list-arguments --simple-values 1 1 diff --git a/gdb/testsuite/gdb.mi/mi-stepi.exp b/gdb/testsuite/gdb.mi/mi-stepi.exp index 7f53c8b..f2871dc 100644 --- a/gdb/testsuite/gdb.mi/mi-stepi.exp +++ b/gdb/testsuite/gdb.mi/mi-stepi.exp @@ -35,7 +35,7 @@ proc test_stepi_nexti {} { global hex fullname_syntax srcfile set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] + set line_main_body [expr {$line_main_head + 2}] set line_main_hello [gdb_get_line_number "Hello, World!"] set line [mi_execute_to "exec-step-instruction" "end-stepping-range" "main" "" \ @@ -44,7 +44,7 @@ proc test_stepi_nexti {} { pass "step-instruction at main, line check" } else { fail "step-instruction at main, line check" - } + } set line [mi_execute_to "exec-next-instruction" "end-stepping-range" "main" "" \ ".*basics.c" "\[0-9\]+" "" "next-instruction at main"] diff --git a/gdb/testsuite/gdb.mi/mi-stepn.exp b/gdb/testsuite/gdb.mi/mi-stepn.exp index f11e9c0..85b2092 100644 --- a/gdb/testsuite/gdb.mi/mi-stepn.exp +++ b/gdb/testsuite/gdb.mi/mi-stepn.exp @@ -22,7 +22,7 @@ set MIFLAGS "-i=mi" standard_testfile set opts {debug} -if [build_executable ${testfile}.exp ${testfile} ${srcfile} $opts] { +if {[build_executable ${testfile}.exp ${testfile} ${srcfile} $opts]} { return -1 } diff --git a/gdb/testsuite/gdb.mi/mi-syn-frame.exp b/gdb/testsuite/gdb.mi/mi-syn-frame.exp index b3ec377..11e208d 100644 --- a/gdb/testsuite/gdb.mi/mi-syn-frame.exp +++ b/gdb/testsuite/gdb.mi/mi-syn-frame.exp @@ -91,7 +91,7 @@ mi_gdb_test "409-stack-list-frames 0 0" \ # # Call bar() by hand, which should get an exception while running. -# +# mi_gdb_test "410-data-evaluate-expression bar()" \ ".*410\\^error,msg=\"The program being debugged was signaled while in a function called from GDB.\\\\nGDB remains in the frame where the signal was received.\\\\nTo change this behavior use \\\\\"set unwind-on-signal on\\\\\".\\\\nEvaluation of the expression containing the function\\\\n\\(bar\\) will be abandoned.\\\\nWhen the function is done executing, GDB will silently stop.\"" \ diff --git a/gdb/testsuite/gdb.mi/mi-thread-bp-deleted.exp b/gdb/testsuite/gdb.mi/mi-thread-bp-deleted.exp index 976b68d..e07767c 100644 --- a/gdb/testsuite/gdb.mi/mi-thread-bp-deleted.exp +++ b/gdb/testsuite/gdb.mi/mi-thread-bp-deleted.exp @@ -24,9 +24,9 @@ set MIFLAGS "-i=mi" # We need to do things a little differently when using the remote protocol. set is_remote \ - [expr [target_info exists gdb_protocol] \ - && ([string equal [target_info gdb_protocol] "remote"] \ - || [string equal [target_info gdb_protocol] "extended-remote"])] + [expr {[target_info exists gdb_protocol] \ + && ([string equal [target_info gdb_protocol] "remote"] \ + || [string equal [target_info gdb_protocol] "extended-remote"])}] standard_testfile diff --git a/gdb/testsuite/gdb.mi/mi-thread-specific-bp.exp b/gdb/testsuite/gdb.mi/mi-thread-specific-bp.exp index 81ff274..c8543f4 100644 --- a/gdb/testsuite/gdb.mi/mi-thread-specific-bp.exp +++ b/gdb/testsuite/gdb.mi/mi-thread-specific-bp.exp @@ -25,7 +25,7 @@ if {[mi_clean_restart]} { standard_testfile -if [build_executable ${testfile}.exp ${binfile} ${srcfile}] { +if {[build_executable ${testfile}.exp ${binfile} ${srcfile}]} { return -1 } diff --git a/gdb/testsuite/gdb.mi/mi-until.exp b/gdb/testsuite/gdb.mi/mi-until.exp index e8f24bc..b027c76 100644 --- a/gdb/testsuite/gdb.mi/mi-until.exp +++ b/gdb/testsuite/gdb.mi/mi-until.exp @@ -67,7 +67,7 @@ proc test_until {} { # after foo is over. set line [gdb_get_line_number "at-return"] mi_execute_to "exec-until until.c:$line" "location-reached" "main" ""\ - ".*until.c" "([expr $line-2]|[expr $line-1])" ""\ + ".*until.c" "([expr {$line-2}]|[expr {$line-1}])" ""\ "until after current function" } diff --git a/gdb/testsuite/gdb.mi/mi-var-child.exp b/gdb/testsuite/gdb.mi/mi-var-child.exp index 4a3ba07..c69b72a 100644 --- a/gdb/testsuite/gdb.mi/mi-var-child.exp +++ b/gdb/testsuite/gdb.mi/mi-var-child.exp @@ -667,7 +667,7 @@ mi_varobj_update * {} "update all vars. None changed" # Step over "struct_declarations.integer = 123;" mi_step_to do_children_tests {} ".*${srcfile}" \ - [expr $line_dct_123 + 1] "step \$line_dct_123 + 1" + [expr {$line_dct_123 + 1}] "step \$line_dct_123 + 1" # Test: c_variable-5.2 # Desc: check that integer changed @@ -679,7 +679,7 @@ mi_varobj_update * {struct_declarations.integer} \ # bar = 2121; # foo = &bar; mi_execute_to "exec-step 3" "end-stepping-range" do_children_tests {} ".*${srcfile}" \ - [expr $line_dct_123 + 4] {} "step \$line_dct_123 + 4" + [expr {$line_dct_123 + 4}] {} "step \$line_dct_123 + 4" # Test: c_variable-5.3 # Desc: check that char_ptr changed @@ -688,7 +688,7 @@ mi_varobj_update * {struct_declarations.char_ptr struct_declarations.char_ptr.\\ # Step over "struct_declarations.int_ptr_ptr = &foo;" mi_step_to do_children_tests {} ".*${srcfile}" \ - [expr $line_dct_123 + 5] "step \$line_dct_123 + 5" + [expr {$line_dct_123 + 5}] "step \$line_dct_123 + 5" # Test: c_variable-5.4 # Desc: check that int_ptr_ptr and children changed @@ -702,7 +702,7 @@ mi_varobj_update * {weird->int_ptr_ptr # Step over "weird->long_array[0] = 1234;" mi_step_to do_children_tests {} ".*${srcfile}" \ - [expr $line_dct_123 + 6] "step \$line_dct_123 + 6" + [expr {$line_dct_123 + 6}] "step \$line_dct_123 + 6" # Test: c_variable-5.5 # Desc: check that long_array[0] changed @@ -711,7 +711,7 @@ mi_varobj_update * {struct_declarations.long_array.0} \ # Step over "struct_declarations.long_array[1] = 2345;" mi_step_to do_children_tests {} ".*${srcfile}" \ - [expr $line_dct_123 + 7] "step \$line_dct_123 + 7" + [expr {$line_dct_123 + 7}] "step \$line_dct_123 + 7" # Test: c_variable-5.6 # Desc: check that long_array[1] changed @@ -720,7 +720,7 @@ mi_varobj_update * {struct_declarations.long_array.1} \ # Step over "weird->long_array[2] = 3456;" mi_step_to do_children_tests {} ".*${srcfile}" \ - [expr $line_dct_123 + 8] "step \$line_dct_123 + 8" + [expr {$line_dct_123 + 8}] "step \$line_dct_123 + 8" # Test: c_variable-5.7 # Desc: check that long_array[2] changed @@ -754,7 +754,7 @@ mi_varobj_update * {struct_declarations.long_array.3 # Step over "weird->func_ptr = nothing"; mi_step_to do_children_tests {} ".*${srcfile}" \ - [expr $line_dct_nothing + 1] "step \$line_dct_nothing + 1" + [expr {$line_dct_nothing + 1}] "step \$line_dct_nothing + 1" # Test: c_variable-5.9 # Desc: check that func_ptr changed @@ -763,19 +763,19 @@ mi_varobj_update * {struct_declarations.func_ptr} \ # Step over "weird->func_ptr_struct = nothing1" mi_step_to do_children_tests {} ".*${srcfile}" \ - [expr $line_dct_nothing + 2] "step \$line_dct_nothing + 2" + [expr {$line_dct_nothing + 2}] "step \$line_dct_nothing + 2" mi_varobj_update * {struct_declarations.func_ptr_struct} \ "update all vars struct_declarations.func_ptr_struct changed" # Step over "weird->func_ptr_ptr = nothing2" mi_step_to do_children_tests {} ".*${srcfile}" \ - [expr $line_dct_nothing + 3] "step \$line_dct_nothing + 3" + [expr {$line_dct_nothing + 3}] "step \$line_dct_nothing + 3" mi_varobj_update * {struct_declarations.func_ptr_ptr} \ "update all vars struct_declarations.func_ptr_ptr changed" # Step over "struct_declarations.long_array[10] = 3456"; mi_step_to do_children_tests {} ".*${srcfile}" \ - [expr $line_dct_nothing + 4] "step \$line_dct_nothing + 4" + [expr {$line_dct_nothing + 4}] "step \$line_dct_nothing + 4" mi_gdb_test "-var-update --no-values *" \ "\\^done,changelist=\\\[\{name=\"struct_declarations.long_array.10\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \ @@ -837,7 +837,7 @@ mi_gdb_test "-var-delete weird->int_ptr_ptr" \ set line_dct_snp0 [gdb_get_line_number "psnp = &snp0;"] mi_execute_to "exec-step 43" "end-stepping-range" do_children_tests {} ".*${srcfile}" \ - [expr $line_dct_snp0 + 1] {} "step \$line_dct_snp0 + 1" + [expr {$line_dct_snp0 + 1}] {} "step \$line_dct_snp0 + 1" # Test: c_variable-5.10 # Desc: create psnp->char_ptr @@ -987,7 +987,7 @@ mi_create_varobj "psnp->ptrs" "psnp->ptrs" \ # Test: c_variable-5.31 # Desc: children of psnp->ptrs -mi_list_varobj_children "psnp->ptrs" { +mi_list_varobj_children "psnp->ptrs" { {psnp->ptrs.0 0 4 {struct _struct_n_pointer \*}} {psnp->ptrs.1 1 4 {struct _struct_n_pointer \*}} {psnp->ptrs.2 2 4 {struct _struct_n_pointer \*}} @@ -1123,7 +1123,7 @@ mi_list_varobj_children "psnp->ptrs.0.next.next.ptrs" { # Step over "snp0.char_ptr = &b3;" mi_step_to do_children_tests {} ".*${srcfile}" \ - [expr $line_dct_snp0 + 2] "step \$line_dct_snp0 + 2" + [expr {$line_dct_snp0 + 2}] "step \$line_dct_snp0 + 2" # Test: c_variable-5.47 # Desc: check that psnp->char_ptr (and [0].char_ptr) changed @@ -1136,7 +1136,7 @@ mi_varobj_update * {psnp->ptrs.0.char_ptr # Step over "snp1.char_ptr = &c3;" mi_step_to do_children_tests {} ".*${srcfile}" \ - [expr $line_dct_snp0 + 3] "step \$line_dct_snp0 + 3" + [expr {$line_dct_snp0 + 3}] "step \$line_dct_snp0 + 3" # Test: c_variable-5.48 # Desc: check that psnp->next->char_ptr (and [1].char_ptr) changed @@ -1150,7 +1150,7 @@ mi_varobj_update * {psnp->ptrs.0.next.char_ptr # Step over "snp2.char_ptr = &a3;" mi_step_to do_children_tests {} ".*${srcfile}" \ - [expr $line_dct_snp0 + 4] "step \$line_dct_snp0 + 4" + [expr {$line_dct_snp0 + 4}] "step \$line_dct_snp0 + 4" # Test: c_variable-5.49 # Desc: check that psnp->next->next->char_ptr (and [2].char_ptr) changed @@ -1160,7 +1160,7 @@ mi_varobj_update * {psnp->ptrs.0.next.next.char_ptr} \ # Step over "snp0.long_ptr = &y3;" mi_step_to do_children_tests {} ".*${srcfile}" \ - [expr $line_dct_snp0 + 5] "step \$line_dct_snp0 + 5" + [expr {$line_dct_snp0 + 5}] "step \$line_dct_snp0 + 5" # Test: c_variable-5.50 # Desc: check that psnp->long_ptr (and [0].long_ptr) changed @@ -1174,7 +1174,7 @@ mi_varobj_update * {psnp->ptrs.0.long_ptr psnp->long_ptr # Step over "snp1.long_ptr = &x3;" mi_step_to do_children_tests {} ".*${srcfile}" \ - [expr $line_dct_snp0 + 6] "step \$line_dct_snp0 + 6" + [expr {$line_dct_snp0 + 6}] "step \$line_dct_snp0 + 6" # Test: c_variable-5.51 # Desc: check that psnp->next->long_ptr (and [1].long_ptr) changed @@ -1191,7 +1191,7 @@ clear_xfail *-*-* # Step over "snp2.long_ptr = &z3;" mi_step_to do_children_tests {} ".*${srcfile}" \ - [expr $line_dct_snp0 + 7] "step \$line_dct_snp0 + 7" + [expr {$line_dct_snp0 + 7}] "step \$line_dct_snp0 + 7" # Test: c_variable-5.52 # Desc: check that psnp->next->next->long_ptr (and [2].long_ptr) changed diff --git a/gdb/testsuite/gdb.mi/mi-var-cmd.exp b/gdb/testsuite/gdb.mi/mi-var-cmd.exp index 9e7b14c..850cb99 100644 --- a/gdb/testsuite/gdb.mi/mi-var-cmd.exp +++ b/gdb/testsuite/gdb.mi/mi-var-cmd.exp @@ -150,7 +150,7 @@ mi_gdb_test "-var-update *" \ "update all vars: linteger changed" # Step over "lpinteger = &linteger;" -mi_step_to "do_locals_tests" "" "var-cmd.c" [expr $line_dlt_linteger + 1] "step at do_locals_tests, 2" +mi_step_to "do_locals_tests" "" "var-cmd.c" [expr {$line_dlt_linteger + 1}] "step at do_locals_tests, 2" # Test: c_variable-2.3 # Desc: check whether only lpinteger changed @@ -159,7 +159,7 @@ mi_gdb_test "-var-update *" \ "update all vars: lpinteger changed" # Step over "lcharacter = 'a';" -mi_step_to "do_locals_tests" "" "var-cmd.c" [expr $line_dlt_linteger + 2] "step at do_locals_tests, 3" +mi_step_to "do_locals_tests" "" "var-cmd.c" [expr {$line_dlt_linteger + 2}] "step at do_locals_tests, 3" # Test: c_variable-2.4 # Desc: check whether only lcharacter changed @@ -168,7 +168,7 @@ mi_gdb_test "-var-update *" \ "update all vars: lcharacter changed" # Step over "lpcharacter = &lcharacter;" -mi_step_to "do_locals_tests" "" "var-cmd.c" [expr $line_dlt_linteger + 3] "step at do_locals_tests, 4" +mi_step_to "do_locals_tests" "" "var-cmd.c" [expr {$line_dlt_linteger + 3}] "step at do_locals_tests, 4" # Test: c_variable-2.5 # Desc: check whether only lpcharacter changed @@ -189,7 +189,7 @@ mi_gdb_test "-var-update *" \ # lsimple.character = 'a'; mi_execute_to "exec-step 9" "end-stepping-range" "do_locals_tests" "" \ - "var-cmd.c" [expr $line_dlt_linteger + 12] "" "step at do_locals_tests, 5" + "var-cmd.c" [expr {$line_dlt_linteger + 12}] "" "step at do_locals_tests, 5" # Test: c_variable-2.6 # Desc: check whether llong, lplong, lfloat, lpfloat, ldouble, lpdouble, lsimple.integer, @@ -226,7 +226,7 @@ mi_gdb_test "-var-update *" \ # lsimple.character = 'b'; mi_execute_to "exec-step 8" "end-stepping-range" "do_locals_tests" "" \ - "var-cmd.c" [expr $line_dlt_4321 + 8] "" "step at do_locals_tests, 7" + "var-cmd.c" [expr {$line_dlt_4321 + 8}] "" "step at do_locals_tests, 7" # Test: c_variable-2.8 # Desc: check whether linteger, lcharacter, llong, lfoat, ldouble, lsimple.integer, @@ -238,7 +238,7 @@ mi_gdb_test "-var-update *" \ "update all vars: lsimple and others changed" -### +### # # Test assignment to variables. More tests on assignment are in other files. # @@ -366,7 +366,7 @@ mi_gdb_test "-var-update *" \ # Check that assignment of function and array values # promotes the assigned value to function pointer/data -# pointer before comparing with the existing value, +# pointer before comparing with the existing value, # and does not incorrectly make the value as changed. mi_gdb_test "-var-assign func do_block_tests" \ "\\^done,value=\"$hex <do_block_tests>\"" \ @@ -398,7 +398,7 @@ mi_gdb_test "-var-update *" \ ###### -# End of assign tests +# End of assign tests ##### set line_subroutine1_body [gdb_get_line_number "global_simple.integer = i + 3;"] @@ -418,7 +418,7 @@ mi_gdb_test "-var-create linteger * linteger" \ "create linteger" mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \ - "var-cmd.c" [expr $line_subroutine1_body + 1] "step at subroutine1" + "var-cmd.c" [expr {$line_subroutine1_body + 1}] "step at subroutine1" # Test: c_variable-2.12 # Desc: change global_simple.integer @@ -434,7 +434,7 @@ mi_gdb_test "-var-update *" \ clear_xfail *-*-* mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \ - "var-cmd.c" [expr $line_subroutine1_body + 2] "step at subroutine1, 2" + "var-cmd.c" [expr {$line_subroutine1_body + 2}] "step at subroutine1, 2" # Test: c_variable-2.13 # Desc: change subroutine1 local i @@ -443,7 +443,7 @@ mi_gdb_test "-var-update *" \ "update all vars: i changed" mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \ - "var-cmd.c" [expr $line_subroutine1_body + 3] "step at subroutine1, 3" + "var-cmd.c" [expr {$line_subroutine1_body + 3}] "step at subroutine1, 3" # Test: c_variable-2.14 # Desc: change do_locals_tests local llong @@ -453,7 +453,7 @@ mi_gdb_test "-var-update *" \ set line_dlt_call_subroutine1 [gdb_get_line_number "subroutine1 (linteger, &llong);"] mi_next_to "do_locals_tests" "" "var-cmd.c" \ - [expr $line_dlt_call_subroutine1 + 1] "next out of subroutine1" + [expr {$line_dlt_call_subroutine1 + 1}] "next out of subroutine1" # Test: c_variable-2.15 # Desc: check for out of scope subroutine1 locals @@ -560,7 +560,7 @@ mi_gdb_test "-var-update selected_a" \ "\\^done,changelist=\\\[\{name=\"selected_a\",in_scope=\"true\",type_changed=\"true\",new_type=\"int\",new_num_children=\"0\",has_more=\"0\"\}\\\]" \ "update selected_a in do_special_tests" -if [is_remote host] { +if {[is_remote host]} { set filename ${testfile} } else { set filename ${binfile} diff --git a/gdb/testsuite/gdb.mi/mi-var-create-rtti.exp b/gdb/testsuite/gdb.mi/mi-var-create-rtti.exp index 517449c..371d430 100644 --- a/gdb/testsuite/gdb.mi/mi-var-create-rtti.exp +++ b/gdb/testsuite/gdb.mi/mi-var-create-rtti.exp @@ -19,7 +19,7 @@ set MIFLAGS "-i=mi" standard_testfile .c set opts {debug} -if [build_executable $testfile.exp $testfile $srcfile $opts] { +if {[build_executable $testfile.exp $testfile $srcfile $opts]} { return -1 } diff --git a/gdb/testsuite/gdb.mi/mi-var-display.exp b/gdb/testsuite/gdb.mi/mi-var-display.exp index 3ae593b..52a5276 100644 --- a/gdb/testsuite/gdb.mi/mi-var-display.exp +++ b/gdb/testsuite/gdb.mi/mi-var-display.exp @@ -624,8 +624,8 @@ mi_gdb_test "-var-list-children anone" \ # Record fp -if ![mi_gdb_test "p/x \$fp" ".*($hex).*\\^done" "print FP register"] { - set fp $expect_out(3,string) +if {![mi_gdb_test "p/x \$fp" ".*($hex).*\\^done" "print FP register"]} { + set fp $expect_out(3,string) } mi_continue_to "incr_a" diff --git a/gdb/testsuite/gdb.mi/mi-var-rtti.exp b/gdb/testsuite/gdb.mi/mi-var-rtti.exp index c2768b6..2482df7 100644 --- a/gdb/testsuite/gdb.mi/mi-var-rtti.exp +++ b/gdb/testsuite/gdb.mi/mi-var-rtti.exp @@ -21,7 +21,7 @@ set MIFLAGS "-i=mi" standard_testfile .cc set opts {debug c++} -if [build_executable $testfile.exp $testfile $srcfile $opts] { +if {[build_executable $testfile.exp $testfile $srcfile $opts]} { return -1 } diff --git a/gdb/testsuite/gdb.mi/mi-watch.exp b/gdb/testsuite/gdb.mi/mi-watch.exp index 43f2378..1ddd94e 100644 --- a/gdb/testsuite/gdb.mi/mi-watch.exp +++ b/gdb/testsuite/gdb.mi/mi-watch.exp @@ -44,7 +44,7 @@ proc test_watchpoint_creation_and_listing {} { global hex set line_callee4_head [gdb_get_line_number "callee4 ("] - set line_callee4_body [expr $line_callee4_head + 2] + set line_callee4_body [expr {$line_callee4_head + 2}] # Insert a watchpoint and list # Tests: @@ -68,7 +68,7 @@ proc test_awatch_creation_and_listing {} { global hex set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] + set line_main_body [expr {$line_main_head + 2}] # Insert an access watchpoint and list it # Tests: @@ -95,7 +95,7 @@ proc test_rwatch_creation_and_listing {} { global hex set line_main_head [gdb_get_line_number "main ("] - set line_main_body [expr $line_main_head + 2] + set line_main_body [expr {$line_main_head + 2}] # Insert a read watchpoint and list it. # Tests: @@ -121,9 +121,9 @@ proc test_watchpoint_triggering {} { set line_callee4_return_0 [gdb_get_line_number "return 0;"] set line_callee3_head [gdb_get_line_number "callee3 ("] - set line_callee3_close_brace [expr $line_callee3_head + 3] + set line_callee3_close_brace [expr {$line_callee3_head + 3}] - # Continue execution until the watchpoint is reached, continue again, + # Continue execution until the watchpoint is reached, continue again, # to see the watchpoint go out of scope. # Does: # -exec-continue (Here wp triggers) @@ -155,7 +155,7 @@ proc test_watchpoint_all {mi_mode type} { } else { set start_ops "" } - if [mi_clean_restart ${::testfile} $start_ops] { + if {[mi_clean_restart ${::testfile} $start_ops]} { return } diff --git a/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp b/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp index 0d51dc5..4b1d440 100644 --- a/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp +++ b/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp @@ -19,7 +19,7 @@ set MIFLAGS "-i=mi2" standard_testfile .s set opts {} -if [info exists COMPILE] { +if {[info exists COMPILE]} { # make check RUNTESTFLAGS="gdb.mi/mi2-amd64-entry-value.exp COMPILE=1" set srcfile ${testfile}.c lappend opts debug optimize=-O2 @@ -27,7 +27,7 @@ if [info exists COMPILE] { require is_x86_64_m64_target } -if [build_executable ${testfile}.exp ${binfile} ${srcfile} $opts] { +if {[build_executable ${testfile}.exp ${binfile} ${srcfile} $opts]} { return -1 } diff --git a/gdb/testsuite/gdb.mi/mi2-var-child.exp b/gdb/testsuite/gdb.mi/mi2-var-child.exp index 3618d5a..4ee19f0 100644 --- a/gdb/testsuite/gdb.mi/mi2-var-child.exp +++ b/gdb/testsuite/gdb.mi/mi2-var-child.exp @@ -667,7 +667,7 @@ mi_varobj_update * {} "update all vars. None changed" # Step over "struct_declarations.integer = 123;" mi_step_to do_children_tests {} {.*var-cmd.c} \ - [expr $line_dct_123 + 1] "step \$line_dct_123 + 1" + [expr {$line_dct_123 + 1}] "step \$line_dct_123 + 1" # Test: c_variable-5.2 # Desc: check that integer changed @@ -679,7 +679,7 @@ mi_varobj_update * {struct_declarations.integer} \ # bar = 2121; # foo = &bar; mi_execute_to "exec-step 3" "end-stepping-range" do_children_tests {} {.*var-cmd.c} \ - [expr $line_dct_123 + 4] {} "step \$line_dct_123 + 4" + [expr {$line_dct_123 + 4}] {} "step \$line_dct_123 + 4" # Test: c_variable-5.3 # Desc: check that char_ptr changed @@ -689,7 +689,7 @@ mi_varobj_update * {struct_declarations.char_ptr # Step over "struct_declarations.int_ptr_ptr = &foo;" mi_step_to do_children_tests {} {.*var-cmd.c} \ - [expr $line_dct_123 + 5] "step \$line_dct_123 + 5" + [expr {$line_dct_123 + 5}] "step \$line_dct_123 + 5" # Test: c_variable-5.4 # Desc: check that int_ptr_ptr and children changed @@ -703,7 +703,7 @@ mi_varobj_update * {weird->int_ptr_ptr # Step over "weird->long_array[0] = 1234;" mi_step_to do_children_tests {} {.*var-cmd.c} \ - [expr $line_dct_123 + 6] "step \$line_dct_123 + 6" + [expr {$line_dct_123 + 6}] "step \$line_dct_123 + 6" # Test: c_variable-5.5 # Desc: check that long_array[0] changed @@ -712,7 +712,7 @@ mi_varobj_update * {struct_declarations.long_array.0} \ # Step over "struct_declarations.long_array[1] = 2345;" mi_step_to do_children_tests {} {.*var-cmd.c} \ - [expr $line_dct_123 + 7] "step \$line_dct_123 + 7" + [expr {$line_dct_123 + 7}] "step \$line_dct_123 + 7" # Test: c_variable-5.6 # Desc: check that long_array[1] changed @@ -721,7 +721,7 @@ mi_varobj_update * {struct_declarations.long_array.1} \ # Step over "weird->long_array[2] = 3456;" mi_step_to do_children_tests {} {.*var-cmd.c} \ - [expr $line_dct_123 + 8] "step \$line_dct_123 + 8" + [expr {$line_dct_123 + 8}] "step \$line_dct_123 + 8" # Test: c_variable-5.7 # Desc: check that long_array[2] changed @@ -755,7 +755,7 @@ mi_varobj_update * {struct_declarations.long_array.3 # Step over "weird->func_ptr = nothing;" mi_step_to do_children_tests {} ".*${srcfile}" \ - [expr $line_dct_nothing + 1] "step \$line_dct_nothing + 1" + [expr {$line_dct_nothing + 1}] "step \$line_dct_nothing + 1" # Test: c_variable-5.9 # Desc: check that func_ptr changed @@ -777,7 +777,7 @@ mi_gdb_test "-var-delete weird->int_ptr_ptr" \ set line_dct_snp0 [gdb_get_line_number "psnp = &snp0;"] mi_execute_to "exec-step 45" "end-stepping-range" do_children_tests {} {.*var-cmd.c} \ - [expr $line_dct_snp0 + 1] {} "step \$line_dct_snp0 + 1" + [expr {$line_dct_snp0 + 1}] {} "step \$line_dct_snp0 + 1" # Test: c_variable-5.10 # Desc: create psnp->char_ptr @@ -928,7 +928,7 @@ mi_create_varobj "psnp->ptrs" "psnp->ptrs" \ # Test: c_variable-5.31 # Desc: children of psnp->ptrs -mi_list_varobj_children "psnp->ptrs" { +mi_list_varobj_children "psnp->ptrs" { {psnp->ptrs.0 0 4 {struct _struct_n_pointer \*}} {psnp->ptrs.1 1 4 {struct _struct_n_pointer \*}} {psnp->ptrs.2 2 4 {struct _struct_n_pointer \*}} @@ -1065,7 +1065,7 @@ mi_list_varobj_children "psnp->ptrs.0.next.next.ptrs" { # Step over "snp0.char_ptr = &b3;" mi_step_to do_children_tests {} {.*var-cmd.c} \ - [expr $line_dct_snp0 + 2] "step \$line_dct_snp0 + 2" + [expr {$line_dct_snp0 + 2}] "step \$line_dct_snp0 + 2" # Test: c_variable-5.47 # Desc: check that psnp->char_ptr (and [0].char_ptr) changed @@ -1078,7 +1078,7 @@ mi_varobj_update * {psnp->ptrs.0.char_ptr # Step over "snp1.char_ptr = &c3;" mi_step_to do_children_tests {} {.*var-cmd.c} \ - [expr $line_dct_snp0 + 3] "step \$line_dct_snp0 + 3" + [expr {$line_dct_snp0 + 3}] "step \$line_dct_snp0 + 3" # Test: c_variable-5.48 # Desc: check that psnp->next->char_ptr (and [1].char_ptr) changed @@ -1092,7 +1092,7 @@ mi_varobj_update * {psnp->ptrs.0.next.char_ptr # Step over "snp2.char_ptr = &a3;" mi_step_to do_children_tests {} {.*var-cmd.c} \ - [expr $line_dct_snp0 + 4] "step \$line_dct_snp0 + 4" + [expr {$line_dct_snp0 + 4}] "step \$line_dct_snp0 + 4" # Test: c_variable-5.49 # Desc: check that psnp->next->next->char_ptr (and [2].char_ptr) changed @@ -1102,7 +1102,7 @@ mi_varobj_update * {psnp->ptrs.0.next.next.char_ptr} \ # Step over "snp0.long_ptr = &y3;" mi_step_to do_children_tests {} {.*var-cmd.c} \ - [expr $line_dct_snp0 + 5] "step \$line_dct_snp0 + 5" + [expr {$line_dct_snp0 + 5}] "step \$line_dct_snp0 + 5" # Test: c_variable-5.50 # Desc: check that psnp->long_ptr (and [0].long_ptr) changed @@ -1116,7 +1116,7 @@ mi_varobj_update * {psnp->ptrs.0.long_ptr psnp->long_ptr # Step over "snp1.long_ptr = &x3;" mi_step_to do_children_tests {} {.*var-cmd.c} \ - [expr $line_dct_snp0 + 6] "step \$line_dct_snp0 + 6" + [expr {$line_dct_snp0 + 6}] "step \$line_dct_snp0 + 6" # Test: c_variable-5.51 # Desc: check that psnp->next->long_ptr (and [1].long_ptr) changed @@ -1133,7 +1133,7 @@ clear_xfail *-*-* # Step over "snp2.long_ptr = &z3;" mi_step_to do_children_tests {} {.*var-cmd.c} \ - [expr $line_dct_snp0 + 7] "step \$line_dct_snp0 + 7" + [expr {$line_dct_snp0 + 7}] "step \$line_dct_snp0 + 7" # Test: c_variable-5.52 # Desc: check that psnp->next->next->long_ptr (and [2].long_ptr) changed diff --git a/gdb/testsuite/gdb.mi/new-ui-bp-deleted.exp b/gdb/testsuite/gdb.mi/new-ui-bp-deleted.exp index aa18668..b5b748e 100644 --- a/gdb/testsuite/gdb.mi/new-ui-bp-deleted.exp +++ b/gdb/testsuite/gdb.mi/new-ui-bp-deleted.exp @@ -51,7 +51,7 @@ foreach_mi_ui_mode mode { set start_ops "" } - if [mi_gdb_start $start_ops] { + if {[mi_gdb_start $start_ops]} { return } diff --git a/gdb/testsuite/gdb.mi/new-ui-mi-sync.exp b/gdb/testsuite/gdb.mi/new-ui-mi-sync.exp index 7112248..cda1e01 100644 --- a/gdb/testsuite/gdb.mi/new-ui-mi-sync.exp +++ b/gdb/testsuite/gdb.mi/new-ui-mi-sync.exp @@ -69,7 +69,9 @@ proc do_test {sync_command} { # in the separate MI UI. Note the "run" variant usually triggers # =thread-group-started/=thread-created/=library-loaded as well. with_spawn_id $gdb_main_spawn_id { - gdb_test "add-inferior" "Added inferior 2 on connection .*" + # We don't need to share the connection with inferior 1 to + # trigger the async event. + gdb_test "add-inferior -no-connection" "Added inferior 2" } # Interrupt the program. diff --git a/gdb/testsuite/gdb.mi/print-simple-values.exp b/gdb/testsuite/gdb.mi/print-simple-values.exp index 23488e3..023f87c 100644 --- a/gdb/testsuite/gdb.mi/print-simple-values.exp +++ b/gdb/testsuite/gdb.mi/print-simple-values.exp @@ -30,11 +30,11 @@ lappend opts debug lappend opts c++ lappend opts additional_flags=-std=c++11 -if [build_executable "failed to prepare" $testfile $srcfile $opts] { +if {[build_executable "failed to prepare" $testfile $srcfile $opts]} { return -1 } -if [mi_clean_restart $::testfile] { +if {[mi_clean_restart $::testfile]} { return } diff --git a/gdb/testsuite/gdb.mi/user-selected-context-sync.exp b/gdb/testsuite/gdb.mi/user-selected-context-sync.exp index a0bf11f..c954057 100644 --- a/gdb/testsuite/gdb.mi/user-selected-context-sync.exp +++ b/gdb/testsuite/gdb.mi/user-selected-context-sync.exp @@ -113,7 +113,7 @@ proc make_cli_re { mode inf thread frame } { } set thread_re $all_stop_thread_re - if [thread_is_running $mode $thread] { + if {[thread_is_running $mode $thread]} { set thread_re "$thread_re\\\(running\\\)" } diff --git a/gdb/testsuite/gdb.multi/multi-arch.exp b/gdb/testsuite/gdb.multi/multi-arch.exp index b75009d..02c26ba 100644 --- a/gdb/testsuite/gdb.multi/multi-arch.exp +++ b/gdb/testsuite/gdb.multi/multi-arch.exp @@ -53,11 +53,11 @@ if {[istarget "s390*-*-*"]} { } if { $march1 != "" } { - require "have_compile_and_link_flag $march1" + require {have_compile_and_link_flag $march1} } if { $march2 != "" } { - require "have_compile_and_link_flag $march2" + require {have_compile_and_link_flag $march2} } if { [build_executable "failed to prepare" ${exec1} "${srcfile1}" \ diff --git a/gdb/testsuite/gdb.multi/multi-core-files-1.c b/gdb/testsuite/gdb.multi/multi-core-files-1.c new file mode 100644 index 0000000..5d24367 --- /dev/null +++ b/gdb/testsuite/gdb.multi/multi-core-files-1.c @@ -0,0 +1,37 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2022-2025 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/>. */ + +#include <stdlib.h> + +int +bar () +{ + abort (); + return 0; +} + +int +baz () +{ + return bar (); +} + +int +main () +{ + return baz (); +} diff --git a/gdb/testsuite/gdb.multi/multi-core-files-2.c b/gdb/testsuite/gdb.multi/multi-core-files-2.c new file mode 100644 index 0000000..cc05dc6 --- /dev/null +++ b/gdb/testsuite/gdb.multi/multi-core-files-2.c @@ -0,0 +1,31 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2022-2025 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/>. */ + +#include <stdlib.h> + +int +foo () +{ + abort (); + return 0; +} + +int +main () +{ + return foo (); +} diff --git a/gdb/testsuite/gdb.multi/multi-core-files.exp b/gdb/testsuite/gdb.multi/multi-core-files.exp new file mode 100644 index 0000000..ed83b81 --- /dev/null +++ b/gdb/testsuite/gdb.multi/multi-core-files.exp @@ -0,0 +1,171 @@ +# Copyright 2022-2025 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/>. + +# This script runs some basic tests that GDB can support multiple +# inferiors each debugging different core files. +# +# We also check the behaviour of GDB if the user attempts to clone or +# duplicate an inferior that is debugging a core file. + +standard_testfile -1.c -2.c + +set testfile1 "${testfile}-1" +set testfile2 "${testfile}-2" + +set binfile1 [standard_output_file $testfile1] +set binfile2 [standard_output_file $testfile2] + +if {[build_executable "build first executable" $binfile1 $srcfile] == -1} { + return +} + +if {[build_executable "build second executable" $binfile2 $srcfile2] == -1} { + return +} + +set corefile1 [core_find $binfile1] +set corefile2 [core_find $binfile2] +if { $corefile1 == "" || $corefile2 == "" } { + untested "Can't generate core files" + return +} + +# Start GDB, and load the first executable and corefile into the first +# inferior. +clean_restart ${testfile1} +gdb_test "core-file $corefile1" "Program terminated with .*" \ + "load core file" +gdb_test "bt" "bar \\(\\) at .*" \ + "check backtrace in inferior 1" + +# The native-extended-remote board connects to the remote target as +# soon as GDB is started, this means that connection 1 is to the +# remote target, and the core target we create below will be +# connection 2. +# +# In all other cases, the core target gets to be connection 1. +if { [target_info gdb_protocol] == "extended-remote"} { + set conn_num 2 +} else { + set conn_num 1 +} + +# Try to use add-inferior and clone-inferior to create new +# inferiors. In both cases this will try to share the core_target +# between inferior 1 and the new inferior. As the core_target can't +# be shared we should get a warning, and the inferior should be +# created without a connection. +gdb_test "add-inferior" \ + [multi_line \ + "\\\[New inferior 2\\\]" \ + "warning: can't share connection ${conn_num} \\(core\\) between inferiors" \ + "Added inferior 2"] +gdb_test "clone-inferior" \ + [multi_line \ + "\\\[New inferior 3\\\]" \ + "warning: can't share connection ${conn_num} \\(core\\) between inferiors" \ + "Added inferior 3"] + +# Check the MI -add-inferior command. Do this using interpreter-exec. +# We're not doing a full MI test here, just checking this one command. +gdb_test "interpreter-exec mi \"-add-inferior\"" \ + [multi_line \ + "~\"\\\[New inferior 4\\\]..\"" \ + "&\"warning: can't share connection ${conn_num} \\(core\\) between inferiors..\"" \ + "~\"Added inferior 4..\"" \ + "\\^done,inferior=\"\[^\"\]+\""] + +# Now check that none of the new inferiors have a connection. +gdb_test "info inferiors" \ + [multi_line \ + "\\*\\s+1\\s+\[^\r\n\]+\\s+${conn_num} \\(core\\)\\s+\[^\r\n\]+.*" \ + "\\s+2\\s+<null>\\s+" \ + "\\s+3\\s+<null>\\s+\[^\r\n\]+" \ + "\\s+4\\s+<null>\\s+"] \ + "first info inferiors call" + +# Now use add-inferior and clone-inferior but this time with the +# -no-connection option, this should avoid issuing the warning. We +# also use interpreter-exec to test the MI version of this command. +gdb_test "add-inferior -no-connection" \ + [multi_line \ + "\\\[New inferior 5\\\]" \ + "Added inferior 5"] +gdb_test "clone-inferior -no-connection" \ + [multi_line \ + "\\\[New inferior 6\\\]" \ + "Added inferior 6"] +gdb_test "interpreter-exec mi \"-add-inferior --no-connection\"" \ + "\\\[New inferior 7\\\].*Added inferior 7.*" + +# Now check that none of the new inferiors have a connection. +gdb_test "info inferiors" \ + [multi_line \ + "\\*\\s+1\\s+\[^\r\n\]+\\s+${conn_num} \\(core\\)\\s+\[^\r\n\]+.*" \ + "\\s+2\\s+<null>\\s+" \ + "\\s+3\\s+<null>\\s+\[^\r\n\]+" \ + "\\s+4\\s+<null>\\s+" \ + "\\s+5\\s+<null>\\s+" \ + "\\s+6\\s+<null>\\s+\[^\r\n\]+" \ + "\\s+7\\s+<null>\\s+"] \ + "second info inferiors call" + +# Check after all the new inferiors have been created that we still +# only have a single connection. +gdb_test "info connections" \ + "\\*\\s+${conn_num}\\s+\\s+core\\s+Local core dump file\\s*" + +# Now switch to inferior 2 and load the second executable and core +# file. Check the backtrace for the presence of function 'foo', this +# indicates we are seeing the correct core file. +gdb_test "inferior 2" "Switching to inferior 2 .*" +gdb_test "file $binfile2" \ + "Reading symbols from .*" \ + "Loaded second test binary" +gdb_test "core-file $corefile2" \ + "Program terminated with signal SIGABRT, Aborted.*" \ + "Loaded second core file" +gdb_test "bt" "foo \\(\\) at .*" \ + "check backtrace in inferior 2" + +# Switch to inferior 3, this one was cloned from inferior 1, so is +# already debugging the first binary file. Check its backtrace for +# 'bar', which indicates we are debugging the correct core file. +gdb_test "inferior 3" "Switching to inferior 3 .*" +gdb_test "core-file $corefile1" \ + "Program terminated with signal SIGABRT, Aborted.*" \ + "Loaded first core file into inferior 3" +gdb_test "bt" "bar \\(\\) at .*" \ + "check backtrace in inferior 3" + +# Detach from some of the core files and delete some of the inferiors. +gdb_test "detach" "No core file now\\." \ + "detach from inferior 3 core file" +gdb_test "inferior 2" "Switching to inferior 2 .*" \ + "switch back to inferior 2" +gdb_test_no_output "remove-inferiors 3 4" + +# Now detach in inferior 2, and delete the inferior. +gdb_test "detach" "No core file now\\." \ + "detach from inferior 2 core file" +gdb_test "inferior 1" "Switching to inferior 1 .*" \ + "switch back to inferior 1" +gdb_test_no_output "remove-inferiors 2" + +# Finally, check that inferior 1 backtrace is still working. +gdb_test "bt" "bar \\(\\) at .*" \ + "check backtrace in inferior 1 again" +gdb_test "detach" "No core file now\\." \ + "detach from inferior 1 core file" diff --git a/gdb/testsuite/gdb.multi/multi-re-run.exp b/gdb/testsuite/gdb.multi/multi-re-run.exp index 89d43a4..bf83043 100644 --- a/gdb/testsuite/gdb.multi/multi-re-run.exp +++ b/gdb/testsuite/gdb.multi/multi-re-run.exp @@ -96,7 +96,7 @@ proc test_re_run {re_run_inf} { foreach_with_prefix iter {1 2} { delete_breakpoints - if ![runto all_started] { + if {![runto all_started]} { return 0 } diff --git a/gdb/testsuite/gdb.multi/multi-remote-target.c b/gdb/testsuite/gdb.multi/multi-remote-target.c new file mode 100644 index 0000000..6702a88 --- /dev/null +++ b/gdb/testsuite/gdb.multi/multi-remote-target.c @@ -0,0 +1,71 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2025 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/>. */ + +#include <stdio.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/wait.h> +#include <stdlib.h> +#include <assert.h> + +/* This is a simple, empty function designed to be a stable target + for a GDB breakpoint. Both the parent and child processes will + call this function after the fork. */ + +void +breakpt (void) +{ + /* Nothing. */ +} + +int +main (void) +{ + pid_t child_pid; + + /* Create a new process. */ + child_pid = fork (); + + assert (child_pid >= 0); + + if (child_pid == 0) + { + /* This is the child process. Call the breakpoint function. */ + breakpt (); + + exit (0); + } + else + { + /* This is the parent process. */ + int child_status; + + /* Call the breakpoint function. */ + breakpt (); + + /* Wait for the child process to terminate. */ + waitpid (child_pid, &child_status, 0); + + assert (WIFEXITED (child_status)); + assert (WEXITSTATUS (child_status) == 0); + + exit (0); + } + + /* This line should not be reached. */ + return 1; +} diff --git a/gdb/testsuite/gdb.multi/multi-remote-target.exp b/gdb/testsuite/gdb.multi/multi-remote-target.exp new file mode 100644 index 0000000..bcd5395 --- /dev/null +++ b/gdb/testsuite/gdb.multi/multi-remote-target.exp @@ -0,0 +1,89 @@ +# Copyright 2025 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/>. + +# Check that an attempt to share a 'remote' (not 'extended-remote') +# will be prevented. But also make sure that the remote connection +# can be shared after the inferior does a 'fork'. + +load_lib gdbserver-support.exp + +require allow_gdbserver_tests + +standard_testfile + +save_vars { GDBFLAGS } { + # If GDB and GDBserver are both running locally, set the sysroot to avoid + # reading files via the remote protocol (the `is_remote target` check is + # already done above). + if { ![is_remote host] && ![is_remote target] } { + set GDBFLAGS "$GDBFLAGS -ex \"set sysroot\"" + } + if {[prepare_for_testing "prepare" $testfile $srcfile] == -1} { + return + } +} + +set target_binfile [gdb_remote_download target $binfile] + +# Make sure we're disconnected, in case we're testing with an +# extended-remote board, therefore already connected. +gdb_test "disconnect" ".*" + +# Start gdbserver and connect. +set res [gdbserver_start "" $target_binfile] +set gdbserver_addr [lindex $res 1] +if { [gdb_target_cmd "remote" $gdbserver_addr] != 0 } { + unsupported "start gdbserver" + return +} + +# The inferior will fork. The following commands force GDB to create +# a new inferior to follow the child process. This ensures that GDB +# is able to share the remote connection between inferiors after a +# fork. +gdb_test_no_output "set follow-fork-mode parent" +gdb_test_no_output "set detach-on-fork off" +gdb_breakpoint breakpt +gdb_continue_to_breakpoint "runto breakpt function" + +# If we are using an extended-remote board, then an extended-remote +# connection will have been setup when GDB initially started. We then +# disconnected, and setup a basic 'remote' connection above. However, +# the 'remote' connection will now be connection 2. +# +# For all other boards, the 'remote' connection will be number 1. +if { [target_info gdb_protocol] == "extended-remote"} { + set conn_num 2 +} else { + set conn_num 1 +} + +# But as this is only a 'remote' (not 'extended-remote') connection, +# then new inferiors cannot be started by the user. This means that +# when the user does 'add-inferior' there is no point sharing the +# remote connection with the new inferior, it can never run anything. +gdb_test "add-inferior" \ + [multi_line \ + "warning: can't share connection $conn_num \\(remote \[^\r\n\]+\\) between inferiors" \ + "Added inferior 3"] \ + "connection is dropped when adding a new inferior" + +# Ensure the new inferior shows no connection. +gdb_test "info inferiors" \ + [multi_line \ + "\\*\\s+1\\s+\[^\r\n\]+\\s+${conn_num} \\(remote \[^\r\n\]+\\)\\s+\[^\r\n\]+" \ + "\\s+2\\s+\[^\r\n\]+\\s+${conn_num} \\(remote \[^\r\n\]+\\)\\s+\[^\r\n\]+" \ + "\\s+3\\s+<null>\\s+"] \ + "third inferior has no connection" diff --git a/gdb/testsuite/gdb.opt/inline-cmds.exp b/gdb/testsuite/gdb.opt/inline-cmds.exp index e80d6f7..4163d8f 100644 --- a/gdb/testsuite/gdb.opt/inline-cmds.exp +++ b/gdb/testsuite/gdb.opt/inline-cmds.exp @@ -335,7 +335,7 @@ proc mi_cli_step {cli_output_re message} { # command run while the top interpreter is MI results in the expected # CLI output sent to MI's console. with_test_prefix "mi" { - if [mi_gdb_start] { + if {[mi_gdb_start]} { return } mi_gdb_load ${binfile} diff --git a/gdb/testsuite/gdb.opt/inline-entry.exp b/gdb/testsuite/gdb.opt/inline-entry.exp index 0c6b0fb..227131a 100644 --- a/gdb/testsuite/gdb.opt/inline-entry.exp +++ b/gdb/testsuite/gdb.opt/inline-entry.exp @@ -33,7 +33,7 @@ # case where DW_AT_entry_pc is not the first instruction of an inlined # function, as can be the case in gcc 8.x with the # -gstatement-frontiers work in place. -require {expr ![is_c_compiler_gcc] || [supports_statement_frontiers]} +require {expr {![is_c_compiler_gcc] || [supports_statement_frontiers]}} standard_testfile diff --git a/gdb/testsuite/gdb.perf/skip-command.exp b/gdb/testsuite/gdb.perf/skip-command.exp index e59cb07..3a02cd5 100644 --- a/gdb/testsuite/gdb.perf/skip-command.exp +++ b/gdb/testsuite/gdb.perf/skip-command.exp @@ -99,7 +99,7 @@ proc run_skip_bench { kind text } { for { set i 0 } { $i < 5 } { incr i } { with_test_prefix "iter $i" { - set nr_skips [expr $i * $SKIP_DIRECTIVE_COUNT] + set nr_skips [expr {$i * $SKIP_DIRECTIVE_COUNT}] install_skips $kind $text $nr_skips gdb_test_python_run \ "SkipCommand\(\"skip-$kind-$nr_skips\", ${SKIP_STEP_COUNT}\)" diff --git a/gdb/testsuite/gdb.python/lookup-type-block.exp b/gdb/testsuite/gdb.python/lookup-type-block.exp new file mode 100644 index 0000000..7d04eb6 --- /dev/null +++ b/gdb/testsuite/gdb.python/lookup-type-block.exp @@ -0,0 +1,68 @@ +# Copyright (C) 2025 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 the 'block' argument to gdb.lookup_type. + +load_lib gdb-python.exp + +require allow_python_tests + +standard_testfile lookup1.c lookup2.c + +if {[prepare_for_testing "failed to prepare" ${testfile} \ + [list $srcfile $srcfile2]]} { + return +} + +proc check_type {which type_name} { + if {$which == "one"} { + set fn_name function + } else { + set fn_name main + } + + gdb_test_no_output \ + "python block = gdb.decode_line(\"$fn_name\")\[1\]\[0\].symtab.static_block()" \ + "compute block" + gdb_test_no_output \ + "python ty = gdb.lookup_type(\"$type_name\", block).strip_typedefs()" \ + "find the type" + gdb_test "python print(ty.fields()\[0\].name)" \ + "$which" \ + "examine first field" +} + +proc check_all_types {} { + foreach_with_prefix which {one two} { + foreach_with_prefix type_name { + "struct the_struct" + "enum the_enum" + "union the_union" + "the_typedef" + } { + check_type $which $type_name + } + } +} + +check_all_types + +if {![runto_main]} { + return +} + +with_test_prefix "while running" { + check_all_types +} diff --git a/gdb/testsuite/gdb.python/lookup1.c b/gdb/testsuite/gdb.python/lookup1.c new file mode 100644 index 0000000..488ffcb --- /dev/null +++ b/gdb/testsuite/gdb.python/lookup1.c @@ -0,0 +1,44 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2025 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/>. */ + +struct the_struct { + int one; +}; + +struct the_struct struct1; + +enum the_enum { + one +}; + +enum the_enum enum1; + +union the_union { + int one; + void *ptr; +}; + +union the_union union1; + +typedef struct the_struct the_typedef; + +the_typedef typedef1; + +int function (void) +{ + return 0; +} diff --git a/gdb/testsuite/gdb.python/lookup2.c b/gdb/testsuite/gdb.python/lookup2.c new file mode 100644 index 0000000..63d1030 --- /dev/null +++ b/gdb/testsuite/gdb.python/lookup2.c @@ -0,0 +1,46 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2025 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/>. */ + +struct the_struct { + int two; +}; + +struct the_struct struct2; + +enum the_enum { + two +}; + +enum the_enum enum2; + +union the_union { + int two; + void *ptr; +}; + +union the_union union2; + +typedef struct the_struct the_typedef; + +the_typedef typedef2; + +extern int function (void); + +int main (void) +{ + return function (); +} diff --git a/gdb/testsuite/gdb.python/py-connection-removed.exp b/gdb/testsuite/gdb.python/py-connection-removed.exp index d60ebb0..5056eb1 100644 --- a/gdb/testsuite/gdb.python/py-connection-removed.exp +++ b/gdb/testsuite/gdb.python/py-connection-removed.exp @@ -58,8 +58,17 @@ if { [target_info exists gdb_protocol] } { set connection_type "native" } -# Add an inferior that shares a connection with inferior 1. -gdb_test "add-inferior" "Added inferior 2 on connection 1 \[^\r\n\]+" +# Add an inferior that shares a connection with inferior 1. If we are +# using a 'remote' connection then this cannot be shared with the new +# inferior, so we get a warning, and a new inferior with no connection. +if { $connection_type == "remote" } { + gdb_test "add-inferior" \ + [multi_line \ + "warning: can't share connection 1 \\(remote \[^\r\n\]+\\) between inferiors" \ + "Added inferior 2"] +} else { + gdb_test "add-inferior" "Added inferior 2 on connection 1 \[^\r\n\]+" +} # Add an inferior with no connection. gdb_test "add-inferior -no-connection" "Added inferior 3" diff --git a/gdb/testsuite/gdb.python/py-record-btrace.exp b/gdb/testsuite/gdb.python/py-record-btrace.exp index 6dd3ae1..207161d 100644 --- a/gdb/testsuite/gdb.python/py-record-btrace.exp +++ b/gdb/testsuite/gdb.python/py-record-btrace.exp @@ -66,8 +66,8 @@ with_test_prefix "prepare record" { set v [linux_kernel_version] if { $v != {} } { set have_xfail \ - [expr [version_compare [list 5 5 0] <= $v] \ - && [version_compare $v < [list 6 1 0]]] + [expr {[version_compare [list 5 5 0] <= $v] \ + && [version_compare $v < [list 6 1 0]]}] } set nonl_re \[^\r\n\] set xfail_re \ diff --git a/gdb/testsuite/gdb.python/py-section-script.exp b/gdb/testsuite/gdb.python/py-section-script.exp index 9d4e48c..369c887 100644 --- a/gdb/testsuite/gdb.python/py-section-script.exp +++ b/gdb/testsuite/gdb.python/py-section-script.exp @@ -126,7 +126,7 @@ gdb_test "test-cmd 1 2 3" "test-cmd output, arg = 1 2 3" with_test_prefix "sepdebug" { gdb_exit - set result [catch "exec eu-strip -g -f ${binfile}.debug ${binfile}" output] + set result [catch {exec eu-strip -g -f ${binfile}.debug ${binfile}} output] verbose "result is $result" verbose "output is $output" if {$result != 0 || $output != ""} { diff --git a/gdb/testsuite/gdb.rocm/displaced-stepping.exp b/gdb/testsuite/gdb.rocm/displaced-stepping.exp index 9e8abd4..d26e4c6 100644 --- a/gdb/testsuite/gdb.rocm/displaced-stepping.exp +++ b/gdb/testsuite/gdb.rocm/displaced-stepping.exp @@ -32,7 +32,7 @@ proc do_test {} { gdb_load $::binfile with_rocm_gpu_lock { - if ![runto_main] { + if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.rocm/precise-memory-exec.exp b/gdb/testsuite/gdb.rocm/precise-memory-exec.exp index 76be078..2472446 100644 --- a/gdb/testsuite/gdb.rocm/precise-memory-exec.exp +++ b/gdb/testsuite/gdb.rocm/precise-memory-exec.exp @@ -33,7 +33,7 @@ proc do_test { follow-exec-mode } { gdb_load $::binfile with_rocm_gpu_lock { - if ![runto_main] { + if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.rocm/precise-memory-fork.exp b/gdb/testsuite/gdb.rocm/precise-memory-fork.exp index 23c1ebe..7559aec 100644 --- a/gdb/testsuite/gdb.rocm/precise-memory-fork.exp +++ b/gdb/testsuite/gdb.rocm/precise-memory-fork.exp @@ -30,7 +30,7 @@ if {[prepare_for_testing "failed to prepare $testfile" $testfile $srcfile {debug } with_rocm_gpu_lock { - if ![runto_main] { + if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.rocm/precise-memory-warning-sigsegv.exp b/gdb/testsuite/gdb.rocm/precise-memory-warning-sigsegv.exp index da0a95a..70c26c6 100644 --- a/gdb/testsuite/gdb.rocm/precise-memory-warning-sigsegv.exp +++ b/gdb/testsuite/gdb.rocm/precise-memory-warning-sigsegv.exp @@ -33,7 +33,7 @@ proc do_test { } { gdb_load $::binfile with_rocm_gpu_lock { - if ![runto_main] { + if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.rocm/precise-memory.exp b/gdb/testsuite/gdb.rocm/precise-memory.exp index 8f00559..4ea41ba 100644 --- a/gdb/testsuite/gdb.rocm/precise-memory.exp +++ b/gdb/testsuite/gdb.rocm/precise-memory.exp @@ -32,7 +32,7 @@ proc do_test { } { gdb_load $::binfile with_rocm_gpu_lock { - if ![runto_main] { + if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.rocm/simple.exp b/gdb/testsuite/gdb.rocm/simple.exp index 8f6ff3e..6b2f08e 100644 --- a/gdb/testsuite/gdb.rocm/simple.exp +++ b/gdb/testsuite/gdb.rocm/simple.exp @@ -31,7 +31,7 @@ proc do_test {} { gdb_load $::binfile with_rocm_gpu_lock { - if ![runto_main] { + if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.server/exit-multiple-threads.exp b/gdb/testsuite/gdb.server/exit-multiple-threads.exp index be29f9e..48bb10f 100644 --- a/gdb/testsuite/gdb.server/exit-multiple-threads.exp +++ b/gdb/testsuite/gdb.server/exit-multiple-threads.exp @@ -138,8 +138,8 @@ foreach_with_prefix test { exit signal } { set func "run_${test}_test" set executable "$binfile-${test}" - if [build_executable "failed to prepare" $executable $srcfile \ - [list debug pthreads additional_flags=-D${def}]] { + if {[build_executable "failed to prepare" $executable $srcfile \ + [list debug pthreads additional_flags=-D${def}]]} { return -1 } diff --git a/gdb/testsuite/gdb.server/reconnect-ctrl-c.exp b/gdb/testsuite/gdb.server/reconnect-ctrl-c.exp index bcab2de..61aaaea 100644 --- a/gdb/testsuite/gdb.server/reconnect-ctrl-c.exp +++ b/gdb/testsuite/gdb.server/reconnect-ctrl-c.exp @@ -32,7 +32,7 @@ save_vars { GDBFLAGS } { set GDBFLAGS "$GDBFLAGS -ex \"set sysroot\"" } - if [prepare_for_testing "failed to prepare" $testfile $srcfile] { + if {[prepare_for_testing "failed to prepare" $testfile $srcfile]} { return -1 } } diff --git a/gdb/testsuite/gdb.server/server-kill.exp b/gdb/testsuite/gdb.server/server-kill.exp index a9fcabb..0c54918 100644 --- a/gdb/testsuite/gdb.server/server-kill.exp +++ b/gdb/testsuite/gdb.server/server-kill.exp @@ -82,7 +82,7 @@ proc kill_server {} { # Test issuing "tstatus" right after the connection is dropped. proc_with_prefix test_tstatus {} { - if ![prepare] { + if {![prepare]} { return } @@ -104,7 +104,7 @@ proc_with_prefix test_tstatus {} { # is dropped. proc_with_prefix test_unwind_nosyms {} { - if ![prepare] { + if {![prepare]} { return } @@ -121,7 +121,7 @@ proc_with_prefix test_unwind_nosyms {} { # dropped. proc_with_prefix test_unwind_syms {} { - if ![prepare] { + if {![prepare]} { return } @@ -133,7 +133,7 @@ proc_with_prefix test_unwind_syms {} { # Test performing a stepi right after the connection is dropped. proc_with_prefix test_stepi {} { - if ![prepare] { + if {![prepare]} { return } diff --git a/gdb/testsuite/gdb.trace/actions-changed.exp b/gdb/testsuite/gdb.trace/actions-changed.exp index 556dab5..ef5acba 100644 --- a/gdb/testsuite/gdb.trace/actions-changed.exp +++ b/gdb/testsuite/gdb.trace/actions-changed.exp @@ -161,11 +161,11 @@ proc test_actions_changed { } { clean_restart $testfile -if ![runto_main] { +if {![runto_main]} { return -1 } -if ![gdb_target_supports_trace] { +if {![gdb_target_supports_trace]} { unsupported "current target does not support trace" return -1 } diff --git a/gdb/testsuite/gdb.trace/actions.exp b/gdb/testsuite/gdb.trace/actions.exp index 9bb38e1..89db2a6 100644 --- a/gdb/testsuite/gdb.trace/actions.exp +++ b/gdb/testsuite/gdb.trace/actions.exp @@ -37,7 +37,7 @@ if {$baseline == -1} { return } -set testline1 [expr $baseline + 7] +set testline1 [expr {$baseline + 7}] # # test actions command @@ -165,8 +165,8 @@ gdb_test_multiple "info tracepoints" "5.5c: verify NO actions for first tracepoi # 5.6 actions for invalid tracepoint number -gdb_test "actions [expr $trcpt2 + $trcpt3]" \ - "No tracepoint number [expr $trcpt2 + $trcpt3]." \ +gdb_test "actions [expr {$trcpt2 + $trcpt3}]" \ + "No tracepoint number [expr {$trcpt2 + $trcpt3}]." \ "5.6: actions for invalid tracepoint number" # 5.7 invalid action (other than 'collect', 'while-stepping' or 'end') @@ -245,7 +245,7 @@ if {[gdb_test "" "Breakpoint .*" "run to main"] != 0} { return -1 } -if ![gdb_target_supports_trace] { +if {![gdb_target_supports_trace]} { unsupported "target does not support trace" return -1 } diff --git a/gdb/testsuite/gdb.trace/backtrace.exp b/gdb/testsuite/gdb.trace/backtrace.exp index 57073bd..7707edb 100644 --- a/gdb/testsuite/gdb.trace/backtrace.exp +++ b/gdb/testsuite/gdb.trace/backtrace.exp @@ -23,12 +23,12 @@ set expfile $testfile.exp require gdb_trace_common_supports_arch -if [prepare_for_testing "failed to prepare" $executable $srcfile \ - [list debug nowarnings nopie]] { +if {[prepare_for_testing "failed to prepare" $executable $srcfile \ + [list debug nowarnings nopie]]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } @@ -155,13 +155,13 @@ gdb_test_no_output "tstop" "" proc gdb_backtrace_tdp_1 { msg } { global gdb_prompt - + # We are in a trace frame at which we didn't collect anything # except $PC. Therefore we expect to be able to identify stack # frame #0, but that's about all. In particular we do not expect # to be able to display the function's arguments or locals, and we # do not expect to be able to identify the caller of this function. - + gdb_test "backtrace" \ "#0\[\t \]+gdb_recursion_test.*depth=.*" \ "$msg" diff --git a/gdb/testsuite/gdb.trace/change-loc.exp b/gdb/testsuite/gdb.trace/change-loc.exp index 67ac476..12b862c 100644 --- a/gdb/testsuite/gdb.trace/change-loc.exp +++ b/gdb/testsuite/gdb.trace/change-loc.exp @@ -44,7 +44,7 @@ clean_restart $executable gdb_load_shlib $lib_sl1 gdb_load_shlib $lib_sl2 -if ![runto_main] { +if {![runto_main]} { return -1 } @@ -64,7 +64,7 @@ proc tracepoint_change_loc_1 { trace_type } { global gdb_prompt clean_restart ${testfile} - if ![runto_main] { + if {![runto_main]} { return -1 } gdb_test_no_output "delete break 1" @@ -88,7 +88,7 @@ proc tracepoint_change_loc_1 { trace_type } { set test "set tracepoint on set_tracepoint" gdb_test_multiple "${trace_type} set_tracepoint" $test { -re "Target returns error code .* too far .*$gdb_prompt $" { - if [string equal $trace_type "ftrace"] { + if {[string equal $trace_type "ftrace"]} { # The target was unable to install the fast tracepoint # (e.g., jump pad too far from tracepoint). pass "$test (too far)" @@ -113,7 +113,7 @@ proc tracepoint_change_loc_1 { trace_type } { set test "continue to marker 2" gdb_test_multiple "continue" $test { -re "Target returns error code .* too far .*$gdb_prompt $" { - if [string equal $trace_type "ftrace"] { + if {[string equal $trace_type "ftrace"]} { # Expected if the target was unable to install the # fast tracepoint (e.g., jump pad too far from # tracepoint). @@ -230,7 +230,7 @@ proc tracepoint_change_loc_2 { trace_type } { pass "tstart" } -re "Target returns error code .* too far .*$gdb_prompt $" { - if [string equal $trace_type "ftrace"] { + if {[string equal $trace_type "ftrace"]} { # The target was unable to install the fast tracepoint # (e.g., jump pad too far from tracepoint). pass "$test (too far)" @@ -291,12 +291,12 @@ proc tracepoint_install_in_trace_disabled { trace_type } { global gdb_prompt # This test only makes sense with remote targets. - if ![gdb_protocol_is_remote] { + if {![gdb_protocol_is_remote]} { return } clean_restart ${testfile} - if ![runto_main] { + if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.trace/circ.exp b/gdb/testsuite/gdb.trace/circ.exp index 3354c0f..73802a9 100644 --- a/gdb/testsuite/gdb.trace/circ.exp +++ b/gdb/testsuite/gdb.trace/circ.exp @@ -37,7 +37,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug nowarning # # Set a tracepoint on given func. The tracepoint is set at entry -# address and not 'after prologue' address because we use +# address and not 'after prologue' address because we use # 'tfind pc func' to find the corresponding trace frame afterwards, # and that looks for entry address. proc set_a_tracepoint { func } { diff --git a/gdb/testsuite/gdb.trace/collection.exp b/gdb/testsuite/gdb.trace/collection.exp index f0946ee..a60b720 100644 --- a/gdb/testsuite/gdb.trace/collection.exp +++ b/gdb/testsuite/gdb.trace/collection.exp @@ -23,7 +23,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug nowarning return -1 } -# Tests: +# Tests: # 1) $args # 2) function args by name # 3) $locs @@ -701,7 +701,7 @@ proc gdb_trace_collection_test {} { gdb_collect_registers_test "\$$fpreg, \$$spreg, \$$pcreg" gdb_collect_globals_test gdb_collect_global_in_pieces_test - + # # Expression tests: # @@ -747,7 +747,7 @@ proc gdb_trace_collection_test {} { # x[(y, z)] (tests comma expression) (ditto) # cast expr # stack data - + gdb_collect_expression_test globals_test_func \ "globalstruct.memberi" "82" "a.b" gdb_collect_expression_test globals_test_func \ diff --git a/gdb/testsuite/gdb.trace/deltrace.exp b/gdb/testsuite/gdb.trace/deltrace.exp index d05fe64..61f5ef6 100644 --- a/gdb/testsuite/gdb.trace/deltrace.exp +++ b/gdb/testsuite/gdb.trace/deltrace.exp @@ -37,7 +37,7 @@ if {$baseline == -1} { fail "could not find gdb_recursion_test function" return } -set testline1 [expr $baseline + 4] +set testline1 [expr {$baseline + 4}] # # test "delete tracepoints" command @@ -185,11 +185,11 @@ gdb_test_multiple "delete tracepoint $trcpt1 $trcpt2 $trcpt3" \ gdb_test "info tracepoints" \ "No tracepoints." \ - "3.3c: verify delete three tracepoints" + "3.3c: verify delete three tracepoints" # 3.4 delete invalid tracepoint number -gdb_test "delete tracepoint [expr $trcpt2 + $trcpt3]" \ - "No breakpoint number [expr $trcpt2 + $trcpt3]." \ +gdb_test "delete tracepoint [expr {$trcpt2 + $trcpt3}]" \ + "No breakpoint number [expr {$trcpt2 + $trcpt3}]." \ "3.4: delete invalid tracepoint number" # 3.5 delete tracepoint number zero diff --git a/gdb/testsuite/gdb.trace/disconnected-tracing.exp b/gdb/testsuite/gdb.trace/disconnected-tracing.exp index 5a4e882..9a09a66 100644 --- a/gdb/testsuite/gdb.trace/disconnected-tracing.exp +++ b/gdb/testsuite/gdb.trace/disconnected-tracing.exp @@ -27,16 +27,16 @@ if { [info proc gdb_reconnect] == "" } { return -1 } -if [prepare_for_testing "failed to prepare" $executable $srcfile \ - {debug nowarnings}] { +if {[prepare_for_testing "failed to prepare" $executable $srcfile \ + {debug nowarnings}]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } -if ![gdb_target_supports_trace] { +if {![gdb_target_supports_trace]} { unsupported "target does not support trace" return -1 } @@ -51,7 +51,7 @@ proc disconnected_tracing { } { # Start with a fresh gdb. clean_restart ${executable} - if ![runto_main] { + if {![runto_main]} { return -1 } @@ -113,7 +113,7 @@ proc disconnected_tfind { } { # Start with a fresh gdb. clean_restart ${executable} - if ![runto_main] { + if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.trace/entry-values.exp b/gdb/testsuite/gdb.trace/entry-values.exp index 1d2e8e9..f6c4c5c 100644 --- a/gdb/testsuite/gdb.trace/entry-values.exp +++ b/gdb/testsuite/gdb.trace/entry-values.exp @@ -165,7 +165,7 @@ if {[gdb_compile [list ${binfile}1.o ${binfile}2.o] \ clean_restart ${testfile} -if ![runto_main] { +if {![runto_main]} { return -1 } @@ -199,11 +199,11 @@ clean_restart $testfile load_lib "trace-support.exp" -if ![runto_main] { +if {![runto_main]} { return -1 } -if ![gdb_target_supports_trace] { +if {![gdb_target_supports_trace]} { unsupported "target does not support trace" return -1 } diff --git a/gdb/testsuite/gdb.trace/ftrace-lock.exp b/gdb/testsuite/gdb.trace/ftrace-lock.exp index 8c9d4aa..42e8711 100644 --- a/gdb/testsuite/gdb.trace/ftrace-lock.exp +++ b/gdb/testsuite/gdb.trace/ftrace-lock.exp @@ -22,7 +22,7 @@ require gdb_trace_common_supports_arch standard_testfile # make check RUNTESTFLAGS='gdb.trace/ftrace-lock.exp NUM_THREADS=2' -if ![info exists NUM_THREADS] { +if {![info exists NUM_THREADS]} { set NUM_THREADS 2 } @@ -37,11 +37,11 @@ with_test_prefix "runtime trace support check" { return } - if ![runto_main] { + if {![runto_main]} { return -1 } - if ![gdb_target_supports_trace] { + if {![gdb_target_supports_trace]} { unsupported "target does not support trace" return -1 } @@ -59,7 +59,7 @@ if { [prepare_for_testing "prepare for testing with libipa" \ return } -if ![runto_main] { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.trace/ftrace.exp b/gdb/testsuite/gdb.trace/ftrace.exp index ac6e473..3192bdd 100644 --- a/gdb/testsuite/gdb.trace/ftrace.exp +++ b/gdb/testsuite/gdb.trace/ftrace.exp @@ -25,16 +25,16 @@ set additional_flags [gdb_target_symbol_prefix_flags] require gdb_trace_common_supports_arch -if [prepare_for_testing "failed to prepare" $executable $srcfile \ - [list debug $additional_flags]] { +if {[prepare_for_testing "failed to prepare" $executable $srcfile \ + [list debug $additional_flags]]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } -if ![gdb_target_supports_trace] { +if {![gdb_target_supports_trace]} { unsupported "target does not support trace" return -1 } @@ -54,7 +54,7 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \ } clean_restart ${executable} -if ![runto_main] { +if {![runto_main]} { return 0 } @@ -130,7 +130,7 @@ proc test_fast_tracepoints {} { set minaddr [exec sh -c "cat /proc/sys/vm/mmap_min_addr"] - if { [expr $minaddr > 64512] } { + if {$minaddr > 64512} { warning "mmap_min_addr > 64512, fast tracepoint will fail" warning "do \"sudo sysctl -w vm.mmap_min_addr=32768\" to adjust" } @@ -190,7 +190,7 @@ proc test_fast_tracepoints {} { # fast tracepoints RSP feature, and confirm fast tracepoints # can no longer be downloaded. set test "fast tracepoint could not be downloaded with the feature disabled" - if [gdb_protocol_is_remote] { + if {[gdb_protocol_is_remote]} { gdb_test "set remote fast-tracepoints-packet off" gdb_test_multiple "tstart" $test { diff --git a/gdb/testsuite/gdb.trace/infotrace.exp b/gdb/testsuite/gdb.trace/infotrace.exp index 7ba4ed3..47121ca 100644 --- a/gdb/testsuite/gdb.trace/infotrace.exp +++ b/gdb/testsuite/gdb.trace/infotrace.exp @@ -66,8 +66,8 @@ gdb_test "info tracepoint $asm_test_num" \ "2.2b: info tracepoint $asm_test_num (gdb_asm_test)" # 2.3 info tracepoint (invalid tracepoint number) -gdb_test "info tracepoint [expr $c_test_num + $asm_test_num]" \ - "No tracepoint matching '[expr $c_test_num + $asm_test_num]'." \ +gdb_test "info tracepoint [expr {$c_test_num + $asm_test_num}]" \ + "No tracepoint matching '[expr {$c_test_num + $asm_test_num}]'." \ "2.3: info tracepoint (invalid tracepoint number)" # 2.4 info tracepoints (list of numbers) diff --git a/gdb/testsuite/gdb.trace/mi-trace-frame-collected.exp b/gdb/testsuite/gdb.trace/mi-trace-frame-collected.exp index 9b4f053..1aaf27c 100644 --- a/gdb/testsuite/gdb.trace/mi-trace-frame-collected.exp +++ b/gdb/testsuite/gdb.trace/mi-trace-frame-collected.exp @@ -23,11 +23,11 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug}] } return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } -if ![gdb_target_supports_trace] { +if {![gdb_target_supports_trace]} { unsupported "current target does not support trace" return -1 } diff --git a/gdb/testsuite/gdb.trace/mi-trace-unavailable.exp b/gdb/testsuite/gdb.trace/mi-trace-unavailable.exp index dd22046..34013fb 100644 --- a/gdb/testsuite/gdb.trace/mi-trace-unavailable.exp +++ b/gdb/testsuite/gdb.trace/mi-trace-unavailable.exp @@ -21,11 +21,11 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug nopi return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } -if ![gdb_target_supports_trace] { +if {![gdb_target_supports_trace]} { unsupported "current target does not support trace" return -1 } @@ -129,16 +129,16 @@ proc test_trace_unavailable { data_source } { set pcnum -1 set gpr0num -1 - if [is_amd64_regs_target] { + if {[is_amd64_regs_target]} { set pcnum 16 set gpr0num 0 - } elseif [is_x86_like_target] { + } elseif {[is_x86_like_target]} { set pcnum 8 set gpr0num 0 - } elseif [is_aarch64_target] { + } elseif {[is_aarch64_target]} { set pcnum 32 set gpr0num 0 - } elseif [istarget "powerpc*-*-*"] { + } elseif {[istarget "powerpc*-*-*"]} { set pcnum 64 set gpr0num 0 } elseif { [istarget "s390*-*-*"] } { diff --git a/gdb/testsuite/gdb.trace/mi-traceframe-changed.exp b/gdb/testsuite/gdb.trace/mi-traceframe-changed.exp index 90a053c..029869b 100644 --- a/gdb/testsuite/gdb.trace/mi-traceframe-changed.exp +++ b/gdb/testsuite/gdb.trace/mi-traceframe-changed.exp @@ -78,7 +78,7 @@ proc test_tfind_tfile { } { # If tracefile is generated successfully, copy tracefile to host and # run tests. -if [generate_tracefile $binfile] { +if {[generate_tracefile $binfile]} { if {!$purely_local} { # Copy tracefile from target to host. remote_download host [remote_upload target tfile-basic.tf] \ @@ -105,11 +105,11 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ clean_restart $executable -if ![runto_main] { +if {![runto_main]} { return -1 } -if ![gdb_target_supports_trace] { +if {![gdb_target_supports_trace]} { unsupported "current target does not support trace" return -1 } diff --git a/gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp b/gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp index 99f7bf9..da62563 100644 --- a/gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp +++ b/gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp @@ -228,11 +228,11 @@ clean_restart $executable gdb_load_shlib $lib_sl1 gdb_load_shlib $lib_sl2 -if ![runto_main] { +if {![runto_main]} { return -1 } -if ![gdb_target_supports_trace] { +if {![gdb_target_supports_trace]} { unsupported "current target does not support trace" return -1 } diff --git a/gdb/testsuite/gdb.trace/mi-tsv-changed.exp b/gdb/testsuite/gdb.trace/mi-tsv-changed.exp index 6f71e79..c69ae89 100644 --- a/gdb/testsuite/gdb.trace/mi-tsv-changed.exp +++ b/gdb/testsuite/gdb.trace/mi-tsv-changed.exp @@ -36,7 +36,7 @@ proc test_create_delete_modify_tsv { } { global srcdir subdir global mi_gdb_prompt - if [mi_gdb_start] { + if {[mi_gdb_start]} { return } mi_gdb_load ${binfile} @@ -67,11 +67,11 @@ proc test_create_delete_modify_tsv { } { # Test target supports tracepoints or not. clean_restart $testfile - if ![runto_main] { + if {![runto_main]} { return -1 } - if ![gdb_target_supports_trace] { + if {![gdb_target_supports_trace]} { unsupported "current target does not support trace" return -1 } @@ -201,12 +201,12 @@ proc test_upload_tsv { } { } } - if $tsv1_created { + if {$tsv1_created} { pass "tsv1 created" } else { fail "tsv1 created" } - if $tsv2_created { + if {$tsv2_created} { pass "tsv2 created" } else { fail "tsv2 created" @@ -222,11 +222,11 @@ proc test_upload_tsv { } { clean_restart $testfile -if ![runto_main] { +if {![runto_main]} { return -1 } -if ![gdb_target_supports_trace] { +if {![gdb_target_supports_trace]} { unsupported "current target does not support trace" return -1 } diff --git a/gdb/testsuite/gdb.trace/no-attach-trace.exp b/gdb/testsuite/gdb.trace/no-attach-trace.exp index e1decfc..5f7795d 100644 --- a/gdb/testsuite/gdb.trace/no-attach-trace.exp +++ b/gdb/testsuite/gdb.trace/no-attach-trace.exp @@ -42,7 +42,7 @@ gdb_test "trace main" \ gdb_test "tstart" "Target returns error code.*\." with_test_prefix "after tstart" { - if ![runto_main] { + if {![runto_main]} { return -1 } } diff --git a/gdb/testsuite/gdb.trace/passc-dyn.exp b/gdb/testsuite/gdb.trace/passc-dyn.exp index b4ec45a..2c7698a 100644 --- a/gdb/testsuite/gdb.trace/passc-dyn.exp +++ b/gdb/testsuite/gdb.trace/passc-dyn.exp @@ -52,16 +52,16 @@ if {$baseline == -1} { # define relative source line numbers: # all subsequent line numbers are relative to this first one (baseline) -set testline2 [expr $baseline + 4] -set testline3 [expr $baseline + 5] -set testline4 [expr $baseline + 6] +set testline2 [expr {$baseline + 4}] +set testline3 [expr {$baseline + 5}] +set testline4 [expr {$baseline + 6}] # # test passcount command semantics (live test) # ## Set three tracepoints with three different passcounts. -## Verify that the experiment stops after the one with the +## Verify that the experiment stops after the one with the ## lowest passcount is hit. gdb_delete_tracepoints @@ -125,7 +125,7 @@ with_test_prefix "trace_frame 4" { } ## We should now be at the last frame, because this frame's passcount -## should have caused collection to stop. If we do a tfind now, +## should have caused collection to stop. If we do a tfind now, ## it should fail. gdb_test "tfind" "failed to find.*" "4.5: dynamic passcount test" diff --git a/gdb/testsuite/gdb.trace/passcount.exp b/gdb/testsuite/gdb.trace/passcount.exp index f1b4e9e..37d5c09 100644 --- a/gdb/testsuite/gdb.trace/passcount.exp +++ b/gdb/testsuite/gdb.trace/passcount.exp @@ -36,7 +36,7 @@ if {$baseline == -1} { return } -set testline1 [expr $baseline + 3] +set testline1 [expr {$baseline + 3}] # # test "passcount" command @@ -212,8 +212,8 @@ gdb_test "info tracepoints" \ # 4.8 set passcount for invalid tracepoint -gdb_test "passcount 1 [expr $trcpt2 + $trcpt3]" \ - "No tracepoint number [expr $trcpt2 + $trcpt3]." \ +gdb_test "passcount 1 [expr {$trcpt2 + $trcpt3}]" \ + "No tracepoint number [expr {$trcpt2 + $trcpt3}]." \ "4.8: invalid tracepoint number in passcount" # 4.9 help passcount diff --git a/gdb/testsuite/gdb.trace/pending.exp b/gdb/testsuite/gdb.trace/pending.exp index 39e3abb..fdf321b 100644 --- a/gdb/testsuite/gdb.trace/pending.exp +++ b/gdb/testsuite/gdb.trace/pending.exp @@ -46,11 +46,11 @@ clean_restart $executable gdb_load_shlib $lib_sl1 gdb_load_shlib $lib_sl2 -if ![runto_main] { +if {![runto_main]} { return -1 } -if ![gdb_target_supports_trace] { +if {![gdb_target_supports_trace]} { unsupported "current target does not support trace" return -1 } @@ -138,7 +138,7 @@ proc pending_tracepoint_works { trace_type } { pass $test } -re "Target returns error code .* too far .*$gdb_prompt $" { - if [string equal $trace_type "ftrace"] { + if {[string equal $trace_type "ftrace"]} { # The target was unable to install the fast tracepoint # (e.g., jump pad too far from tracepoint). pass "$test (too far)" @@ -179,7 +179,7 @@ proc pending_tracepoint_resolved_during_trace { trace_type } \ # Start with a fresh gdb. clean_restart $executable - if ![runto_main] { + if {![runto_main]} { return -1 } @@ -206,7 +206,7 @@ proc pending_tracepoint_resolved_during_trace { trace_type } \ set test "continue to marker 2" gdb_test_multiple "continue" $test { -re "Target returns error code .* too far .*$gdb_prompt $" { - if [string equal $trace_type "ftrace"] { + if {[string equal $trace_type "ftrace"]} { # Expected if the target was unable to install the # fast tracepoint (e.g., jump pad too far from # tracepoint). @@ -247,7 +247,7 @@ proc pending_tracepoint_installed_during_trace { trace_type } \ # Start with a fresh gdb. clean_restart $executable - if ![runto_main] { + if {![runto_main]} { return -1 } @@ -278,7 +278,7 @@ proc pending_tracepoint_installed_during_trace { trace_type } \ set test "continue to marker 2" gdb_test_multiple "continue" $test { -re "Target returns error code .* too far .*$gdb_prompt $" { - if [string equal $trace_type "ftrace"] { + if {[string equal $trace_type "ftrace"]} { # Expected if the target was unable to install the # fast tracepoint (e.g., jump pad too far from # tracepoint). @@ -320,7 +320,7 @@ proc pending_tracepoint_disconnect_during_trace { trace_type } \ # Start with a fresh gdb. clean_restart $executable - if ![runto_main] { + if {![runto_main]} { return -1 } @@ -367,7 +367,7 @@ proc pending_tracepoint_disconnect_after_resolved { trace_type } \ # Start with a fresh gdb. clean_restart $executable - if ![runto_main] { + if {![runto_main]} { return -1 } @@ -419,7 +419,7 @@ proc pending_tracepoint_with_action_resolved { trace_type } \ # Start with a fresh gdb. clean_restart $executable - if ![runto_main] { + if {![runto_main]} { return -1 } @@ -449,7 +449,7 @@ proc pending_tracepoint_with_action_resolved { trace_type } \ set test "continue to marker 2" gdb_test_multiple "continue" $test { -re "Target returns error code .* too far .*$gdb_prompt $" { - if [string equal $trace_type "ftrace"] { + if {[string equal $trace_type "ftrace"]} { # Expected if the target was unable to install the # fast tracepoint (e.g., jump pad too far from # tracepoint). diff --git a/gdb/testsuite/gdb.trace/pr16508.exp b/gdb/testsuite/gdb.trace/pr16508.exp index 2284ab2..37405ff 100644 --- a/gdb/testsuite/gdb.trace/pr16508.exp +++ b/gdb/testsuite/gdb.trace/pr16508.exp @@ -17,16 +17,16 @@ load_lib "trace-support.exp" standard_testfile read-memory.c set executable $testfile -if [prepare_for_testing "failed to prepare for trace tests" \ - $executable $srcfile [list debug]] { +if {[prepare_for_testing "failed to prepare for trace tests" \ + $executable $srcfile [list debug]]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } -if ![gdb_target_supports_trace] { +if {![gdb_target_supports_trace]} { unsupported "target does not support trace" return -1 } diff --git a/gdb/testsuite/gdb.trace/qtro.exp b/gdb/testsuite/gdb.trace/qtro.exp index 78170ac..cf3ade6 100644 --- a/gdb/testsuite/gdb.trace/qtro.exp +++ b/gdb/testsuite/gdb.trace/qtro.exp @@ -30,13 +30,13 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug nopie}]} return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } # Check whether the target supports tracepoints. -if ![gdb_target_supports_trace] { +if {![gdb_target_supports_trace]} { unsupported "current target does not support trace" return -1 } diff --git a/gdb/testsuite/gdb.trace/range-stepping.exp b/gdb/testsuite/gdb.trace/range-stepping.exp index 396ed02..915f0a2 100644 --- a/gdb/testsuite/gdb.trace/range-stepping.exp +++ b/gdb/testsuite/gdb.trace/range-stepping.exp @@ -19,21 +19,21 @@ load_lib "range-stepping-support.exp" standard_testfile set executable $testfile -if [prepare_for_testing "failed to prepare" $executable $srcfile \ - {debug nowarnings}] { +if {[prepare_for_testing "failed to prepare" $executable $srcfile \ + {debug nowarnings}]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } -if ![gdb_target_supports_trace] { +if {![gdb_target_supports_trace]} { unsupported "target does not support trace" return -1 } -if ![gdb_range_stepping_enabled] { +if {![gdb_range_stepping_enabled]} { unsupported "range stepping not supported by the target" return -1 } @@ -79,7 +79,7 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \ clean_restart ${executable} -if ![runto_main] { +if {![runto_main]} { return 0 } diff --git a/gdb/testsuite/gdb.trace/read-memory.exp b/gdb/testsuite/gdb.trace/read-memory.exp index 558c0ea..b369b40 100644 --- a/gdb/testsuite/gdb.trace/read-memory.exp +++ b/gdb/testsuite/gdb.trace/read-memory.exp @@ -21,11 +21,11 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug nopie}]} return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } -if ![gdb_target_supports_trace] { +if {![gdb_target_supports_trace]} { unsupported "target does not support trace" return -1 } @@ -37,7 +37,7 @@ proc set_tracepoint_and_collect { } { # Start with a fresh gdb. clean_restart ${testfile} - if ![runto_main] { + if {![runto_main]} { return -1 } gdb_breakpoint "end" qualified diff --git a/gdb/testsuite/gdb.trace/report.exp b/gdb/testsuite/gdb.trace/report.exp index f2a04f7..0b964d6 100644 --- a/gdb/testsuite/gdb.trace/report.exp +++ b/gdb/testsuite/gdb.trace/report.exp @@ -100,7 +100,7 @@ all tests in this module will fail." untested "couldn't match pattern" set return_me 1 all tests in this module will fail." - } + } } if {$return_me == 1} { @@ -288,27 +288,27 @@ proc use_collected_data { data_source } { exp_continue } -re "^\[^\r\n\]* line $testline1 .tracepoint .$tdp1\\)\r\n" { - set linecount1 [expr $linecount1 + 1] + set linecount1 [expr {$linecount1 + 1}] exp_continue } -re "^\[^\r\n\]* line $testline2 .tracepoint .$tdp2\\)\r\n" { - set linecount2 [expr $linecount2 + 1] + set linecount2 [expr {$linecount2 + 1}] exp_continue } -re "^\[^\r\n\]* line $testline3 .tracepoint .$tdp3\\)\r\n" { - set linecount3 [expr $linecount3 + 1] + set linecount3 [expr {$linecount3 + 1}] exp_continue } -re "^\[^\r\n\]* line $testline4 .tracepoint .$tdp4\\)\r\n" { - set linecount4 [expr $linecount4 + 1] + set linecount4 [expr {$linecount4 + 1}] exp_continue } -re "^\[^\r\n\]* line $testline5 .tracepoint .$tdp5\\)\r\n" { - set linecount5 [expr $linecount5 + 1] + set linecount5 [expr {$linecount5 + 1}] exp_continue } -re "^\[^\r\n\]* line $testline6 .tracepoint .$tdp6\\)\r\n" { - set linecount6 [expr $linecount6 + 1] + set linecount6 [expr {$linecount6 + 1}] exp_continue } -re "^No trace frame found\r\n$gdb_prompt $" { @@ -328,7 +328,7 @@ proc use_collected_data { data_source } { gdb_test_multiple "while \$trace_frame != -1\n printf \"tracepoint #\%d, FP 0x\%08x, SP 0x\%08x, PC 0x%08x\\n\", \$tracepoint, \$fp, \$sp, \$pc\n tfind tracepoint\n end" "12.2: trace report #2" { -re "tracepoint #$tdp2, FP $hex, SP $hex, PC $hex" { - set linecount2 [expr $linecount2 + 1] + set linecount2 [expr {$linecount2 + 1}] exp_continue } -re ".*$gdb_prompt $" { @@ -348,7 +348,7 @@ proc use_collected_data { data_source } { gdb_test_multiple "while \$trace_frame != -1\n printf \"TDP #\%d, frame \%d: depth = \%d, q1 = \%d\\n\", \$tracepoint, \$trace_frame, depth, q1\n tfind tracepoint\n end" "12.3: trace report #3" { -re "TDP #$tdp3, frame $decimal: depth = $decimal, q1 = $decimal" { - set linecount3 [expr $linecount3 + 1] + set linecount3 [expr {$linecount3 + 1}] exp_continue } -re ".*$gdb_prompt $" { @@ -368,7 +368,7 @@ proc use_collected_data { data_source } { gdb_test_multiple "while \$trace_frame != -1\n printf \"TDP #\%d, frame %d: char_test = \%d, long_test = \%d\\n\", \$tracepoint, \$trace_frame, gdb_char_test, gdb_long_test\n tfind tracepoint\n end" "12.4: trace report #4" { -re "TDP #$tdp6, frame $decimal: char_test = $arg1, long_test = $arg3" { - set linecount6 [expr $linecount6 + 1] + set linecount6 [expr {$linecount6 + 1}] exp_continue } -re ".*$gdb_prompt $" { diff --git a/gdb/testsuite/gdb.trace/save-trace.exp b/gdb/testsuite/gdb.trace/save-trace.exp index b018dc6..31d9768 100644 --- a/gdb/testsuite/gdb.trace/save-trace.exp +++ b/gdb/testsuite/gdb.trace/save-trace.exp @@ -37,12 +37,12 @@ if {$baseline == -1} { return } -set testline1 [expr $baseline + 4] -set testline2 [expr $baseline + 5] -set testline3 [expr $baseline + 6] -set testline4 [expr $baseline + 7] -set testline5 [expr $baseline + 8] -set testline6 [expr $baseline + 9] +set testline1 [expr {$baseline + 4}] +set testline2 [expr {$baseline + 5}] +set testline3 [expr {$baseline + 6}] +set testline4 [expr {$baseline + 7}] +set testline5 [expr {$baseline + 8}] +set testline6 [expr {$baseline + 9}] # # test save-trace command @@ -53,7 +53,7 @@ set testline6 [expr $baseline + 9] gdb_delete_tracepoints foreach x { 1 2 3 4 5 6 } { - set testline [expr \$testline$x] + set testline [subst \$testline$x] set trcpt [gdb_gettpnum $testline] set trcpt$x $trcpt gdb_test "passcount $x" \ diff --git a/gdb/testsuite/gdb.trace/signal.exp b/gdb/testsuite/gdb.trace/signal.exp index 9c63770..31cd9cd 100644 --- a/gdb/testsuite/gdb.trace/signal.exp +++ b/gdb/testsuite/gdb.trace/signal.exp @@ -36,11 +36,11 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } -if ![gdb_target_supports_trace] { +if {![gdb_target_supports_trace]} { unsupported "target does not support trace" return -1 } @@ -62,7 +62,7 @@ if { [istarget "i\[34567\]86-*-linux*"] || [istarget "x86_64-*-linux*"] } { # Start with a fresh gdb. clean_restart ${testfile} -if ![runto_main] { +if {![runto_main]} { return -1 } @@ -153,7 +153,7 @@ with_test_prefix "iterations equals to counter" { # Record the hit times of each tracepoint in this array. array set tracepoint_hits { } -for { set i $tpnum } { $i < [expr $tpnum + 2] } { incr i } { +for { set i $tpnum } { $i < $tpnum + 2 } { incr i } { set tracepoint_hits($i) 0 } @@ -162,7 +162,7 @@ while { 1 } { set idx 0 gdb_test_multiple $test $test { -re "Found trace frame $decimal, tracepoint ($decimal).*\r\n$gdb_prompt $" { - set idx [expr $expect_out(1,string)] + set idx [expr {$expect_out(1,string)}] incr tracepoint_hits($idx) } -re "Target failed to find requested trace frame\..*\r\n$gdb_prompt $" { @@ -176,7 +176,7 @@ while { 1 } { # Step 3, check the number of collections on each tracepoint. -for { set i $tpnum } { $i < [expr $tpnum + 2] } { incr i } { +for { set i $tpnum } { $i < $tpnum + 2 } { incr i } { if { $tracepoint_hits($i) == $iterations } { pass "tracepoint $i hit $iterations times" diff --git a/gdb/testsuite/gdb.trace/status-stop.exp b/gdb/testsuite/gdb.trace/status-stop.exp index 1762d30..a390dd9 100644 --- a/gdb/testsuite/gdb.trace/status-stop.exp +++ b/gdb/testsuite/gdb.trace/status-stop.exp @@ -19,16 +19,16 @@ set executable $testfile set expfile $testfile.exp -if [prepare_for_testing "failed to prepare" $executable $srcfile \ - {debug nowarnings}] { +if {[prepare_for_testing "failed to prepare" $executable $srcfile \ + {debug nowarnings}]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } -if ![gdb_target_supports_trace] { +if {![gdb_target_supports_trace]} { unsupported "target does not support trace" return -1 } @@ -42,7 +42,7 @@ proc test_tstart_tstop_tstart { } { # Start with a fresh gdb. clean_restart ${executable} - if ![runto_main] { + if {![runto_main]} { return -1 } @@ -70,7 +70,7 @@ proc test_tstart_tstart { } { # Start with a fresh gdb. clean_restart ${executable} - if ![runto_main] { + if {![runto_main]} { return -1 } @@ -96,7 +96,7 @@ proc test_buffer_full_tstart { } { # Start with a fresh gdb. clean_restart ${executable} - if ![runto_main] { + if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.trace/strace.exp b/gdb/testsuite/gdb.trace/strace.exp index 90923c1..96ef4de 100644 --- a/gdb/testsuite/gdb.trace/strace.exp +++ b/gdb/testsuite/gdb.trace/strace.exp @@ -45,7 +45,7 @@ proc strace_remove_socket { action } { # Restart with a fresh gdb. clean_restart $executable gdb_load_shlib $libipa - if ![runto_main] { + if {![runto_main]} { return -1 } @@ -130,7 +130,7 @@ proc strace_info_marker { } { # Restart with a fresh gdb. clean_restart $executable gdb_load_shlib $libipa - if ![runto_main] { + if {![runto_main]} { return -1 } @@ -166,7 +166,7 @@ proc strace_probe_marker { } { # Restart with a fresh gdb. clean_restart $executable gdb_load_shlib $libipa - if ![runto_main] { + if {![runto_main]} { return -1 } @@ -205,7 +205,7 @@ proc strace_trace_on_same_addr { type } { # Restart with a fresh gdb. clean_restart $executable gdb_load_shlib $libipa - if ![runto_main] { + if {![runto_main]} { return -1 } @@ -241,7 +241,7 @@ proc strace_trace_on_same_addr { type } { pass $test } -re ".*\r\n$gdb_prompt $" { - if [string equal $type "ftrace"] { + if {[string equal $type "ftrace"]} { # The instruction may be not long enough to set a fast # tracepoint. Skip the rest of this test. return -1 @@ -256,7 +256,7 @@ proc strace_trace_on_same_addr { type } { pass $test } -re ".*\r\n$gdb_prompt $" { - if [string equal $type "ftrace"] { + if {[string equal $type "ftrace"]} { # The instruction may be not long enough to set a fast # tracepoint. Skip the rest of this test. return -1 @@ -268,7 +268,7 @@ proc strace_trace_on_same_addr { type } { gdb_breakpoint "end" qualified - if [string equal $type "break"] { + if {[string equal $type "break"]} { gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" \ "continue to bar" gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" \ @@ -308,7 +308,7 @@ proc strace_trace_on_diff_addr { } { # Restart with a fresh gdb. clean_restart $executable gdb_load_shlib $libipa - if ![runto_main] { + if {![runto_main]} { return -1 } @@ -367,7 +367,7 @@ if { [istarget "x86_64-*-linux*"] || [istarget "i\[34567\]86-*-linux*"] } { clean_restart $executable gdb_load_shlib $libipa -if ![runto_main] { +if {![runto_main]} { return -1 } if {![gdb_target_supports_trace]} { diff --git a/gdb/testsuite/gdb.trace/tfind.exp b/gdb/testsuite/gdb.trace/tfind.exp index 92386e4..53e97be 100644 --- a/gdb/testsuite/gdb.trace/tfind.exp +++ b/gdb/testsuite/gdb.trace/tfind.exp @@ -75,11 +75,11 @@ if {$baseline == -1} { return } -set testline1 [expr $baseline + 1] -set testline2 [expr $baseline + 5] -set testline3 [expr $baseline + 6] -set testline4 [expr $baseline + 7] -set testline5 [expr $baseline + 8] +set testline1 [expr {$baseline + 1}] +set testline2 [expr {$baseline + 5}] +set testline3 [expr {$baseline + 6}] +set testline4 [expr {$baseline + 7}] +set testline5 [expr {$baseline + 8}] # # test tfind command @@ -351,7 +351,7 @@ gdb_test "tfind line NoSuChFiLe.c:$baseline" \ "No source file named.*" \ "8.27: tfind line in bad source file" -# 8.32 tfind invalid subcommand (tfind foo) +# 8.32 tfind invalid subcommand (tfind foo) ## check error gdb_test "tfind NoSuChOpTiOn 21" \ "No symbol.*|\[Ww\]arning.*|\[Ee\]rror.*" \ diff --git a/gdb/testsuite/gdb.trace/trace-break.exp b/gdb/testsuite/gdb.trace/trace-break.exp index 659267f..a2a79d8 100644 --- a/gdb/testsuite/gdb.trace/trace-break.exp +++ b/gdb/testsuite/gdb.trace/trace-break.exp @@ -23,16 +23,16 @@ set additional_flags [gdb_target_symbol_prefix_flags] require gdb_trace_common_supports_arch -if [prepare_for_testing "failed to prepare" $executable $srcfile \ - [list debug $additional_flags]] { +if {[prepare_for_testing "failed to prepare" $executable $srcfile \ + [list debug $additional_flags]]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } -if ![gdb_target_supports_trace] { +if {![gdb_target_supports_trace]} { unsupported "target does not support trace" return -1 } @@ -47,7 +47,7 @@ proc break_trace_same_addr_1 { trace_type option } \ # Start with a fresh gdb. clean_restart ${executable} - if ![runto_main] { + if {![runto_main]} { return -1 } @@ -81,7 +81,7 @@ proc break_trace_same_addr_2 { trace_type1 trace_type2 option } \ # Start with a fresh gdb. clean_restart ${executable} - if ![runto_main] { + if {![runto_main]} { return -1 } @@ -119,7 +119,7 @@ proc break_trace_same_addr_3 { trace_type option } \ # Start with a fresh gdb. clean_restart ${executable} - if ![runto_main] { + if {![runto_main]} { return -1 } @@ -156,7 +156,7 @@ proc break_trace_same_addr_4 { trace_type option } \ # Start with a fresh gdb. clean_restart ${executable} - if ![runto_main] { + if {![runto_main]} { return -1 } @@ -199,7 +199,7 @@ proc break_trace_same_addr_5 { trace1 trace2 trace3 trace3_at_first_loc } \ # Start with a fresh gdb. clean_restart ${executable} - if ![runto_main] { + if {![runto_main]} { return -1 } @@ -222,7 +222,7 @@ proc break_trace_same_addr_5 { trace1 trace2 trace3 trace3_at_first_loc } \ gdb_test "continue" "Continuing\\.\[ \r\n\]+(Thread .* hit )?Breakpoint.*" \ "continue to marker" - if [string equal $trace3_at_first_loc "1"] { + if {[string equal $trace3_at_first_loc "1"]} { gdb_test "${trace3} set_point" "\(Fast t|T\)racepoint \[0-9\] at $hex: file.*" \ "${trace3} set_point 2" } else { @@ -272,7 +272,7 @@ proc break_trace_same_addr_6 { trace1 enable1 trace2 enable2 } \ # Start with a fresh gdb. clean_restart ${executable} - if ![runto_main] { + if {![runto_main]} { return -1 } @@ -300,7 +300,7 @@ proc break_trace_same_addr_6 { trace1 enable1 trace2 enable2 } \ gdb_test_no_output "tstop" - if [string equal $enable1 "enable"] { + if {[string equal $enable1 "enable"]} { gdb_test "tfind tracepoint 4" "Found trace frame \[0-9\], tracepoint .*" \ "tfind test frame of tracepoint 4" gdb_test "tdump" \ @@ -313,7 +313,7 @@ proc break_trace_same_addr_6 { trace1 enable1 trace2 enable2 } \ "tfind test frame of tracepoint 4" } - if [string equal $enable2 "enable"] { + if {[string equal $enable2 "enable"]} { gdb_test "tfind tracepoint 5" "Found trace frame \[0-9\], tracepoint .*" \ "tfind test frame of tracepoint 5" gdb_test "tdump" \ @@ -359,7 +359,7 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \ } clean_restart ${executable} -if ![runto_main] { +if {![runto_main]} { return 0 } diff --git a/gdb/testsuite/gdb.trace/trace-buffer-size.exp b/gdb/testsuite/gdb.trace/trace-buffer-size.exp index 7fe814e..153439f 100644 --- a/gdb/testsuite/gdb.trace/trace-buffer-size.exp +++ b/gdb/testsuite/gdb.trace/trace-buffer-size.exp @@ -17,16 +17,16 @@ load_lib "trace-support.exp" standard_testfile -if [prepare_for_testing "failed to prepare" $testfile $srcfile \ - {debug nowarnings}] { +if {[prepare_for_testing "failed to prepare" $testfile $srcfile \ + {debug nowarnings}]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } -if ![gdb_target_supports_trace] { +if {![gdb_target_supports_trace]} { unsupported "target does not support trace" return -1 } diff --git a/gdb/testsuite/gdb.trace/trace-condition.exp b/gdb/testsuite/gdb.trace/trace-condition.exp index 8251345..0463656 100644 --- a/gdb/testsuite/gdb.trace/trace-condition.exp +++ b/gdb/testsuite/gdb.trace/trace-condition.exp @@ -25,16 +25,16 @@ set additional_flags [gdb_target_symbol_prefix_flags] require gdb_trace_common_supports_arch -if [prepare_for_testing "failed to prepare" $executable $srcfile \ - [list debug $additional_flags]] { +if {[prepare_for_testing "failed to prepare" $executable $srcfile \ + [list debug $additional_flags]]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } -if ![gdb_target_supports_trace] { +if {![gdb_target_supports_trace]} { unsupported "target does not support trace" return -1 } @@ -55,7 +55,7 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \ clean_restart ${executable} -if ![runto_main] { +if {![runto_main]} { return 0 } @@ -69,7 +69,7 @@ proc test_tracepoints { trace_command condition num_frames { kfail_proc 0 } } { clean_restart ${executable} - if ![runto_main] { + if {![runto_main]} { return 0 } diff --git a/gdb/testsuite/gdb.trace/trace-enable-disable.exp b/gdb/testsuite/gdb.trace/trace-enable-disable.exp index c009cff..92d664b 100644 --- a/gdb/testsuite/gdb.trace/trace-enable-disable.exp +++ b/gdb/testsuite/gdb.trace/trace-enable-disable.exp @@ -32,11 +32,11 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile executable $options] != "" clean_restart ${testfile} -if ![runto_main] { +if {![runto_main]} { return -1 } -if ![gdb_target_supports_trace] { +if {![gdb_target_supports_trace]} { unsupported "target does not support trace" return -1 } @@ -64,7 +64,7 @@ proc test_tracepoint_enable_disable { tracepoint_cmd } { set expected 0 - if ![runto_main] { + if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.trace/trace-mt.exp b/gdb/testsuite/gdb.trace/trace-mt.exp index 092dc6d..ec6eaed 100644 --- a/gdb/testsuite/gdb.trace/trace-mt.exp +++ b/gdb/testsuite/gdb.trace/trace-mt.exp @@ -27,11 +27,11 @@ with_test_prefix "runtime trace support check" { return } - if ![runto_main] { + if {![runto_main]} { return -1 } - if ![gdb_target_supports_trace] { + if {![gdb_target_supports_trace]} { unsupported "target does not support trace" return -1 } @@ -47,7 +47,7 @@ proc step_over_tracepoint { testfile trace_type } \ # Make sure inferior is running in all-stop mode. gdb_test_no_output "set non-stop 0" - if ![runto_main] { + if {![runto_main]} { return -1 } @@ -70,7 +70,7 @@ proc break_trace_same_addr { testfile trace_type option } \ # Start with a fresh gdb. clean_restart $testfile - if ![runto_main] { + if {![runto_main]} { return -1 } @@ -114,7 +114,7 @@ if { [prepare_for_testing "prepare for testing" $testfile_ipa $srcfile \ return } -if ![runto_main] { +if {![runto_main]} { return 0 } diff --git a/gdb/testsuite/gdb.trace/tracecmd.exp b/gdb/testsuite/gdb.trace/tracecmd.exp index 6e67de1..275772b 100644 --- a/gdb/testsuite/gdb.trace/tracecmd.exp +++ b/gdb/testsuite/gdb.trace/tracecmd.exp @@ -36,8 +36,8 @@ if {$baseline == -1} { return } -set testline1 [expr $baseline + 1] -set testline2 [expr $baseline + 3] +set testline1 [expr {$baseline + 1}] +set testline2 [expr {$baseline + 3}] # # test "help tracepoints" @@ -45,7 +45,7 @@ set testline2 [expr $baseline + 3] set helpcnt 0 test_class_help "tracepoints" { - "Tracing of program execution without stopping the program\.[\r\n\]+" + "Tracing of program execution without stopping the program\.[\r\n\]+" } {} "1.0: help tracepoints" # diff --git a/gdb/testsuite/gdb.trace/tracefile-pseudo-reg.exp b/gdb/testsuite/gdb.trace/tracefile-pseudo-reg.exp index f61115e..5f9159c 100644 --- a/gdb/testsuite/gdb.trace/tracefile-pseudo-reg.exp +++ b/gdb/testsuite/gdb.trace/tracefile-pseudo-reg.exp @@ -23,11 +23,11 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile \ return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } -if ![gdb_target_supports_trace] { +if {![gdb_target_supports_trace]} { unsupported "target does not support trace" return -1 } diff --git a/gdb/testsuite/gdb.trace/tspeed.exp b/gdb/testsuite/gdb.trace/tspeed.exp index be7f37e..2578c9e 100644 --- a/gdb/testsuite/gdb.trace/tspeed.exp +++ b/gdb/testsuite/gdb.trace/tspeed.exp @@ -18,7 +18,7 @@ load_lib "trace-support.exp" require allow_shlib_tests # Do not run if gdbserver debug is enabled - the output file is many Gb. -if [gdbserver_debug_enabled] { +if {[gdbserver_debug_enabled]} { return 0 } @@ -33,11 +33,11 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile executable $options] != "" clean_restart ${testfile} -if ![runto_main] { +if {![runto_main]} { return -1 } -if ![gdb_target_supports_trace] { +if {![gdb_target_supports_trace]} { unsupported "target does not support trace" return -1 } diff --git a/gdb/testsuite/gdb.trace/tstatus.exp b/gdb/testsuite/gdb.trace/tstatus.exp index f5547aa..2b4aa5a 100644 --- a/gdb/testsuite/gdb.trace/tstatus.exp +++ b/gdb/testsuite/gdb.trace/tstatus.exp @@ -20,16 +20,16 @@ set expfile tstatus.exp require gdb_trace_common_supports_arch -if [prepare_for_testing "failed to prepare" $executable $srcfile \ - [list debug]] { +if {[prepare_for_testing "failed to prepare" $executable $srcfile \ + [list debug]]} { return -1 } -if ![runto_main] { +if {![runto_main]} { return -1 } -if ![gdb_target_supports_trace] { +if {![gdb_target_supports_trace]} { unsupported "target does not support trace" return -1 } diff --git a/gdb/testsuite/gdb.trace/tsv.exp b/gdb/testsuite/gdb.trace/tsv.exp index 837633d..3fe6867 100644 --- a/gdb/testsuite/gdb.trace/tsv.exp +++ b/gdb/testsuite/gdb.trace/tsv.exp @@ -201,7 +201,7 @@ if {![runto_main]} { # If there are predefined TSVs, test these predefined TSVs are correctly # uploaded. -if [target_info exists gdb,predefined_tsv] { +if {[target_info exists gdb,predefined_tsv]} { set tsv [target_info gdb,predefined_tsv] # Test predefined TSVs are uploaded. diff --git a/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp b/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp index 3adf24a..e62a539 100644 --- a/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp +++ b/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp @@ -294,11 +294,11 @@ if { [gdb_compile [list ${binfile}1.o ${binfile}2.o] ${binfile} \ clean_restart ${testfile} -if ![runto_main] { +if {![runto_main]} { return -1 } -if ![gdb_target_supports_trace] { +if {![gdb_target_supports_trace]} { unsupported "target does not support trace" return -1 } diff --git a/gdb/testsuite/gdb.trace/unavailable.exp b/gdb/testsuite/gdb.trace/unavailable.exp index 51532c9..9d4955f 100644 --- a/gdb/testsuite/gdb.trace/unavailable.exp +++ b/gdb/testsuite/gdb.trace/unavailable.exp @@ -302,12 +302,12 @@ proc gdb_unavailable_registers_test_1 { } { # Test reading uncollected pseudo-registers. The set of which # depends on target. - if [is_amd64_regs_target] { + if {[is_amd64_regs_target]} { # Check the raw register first. test_register_unavailable "\$rax" test_register_unavailable "\$eax" test_register_unavailable "\$ax" - } elseif [is_x86_like_target] { + } elseif {[is_x86_like_target]} { # Check the raw register first. test_register_unavailable "\$eax" test_register_unavailable "\$ax" diff --git a/gdb/testsuite/gdb.trace/while-stepping.exp b/gdb/testsuite/gdb.trace/while-stepping.exp index 0dbff18..5a082a3 100644 --- a/gdb/testsuite/gdb.trace/while-stepping.exp +++ b/gdb/testsuite/gdb.trace/while-stepping.exp @@ -105,7 +105,7 @@ if {[gdb_test "" "Breakpoint .*" "run to main"] != 0} { return -1 } -if ![gdb_target_supports_trace] { +if {![gdb_target_supports_trace]} { unsupported "target does not support trace" return -1 } diff --git a/gdb/testsuite/gdb.tui/pr30056.exp b/gdb/testsuite/gdb.tui/pr30056.exp index 3cf5e90..22278e3 100644 --- a/gdb/testsuite/gdb.tui/pr30056.exp +++ b/gdb/testsuite/gdb.tui/pr30056.exp @@ -56,7 +56,7 @@ gdb_assert { [Term::wait_for_region_contents 0 $Term::_cur_row $Term::_cols 1 \ # Send arrow-right. send_gdb "\033\[C" # Wait for arrow-right effect. -gdb_assert { [Term::wait_for_region_contents 1 5 78 1 \ +gdb_assert { [Term::wait_for_region_contents 1 1 78 13 \ [string_to_regexp " ain (void)"]] } "arrow right" # Send ^C. diff --git a/gdb/testsuite/gdb.tui/winheight.exp b/gdb/testsuite/gdb.tui/winheight.exp index 9b36c98..38c7bcc 100644 --- a/gdb/testsuite/gdb.tui/winheight.exp +++ b/gdb/testsuite/gdb.tui/winheight.exp @@ -99,14 +99,14 @@ Term::check_box "check for asm window" 0 0 80 15 # The test then switches to the 'split' layout, and calculates the # expected window sizes. foreach_with_prefix cmd_size {20 12 5} { - set src_size_before [expr 24 - ${cmd_size} - 1] - set split_size [expr (24 - ${cmd_size}) / 2] + set src_size_before [expr {24 - ${cmd_size} - 1}] + set split_size [expr {(24 - ${cmd_size}) / 2}] if { $split_size < 3 } { # The minimum window size is 3, so force that. set src_size_after 3 set asm_size_after 3 - } elseif { [expr $split_size % 2] == 0 } { + } elseif { $split_size % 2 == 0 } { # The remaining space can be divided evenly between the two # windows. set src_size_after ${split_size} @@ -115,7 +115,7 @@ foreach_with_prefix cmd_size {20 12 5} { # The space can't be divided evenly, the asm window will get # the extra line. set src_size_after ${split_size} - set asm_size_after [expr ${split_size} + 1] + set asm_size_after [expr {${split_size} + 1}] } Term::command "layout src" @@ -125,5 +125,6 @@ foreach_with_prefix cmd_size {20 12 5} { # Both windows should be of equal size, which will be their minimum. Term::command "layout split" Term::check_box "check for src window in split" 0 0 80 ${src_size_after} - Term::check_box "check for asm window in split" 0 [expr ${src_size_after} - 1] 80 ${asm_size_after} + Term::check_box "check for asm window in split" \ + 0 [expr {${src_size_after} - 1}] 80 ${asm_size_after} } diff --git a/gdb/testsuite/gdb.tui/wrap-line.exp b/gdb/testsuite/gdb.tui/wrap-line.exp index 67ad36c..ef166f7 100644 --- a/gdb/testsuite/gdb.tui/wrap-line.exp +++ b/gdb/testsuite/gdb.tui/wrap-line.exp @@ -165,7 +165,7 @@ with_test_prefix width-hard-coded { } with_test_prefix width-auto-detected { - Term::with_tuiterm {*}$dims { + Term::with_tuiterm $lines $cols { save_vars { ::INTERNAL_GDBFLAGS } { # Avoid "set width 0" argument. set INTERNAL_GDBFLAGS \ diff --git a/gdb/unittests/parallel-for-selftests.c b/gdb/unittests/parallel-for-selftests.c index f545614..b69eed4 100644 --- a/gdb/unittests/parallel-for-selftests.c +++ b/gdb/unittests/parallel-for-selftests.c @@ -42,66 +42,118 @@ struct save_restore_n_threads int n_threads; }; -using foreach_callback_t = gdb::function_view<void (int first, int last)>; -using do_foreach_t = gdb::function_view<void (int first, int last, +using foreach_callback_t = gdb::function_view<void (iterator_range<int *> range)>; +using do_foreach_t = gdb::function_view<void (int *first, int *last, foreach_callback_t)>; +/* Run one parallel-for-each test on the range [1, UPPER_BOUND) using the + parallel-for-each implementation DO_FOREACH. */ + static void -test_one (int n_threads, do_foreach_t do_foreach) +test_one (do_foreach_t do_foreach, int upper_bound) { - save_restore_n_threads saver; - gdb::thread_pool::g_thread_pool->set_thread_count (n_threads); + std::vector<int> input; - { - constexpr int upper_bound = 1000; - std::atomic<int> counter (0); - do_foreach (0, upper_bound, - [&] (int start, int end) { counter += end - start; }); - SELF_CHECK (counter == upper_bound); - } + for (int i = 0; i < upper_bound; ++i) + input.emplace_back (i); - { - std::atomic<int> counter (0); - do_foreach (0, 0, [&] (int start, int end) { counter += end - start; }); - SELF_CHECK (counter == 0); - } + std::vector<int> output; + std::mutex mtx; - { - /* Check that if there are fewer tasks than threads, then we won't - end up with a null result. */ - std::vector<std::unique_ptr<int>> intresults; - std::atomic<bool> any_empty_tasks (false); - - do_foreach (0, 1, - [&] (int start, int end) - { - if (start == end) - any_empty_tasks = true; - - return std::make_unique<int> (end - start); - }); - - SELF_CHECK (!any_empty_tasks); - SELF_CHECK (std::all_of (intresults.begin (), intresults.end (), - [] (const std::unique_ptr<int> &entry) - { return entry != nullptr; })); - } + /* The (unfortunate) reason why we don't use std::vector<int>::iterator as + the parallel-for-each iterator type is that std::atomic won't work with + that type when building with -D_GLIBCXX_DEBUG. */ + do_foreach (input.data (), input.data () + input.size (), + [&] (iterator_range<int *> range) + { + /* We shouldn't receive empty ranges. */ + SELF_CHECK (!range.empty ()); + + std::lock_guard lock (mtx); + + for (int i : range) + output.emplace_back (i * 2); + }); + + /* Verify that each item was processed exactly once. */ + SELF_CHECK (output.size () == upper_bound); + std::sort (output.begin (), output.end ()); + + for (int i = 0; i < output.size (); ++i) + SELF_CHECK (output[i] == i * 2); +} + +/* Run all tests on the parallel-for-each implementation DO_FOREACH. */ + +static void +test_one_function (int n_threads, do_foreach_t do_foreach) +{ + save_restore_n_threads saver; + gdb::thread_pool::g_thread_pool->set_thread_count (n_threads); + + /* Test with a few arbitrary number of items. */ + test_one (do_foreach, 0); + test_one (do_foreach, 1); + test_one (do_foreach, 1000); } static void test_parallel_for_each () { + struct test_worker + { + /* DUMMY is there to test passing multiple arguments to the worker + constructor. */ + test_worker (foreach_callback_t callback, int dummy) + : m_callback (callback) + { + } + + void operator() (iterator_range<int *> range) + { + return m_callback (range); + } + + private: + foreach_callback_t m_callback; + }; + const std::vector<do_foreach_t> for_each_functions { - [] (int start, int end, foreach_callback_t callback) - { gdb::parallel_for_each<1> (start, end, callback); }, - [] (int start, int end, foreach_callback_t callback) - { gdb::sequential_for_each (start, end, callback);} + /* Test gdb::parallel_for_each. */ + [] (int *start, int *end, foreach_callback_t callback) + { gdb::parallel_for_each<1, int *, test_worker> (start, end, callback, 0); }, + + /* Test gdb::parallel_for_each_async. */ + [] (int *start, int *end, foreach_callback_t callback) + { + bool done_flag = false; + std::condition_variable cv; + std::mutex mtx; + + gdb::parallel_for_each_async<1, int *, test_worker> (start, end, + [&mtx, &done_flag, &cv] () + { + std::lock_guard<std::mutex> lock (mtx); + done_flag = true; + cv.notify_one(); + }, callback, 0); + + /* Wait for the async parallel-for to complete. */ + std::unique_lock<std::mutex> lock (mtx); + cv.wait (lock, [&done_flag] () { return done_flag; }); + }, + + /* Test gdb::sequential_for_each. */ + [] (int *start, int *end, foreach_callback_t callback) + { gdb::sequential_for_each<int *, test_worker> (start, end, callback, 0); }, }; - for (int n_threads : { 0, 1, 3 }) + int default_thread_count = gdb::thread_pool::g_thread_pool->thread_count (); + + for (int n_threads : { 0, 1, 3, default_thread_count }) for (const auto &for_each_function : for_each_functions) - test_one (n_threads, for_each_function); + test_one_function (n_threads, for_each_function); } } /* namespace parallel_for */ |