diff options
author | Siddhesh Poyarekar <siddhesh@sourceware.org> | 2012-09-25 12:20:42 +0000 |
---|---|---|
committer | Siddhesh Poyarekar <siddhesh@sourceware.org> | 2012-09-25 12:20:42 +0000 |
commit | 318102b961ee0819c326894f988b187c11b24285 (patch) | |
tree | 4dc9fe46ff860308e61fd9c76b557e8e3423fb30 | |
parent | ec4dbad32d15acd95084aea6145486dac5a19948 (diff) | |
download | gdb-318102b961ee0819c326894f988b187c11b24285.zip gdb-318102b961ee0819c326894f988b187c11b24285.tar.gz gdb-318102b961ee0819c326894f988b187c11b24285.tar.bz2 |
gdb/ChangeLog:
* c-typeprint.c (c_type_print_varspec_suffix): Remove cast and
use plongest to print the array size.
testsuite/ChangeLog:
* gdb.base/longest-types.c: New test case.
* gdb.base/longest-types.exp: New test case.
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/c-typeprint.c | 4 | ||||
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/longest-types.c | 28 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/longest-types.exp | 25 |
5 files changed, 65 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0a1ccdf..a6a75b5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2012-09-25 Siddhesh Poyarekar <siddhesh@redhat.com> + + * c-typeprint.c (c_type_print_varspec_suffix): Remove cast and + use plongest to print the array size. + 2012-09-24 Siddhesh Poyarekar <siddhesh@redhat.com> * m2-typeprint.c (m2_enum): Expand LASTVAL to LONGEST. diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c index 9ce6f63..8b5bc21 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c @@ -621,8 +621,8 @@ c_type_print_varspec_suffix (struct type *type, fprintf_filtered (stream, (is_vector ? "__attribute__ ((vector_size(" : "[")); if (get_array_bounds (type, &low_bound, &high_bound)) - fprintf_filtered (stream, "%d", - (int) (high_bound - low_bound + 1)); + fprintf_filtered (stream, "%s", + plongest (high_bound - low_bound + 1)); fprintf_filtered (stream, (is_vector ? ")))" : "]")); c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index da01f8d..5e2bc5f 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-09-25 Siddhesh Poyarekar <siddhesh@redhat.com> + + * gdb.base/longest-types.c: New test case. + * gdb.base/longest-types.exp: New test case. + 2012-09-25 Yao Qi <yao@codesourcery.com> * gdb.mi/mi2-cli.exp: Check breakpoint notification. diff --git a/gdb/testsuite/gdb.base/longest-types.c b/gdb/testsuite/gdb.base/longest-types.c new file mode 100644 index 0000000..1394c08 --- /dev/null +++ b/gdb/testsuite/gdb.base/longest-types.c @@ -0,0 +1,28 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2012 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/>. */ + +struct foo +{ + char buf[0xffff000000]; + char buf2[2]; +} *f; + +int +main (void) +{ + return 0; +} diff --git a/gdb/testsuite/gdb.base/longest-types.exp b/gdb/testsuite/gdb.base/longest-types.exp new file mode 100644 index 0000000..334307a --- /dev/null +++ b/gdb/testsuite/gdb.base/longest-types.exp @@ -0,0 +1,25 @@ +# This testcase is part of GDB, the GNU debugger. + +# Copyright 2012 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 + +if { [prepare_for_testing ${testfile}.exp ${testfile} $srcfile {debug quiet}] } { + return -1 +} + +# 64-bit array size should not overflow +gdb_test "print &f->buf" {= \(char \(\*\)\[1099494850560\]\) 0x0} |