RFA 2/2 fix for bug with large structure offsets

David Taylor dtaylor@emc.com
Tue Nov 18 16:53:00 GMT 2014


Here is the testsuite part of the patch.

diff --git a/gdb/testsuite/gdb.base/Makefile.in b/gdb/testsuite/gdb.base/Makefile.in
index dda3169..d828d35 100644
--- a/gdb/testsuite/gdb.base/Makefile.in
+++ b/gdb/testsuite/gdb.base/Makefile.in
@@ -43,7 +43,7 @@ EXECUTABLES = a2-run advance all-types annota1 annota1-watch_thread_num \
 	watch-vfork watch_thread_num watchpoint watchpoint-cond-gone \
 	watchpoint-hw watchpoint-hw-hit-once watchpoint-solib watchpoints \
 	wchar whatis whatis-exp catch-syscall \
-	pr10179 gnu_vector
+	pr10179 gnu_vector offsets
 
 MISCELLANEOUS = coremmap.data dprintf-pendshr.sl ../foobar.baz fixsectshr.sl \
 	pendshr.sl shreloc1.sl shreloc2.sl twice-tmp.c \

There are also two small new files; they did not show up in the diff.
Here they are:

====== start of gdb/testsuite/gdb.base/offsets.c ========
struct big_struct
{
  char first[0x10000000 + 16];
  long second;
} big_struct;

int
main (int argc, char *argv[])
{
  return (0);
}
====== end of gdb/testsuite/gdb.base/offsets.c ========

and

====== start of gdb/testsuite/gdb.base/offsets.exp ========
# Test big offsets

# Copyright (c) 2014 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
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

standard_testfile offsets.c

if { [prepare_for_testing ${testfile}.exp $testfile $srcfile] } {
    untested offsets.exp
    return -1
}

set test "print &big_struct test"
gdb_test_multiple "print &big_struct" "$test" {
    -re "\\$\[0-9\]* = .* (0x\[0-9a-fA-F\]*) .*\[\r\n\]*$gdb_prompt $" {
	set addr1 $expect_out(1,string)
	pass "$test ($addr1)"
    }
    timeout {
	fail "$test (timeout)"
    }
}

set test "print &big_struct.second test"
gdb_test_multiple "print &big_struct.second" "$test" {
    -re "\\$\[0-9\]* = .* (0x\[0-9a-fA-F\]*) .*\[\r\n\]*$gdb_prompt $" {
	set addr2 $expect_out(1,string)
	pass "$test ($addr2)"
    }
    timeout {
	fail "$test (timeout)"
    }
}

if {[expr $addr2 - $addr1] == [expr 0x10000000 + 16]} {
    pass "big offsets"
} else {
    fail "big offsets"
}
====== end of gdb/testsuite/gdb.base/offsets.exp ========



More information about the Gdb-patches mailing list