[RFA] Fix gdb.base/gdb1250.exp to work when abort() is in a shared library

Fred Fish
2004-02-23T05:57:49Z

The gdb1250.exp test tries to run directly to abort(), which fails if
abort() is in a shared library that hasn't yet been loaded. For
example the the i686-pc-linux-gnu native test fails:

FAIL: gdb.base/gdb1250.exp: setting breakpoint at abort
ERROR: couldn't run to breakpoint

By first running to main, the shared libc gets loaded and then the
run to abort() works. Here is a patch.

-Fred

+ 2004-02-22 Fred Fish <fnf@redhat.com>
+
+ * gdb.base/gdb1250.exp: Run to main before trying to
+ run to abort.
+

Index: gdb.base/gdb1250.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/gdb1250.exp,v
retrieving revision 1.1
diff -c -p -r1.1 gdb1250.exp
*** gdb.base/gdb1250.exp 15 Jul 2003 16:28:21 -0000 1.1
--- gdb.base/gdb1250.exp 23 Feb 2004 05:54:30 -0000
***************
*** 1,4 ****
! # Copyright 2003 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
--- 1,4 ----
! # Copyright 2003, 2004 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
*************** gdb_exit
*** 41,46 ****
--- 41,55 ----
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
+
+ # First run to main so that any shared libc gets loaded. That is
+ # probably where abort() lives and gdb won't know how to find it to
+ # set a breakpoint there until the shared library symbols are read in.
+
+ if ![runto_main] then {
+ perror "couldn't run to main"
+ continue
+ }

if ![runto abort] then {
perror "couldn't run to breakpoint"