Re: [PATCH 3/3][gdb/testsuite] Warn about leaked global array

Tom de Vries
2020-06-03T09:39:03Z

On 03-06-2020 10:47, Tom de Vries wrote:
> ERROR: can't read "mi_gdb_prompt": no such variable
> while executing
> "expect {
> -i exp95 -timeout 10
> -re "~\"GNU.*\r\n~\".*$mi_gdb_prompt$" {
> # We have a new format mi startup prompt. If we are
> # running mi1,..."
> ("uplevel" body line 1)
> invoked from within
> "uplevel $body" TCL READ VARNAME can't read "mi_gdb_prompt": no such
> variable

So, the following happens:
- a test-case imports mi-support.exp using load_lib
- mi-support.exp sets mi_gdb_prompt
- the test-case finishes and the new global mi_gdb_prompt is unset,
because it was not set before the test-case
- a next test-case imports mi-support.exp using load_lib
- load_lib sees that the file already has been loaded, so it skips it
- mi_gdb_prompt remains unset
- the test-case uses mi_gdb_prompt, and we have an error.

Thanks,
- Tom