gdb, testsuite: fix TCL error in 'gdb.base/structs.exp'

Message ID 20241204134155.460580-1-stephan.rohr@intel.com
State New
Headers
Series gdb, testsuite: fix TCL error in 'gdb.base/structs.exp' |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 fail Patch failed to apply
linaro-tcwg-bot/tcwg_gdb_build--master-arm fail Patch failed to apply

Commit Message

Rohr, Stephan Dec. 4, 2024, 1:41 p.m. UTC
  A failure of 'runto_main' in 'start_structs_test' results in a TCL
error.  The return value of 'start_structs_test' function is evaluated
inside an if conditional clause, which expects a boolean value.  Return
'-1' on failure to avoid the error.
---
 gdb/testsuite/gdb.base/structs.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Keith Seitz Dec. 4, 2024, 3:55 p.m. UTC | #1
On 12/4/24 5:41 AM, Stephan Rohr wrote:
> A failure of 'runto_main' in 'start_structs_test' results in a TCL
> error.  The return value of 'start_structs_test' function is evaluated
> inside an if conditional clause, which expects a boolean value.  Return
> '-1' on failure to avoid the error.

Kinda funny to return -1 as a boolean value, so I was compelled to look
into this. This is consistent with the rest of `start_structs_test',
so this is fine. [Tcl doesn't care anyway.]

Good catch!

Reviewed-By: Keith Seitz <keiths@redhat.com>

Keith
  
Tom Tromey Dec. 4, 2024, 4:14 p.m. UTC | #2
>>>>> "Keith" == Keith Seitz <keiths@redhat.com> writes:

Keith> Reviewed-By: Keith Seitz <keiths@redhat.com>

Thanks Keith.  I agree it is ok.

Approved-By: Tom Tromey <tom@tromey.com>

Tom
  

Patch

diff --git a/gdb/testsuite/gdb.base/structs.exp b/gdb/testsuite/gdb.base/structs.exp
index ab68da27efa..99b6aa9daa1 100644
--- a/gdb/testsuite/gdb.base/structs.exp
+++ b/gdb/testsuite/gdb.base/structs.exp
@@ -68,7 +68,7 @@  proc start_structs_test { types } {
 
     # Advance to main
     if {![runto_main]} {
-	return
+	return -1
     }
 
     # Get the debug format