]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
[gdb/testsuite] Move code from gdb_init to default_gdb_init
authorTom de Vries <tdevries@suse.de>
Thu, 18 Jun 2020 13:06:04 +0000 (15:06 +0200)
committerTom de Vries <tdevries@suse.de>
Thu, 18 Jun 2020 13:06:04 +0000 (15:06 +0200)
commita8a566853a0fc7f57159e55436ff6f395e499568
treeeef81586267f11a273d3ed6a97aa27cdf872e4e8
parentd27c357a5b83773054e85ff3ea5dbfe18b9dd3c0
[gdb/testsuite] Move code from gdb_init to default_gdb_init

If a baseboard file wants to override a proc foo, but also use the original
proc, it'll have to do something like:
...
rename foo save_foo
proc foo { } {
    ...
    set res [save_foo]
    ...
    return res
}
...
This adds a new proc named save_foo, which introduces the risk of clashing with
an existing proc.

There's a pattern in the gdb testsuite procs, that facilitates this override:
...
proc default_foo { } {
  ...
}

proc foo { } {
    return [default_foo]
}
...
such that in a baseboard file we don't need the rename:
...
proc foo { } {
    ...
    set res [default_foo]
    ...
    return res
}
...

The exception to the pattern though is gdb_init, which has a default_gdb_init
counterpart, but contains much more code than just the call to
default_gdb_init.

Fix this by moving all but the call to default_gdb_init to default_gdb_init.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-06-18  Tom de Vries  <tdevries@suse.de>

* lib/gdb.exp (gdb_init): Move all but call to default_gdb_init to ...
(default_gdb_init): ... here.
gdb/testsuite/ChangeLog
gdb/testsuite/lib/gdb.exp