Re: [PATCH][gdb/testsuite] Don't abort testrun for invalid command in test-case

Tom de Vries
2020-06-11T22:56:03Z

On 11-06-2020 18:56, Pedro Alves wrote:
>> I don't think it's cleaner, because we run default_gdb_init, as well the
>> bit of proc runtest between ${tool}_init a ${tool}_finish with the
>> altered ::unknown.
> Well, that is code that is exercised by all testscases, it's part of the
> framework. It's not going to ever contain calls to procedures that
> don't exist that go unnoticed for long. The whole testsuite would
> collapse. We can move the overriding until after default_gdb_init
> is called, even, so that even less code runs under gdb's "unknown":
>
> set res [default_gdb_init $test_file_name]
>
> # Skip dejagnu_unknown while running a testcase to prevent it from
> # exiting and aborting the entire test run. Save the unknown proc
> # defined by DejaGnu, and override the unknown proc with a
> # gdb-local version.
> rename ::unknown ::dejagnu_unknown
> proc unknown { args } {
> return [uplevel 1 ::tcl_unknown $args]
> }
>
> return $res
> }
>

Hmm, what is the distinction between gdb_init and default_gdb_init?

All the other uses in gdb.exp of pattern foo/default_foo have an
implementation:
...
proc foo {} {
[default_foo]
}
...
but gdb_init is much more than that. Why is that different?

The code introducing default_gdb_init mentions that gdb_init can be
overridden. If so, then the unknown override won't be active. Or should
all gdb_init overrides copy this code?

Thanks,
- Tom