diff options
author | Doug Evans <dje@google.com> | 2017-03-15 15:44:45 -0700 |
---|---|---|
committer | Doug Evans <dje@google.com> | 2017-03-16 09:31:29 -0700 |
commit | a7c0469f992721b30665ba92f4f2f74d29032a84 (patch) | |
tree | a969a42f1d28f0d33360ecbdb053d947974182d3 /gdb/testsuite/gdb.guile/scm-lazy-string.c | |
parent | 34b433203b5f56149c27a8dfea21a921392cb158 (diff) | |
download | binutils-a7c0469f992721b30665ba92f4f2f74d29032a84.zip binutils-a7c0469f992721b30665ba92f4f2f74d29032a84.tar.gz binutils-a7c0469f992721b30665ba92f4f2f74d29032a84.tar.bz2 |
Copy lazy string handling fixes from Python.
This patch keeps the Scheme side of lazy string handling in sync
with the python size, bringing over fixes for
PRs python/17728, python/18439, python/18779.
gdb/ChangeLog:
* guile/scm-lazy-string.c (lazy_string_smob): Clarify use of LENGTH
member. Change type of TYPE member to SCM. All uses updated.
(lsscm_make_lazy_string_smob): Add assert.
(lsscm_make_lazy_string): Flag bad length values.
(lsscm_elt_type): New function.
(gdbscm_lazy_string_to_value): Rewrite to use
lsscm_safe_lazy_string_to_value.
(lsscm_safe_lazy_string_to_value): Fix handling of TYPE_CODE_PTR.
* guile/scm-value.c (gdbscm_value_to_lazy_string): Flag bad length
values. Fix TYPE_CODE_PTR. Handle TYPE_CODE_ARRAY. Handle typedefs
in incoming type.
* guile/guile-internal.h (tyscm_scm_to_type): Declare.
* guile/scm-type.c (tyscm_scm_to_type): New function.
gdb/testsuite/ChangeLog:
* gdb.guile/scm-value.c (main) Delete locals sptr, sn.
* gdb.guile/scm-lazy-string.c: New file.
* gdb.guile/scm-value.exp: Move lazy string tests to ...
* gdb.guile/scm-lazy-string.exp: ... here, new file. Add more tests
for pointer, array, typedef lazy strings.
Diffstat (limited to 'gdb/testsuite/gdb.guile/scm-lazy-string.c')
-rw-r--r-- | gdb/testsuite/gdb.guile/scm-lazy-string.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.guile/scm-lazy-string.c b/gdb/testsuite/gdb.guile/scm-lazy-string.c new file mode 100644 index 0000000..936b4e2 --- /dev/null +++ b/gdb/testsuite/gdb.guile/scm-lazy-string.c @@ -0,0 +1,29 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2015-2016 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/>. */ + +typedef const char *pointer; + +int +main () +{ + const char *ptr = "pointer"; + const char array[] = "array"; + pointer typedef_ptr = "typedef pointer"; + const char *null = 0; + + return 0; /* break here */ +} |