summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.ada/varsize_limit
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@adacore.com>2018-03-27 09:17:45 -0500
committerJoel Brobecker <brobecker@adacore.com>2018-03-27 10:17:45 -0400
commit3fcded8f30b6b0c1930d4f82914476315027aa2e (patch)
treed4e496c7f09f4097e429a15610e7d38b103ff3b2 /gdb/testsuite/gdb.ada/varsize_limit
parentcd4fb1b2ffc88911e4109444ff729e31920d01ec (diff)
downloadbinutils-gdb-3fcded8f30b6b0c1930d4f82914476315027aa2e.tar.gz
set varsize-limit: New GDB setting for maximum dynamic object size
This is a command we somehow forgot to contribute at the time the Ada language was first contributed to the FSF. This command allows the user to change the maximum size we allow when reading memory from dynamic objects (the default is 65536 bytes). At the moment, this limit is only used by Ada, and so the implementation is kept inside ada-lang.c. However, it is conceivable that other language might want to use it also to handle the same kind of issues; for instance, this might be useful when handling dynamic types in C. So the name of the setting was made language-neutral, to allow for this. Note that an alias for "set var" needs to be introduced as well. We are not adding a test for that, since this is a feature that is already exercized by numerous existing tests. gdb/ChangeLog * NEWS: Add entry describing new "set|show varsize-limit" command. * ada-lang.c (_initialize_ada_language): Add "set/show varsize-limit" command. * printcmd.c (_initialize_printcmd): Add "set var" alias of "set variable". gdb/doc/ChangeLog: * gdb.texinfo (Ada Settings): New subsubsection. gdb/testsuite/ChangeLog: * gdb.ada/varsize_limit: New testcase. Tested on x86_64-linux.
Diffstat (limited to 'gdb/testsuite/gdb.ada/varsize_limit')
-rw-r--r--gdb/testsuite/gdb.ada/varsize_limit/pck.adb25
-rw-r--r--gdb/testsuite/gdb.ada/varsize_limit/pck.ads20
-rw-r--r--gdb/testsuite/gdb.ada/varsize_limit/vsizelim.adb23
3 files changed, 68 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.ada/varsize_limit/pck.adb b/gdb/testsuite/gdb.ada/varsize_limit/pck.adb
new file mode 100644
index 00000000000..d4acf86bcda
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/varsize_limit/pck.adb
@@ -0,0 +1,25 @@
+-- Copyright 2018 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/>.
+
+package body Pck is
+ procedure Do_Nothing (A : System.Address) is
+ begin
+ null;
+ end Do_Nothing;
+ function Ident (S : String) return String is
+ begin
+ return S;
+ end Ident;
+end Pck;
diff --git a/gdb/testsuite/gdb.ada/varsize_limit/pck.ads b/gdb/testsuite/gdb.ada/varsize_limit/pck.ads
new file mode 100644
index 00000000000..b0043facd97
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/varsize_limit/pck.ads
@@ -0,0 +1,20 @@
+-- Copyright 2018 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/>.
+
+with System;
+package Pck is
+ procedure Do_Nothing (A : System.Address);
+ function Ident (S : String) return String;
+end Pck;
diff --git a/gdb/testsuite/gdb.ada/varsize_limit/vsizelim.adb b/gdb/testsuite/gdb.ada/varsize_limit/vsizelim.adb
new file mode 100644
index 00000000000..e65ebfd7b62
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/varsize_limit/vsizelim.adb
@@ -0,0 +1,23 @@
+-- Copyright 2018 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/>.
+
+with Pck; use Pck;
+procedure VsizeLim is
+ Small : String := Ident ("1234567890");
+ Larger : String := Ident ("1234567890|1234567890|1234567890");
+begin
+ Do_Nothing (Small'Address); -- STOP
+ Do_Nothing (Larger'Address);
+end VsizeLim;