aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.python/py-value.c
AgeCommit message (Collapse)AuthorFilesLines
2024-01-12Update copyright year range in header of all files managed by GDBAndrew Burgess1-1/+1
This commit is the result of the following actions: - Running gdb/copyright.py to update all of the copyright headers to include 2024, - Manually updating a few files the copyright.py script told me to update, these files had copyright headers embedded within the file, - Regenerating gdbsupport/Makefile.in to refresh it's copyright date, - Using grep to find other files that still mentioned 2023. If these files were updated last year from 2022 to 2023 then I've updated them this year to 2024. I'm sure I've probably missed some dates. Feel free to fix them up as you spot them.
2023-05-23Add global_context parameter to gdb.parse_and_evalTom Tromey1-0/+3
This adds a 'global_context' parse_and_eval to gdb.parse_and_eval. This lets users request a parse that is done at "global scope". I considered letting callers pass in a block instead, with None meaning "global" -- but then there didn't seem to be a clean way to express the default for this parameter. Reviewed-By: Eli Zaretskii <eliz@gnu.org>
2023-01-01Update copyright year range in header of all files managed by GDBJoel Brobecker1-1/+1
This commit is the result of running the gdb/copyright.py script, which automated the update of the copyright year range for all source files managed by the GDB project to be updated to include year 2023.
2022-01-01Automatic Copyright Year update after running gdb/copyright.pyJoel Brobecker1-1/+1
This commit brings all the changes made by running gdb/copyright.py as per GDB's Start of New Year Procedure. For the avoidance of doubt, all changes in this commits were performed by the script.
2021-01-01Update copyright year range in all GDB filesJoel Brobecker1-1/+1
This commits the result of running gdb/copyright.py as per our Start of New Year procedure... gdb/ChangeLog Update copyright year range in copyright header of all GDB files.
2020-01-01Update copyright year range in all GDB files.Joel Brobecker1-1/+1
gdb/ChangeLog: Update copyright year range in all GDB files.
2019-01-01Update copyright year range in all GDB files.Joel Brobecker1-1/+1
This commit applies all changes made after running the gdb/copyright.py script. Note that one file was flagged by the script, due to an invalid copyright header (gdb/unittests/basic_string_view/element_access/char/empty.cc). As the file was copied from GCC's libstdc++-v3 testsuite, this commit leaves this file untouched for the time being; a patch to fix the header was sent to gcc-patches first. gdb/ChangeLog: Update copyright year range in all GDB files.
2018-01-02Update copyright year range in all GDB filesJoel Brobecker1-1/+1
gdb/ChangeLog: Update copyright year range in all GDB files
2017-03-16Fix various python lazy string bugs.Doug Evans1-2/+0
gdb/ChangeLog: PR python/17728, python/18439, python/18779 * python/py-lazy-string.c (lazy_string_object): Clarify use of LENGTH member. Change type of TYPE member to PyObject *. All uses updated. (stpy_convert_to_value): Fix handling of TYPE_CODE_PTR. (gdbpy_create_lazy_string_object): Flag bad length values. Handle TYPE_CODE_ARRAY with possibly different user-provided length. Handle typedefs in incoming type. (stpy_lazy_string_elt_type): New function. (gdbpy_extract_lazy_string): Call it. * python/py-value.c (valpy_lazy_string): Flag bad length values. Fix handling of TYPE_CODE_PTR. Handle TYPE_CODE_ARRAY. Handle typedefs in incoming type. gdb/testsuite/ChangeLog: PR python/17728, python/18439, python/18779 * gdb.python/py-value.c (main) Delete locals sptr, sn. * gdb.python/py-lazy-string.c (pointer): New typedef. (main): New locals ptr, array, typedef_ptr. * gdb.python/py-value.exp: Move lazy string tests to ... * gdb.python/py-lazy-string.exp: ... here. Add more tests for pointer, array, typedef lazy strings.
2017-01-01update copyright year range in GDB filesJoel Brobecker1-1/+1
This applies the second part of GDB's End of Year Procedure, which updates the copyright year range in all of GDB's files. gdb/ChangeLog: Update copyright year range in all GDB files.
2016-10-12Fixup gdb.python/py-value.exp for bare-metal aarch64-elfLuis Machado1-1/+9
I noticed that testing aarch64-elf gdb with a physical board ran into issues with gdb.python/py-value.exp. Further investigation showed that we were actually trying to dereference a NULL pointer (argv) when trying to access argv[0]. Being bare-metal, argv is not guaranteed to be valid. So we need to make sure argv is sane before accessing argv[0]. The following patch fixes up the test program to check for a NULL argv and also improves the testcase a bit so it doesn't have to work with a hardcoded argc value. Regression-tested on x86-64 Ubuntu 16.04. gdb/testsuite/ChangeLog: 2016-10-12 Luis Machado <lgustavo@codesourcery.com> * gdb.python/py-value.c (main): Check if argv is NULL before using it. * gdb.python/py-value.exp (test_value_in_inferior): Don't use hardcoded argc values. Add 1 to argc so we guarantee distinct initial/modified argc values.
2016-01-01GDB copyright headers update after running GDB's copyright.py script.Joel Brobecker1-1/+1
gdb/ChangeLog: Update year range in copyright notice of all files.
2015-01-01Update year range in copyright notice of all files owned by the GDB project.Joel Brobecker1-1/+1
gdb/ChangeLog: Update year range in copyright notice of all files.
2014-04-07[python] Fix gdb.Value.dynamic_type for reference values.Siva Chandra1-0/+2
gdb.Value.dynamic_type is supposed to work for reference and pointer values. However, the value object in the function 'valpy_get_dynamic_type' was being dereferenced using 'value_ind' irrespective of the value type being TYPE_CODE_PTR or TYPE_CODE_REF. This patch fixes that to use 'coerce_ref' for TYPE_CODE_REF values. ChangeLog: * python/py-value.c (valpy_get_dynamic_type): Use coerce_ref to dereference TYPE_CODE_REF values. testsuite/ * gdb.python/py-value.c: Improve test case. * gdb.python/py-value.exp: Add new test.
2014-01-01Update Copyright year range in all files maintained by GDB.Joel Brobecker1-1/+1
2013-12-10PR 16286Doug Evans1-0/+17
* c-lang.c (c_get_string): Ignore the declared size of the object if a specific length is requested. testsuite/ * gdb.python/py-value.c: #include stdlib.h, string.h. (str): New struct. (main): New local xstr. * gdb.python/py-value.exp (test_value_in_inferior): Add test to fetch a value as a string with a length beyond the declared length of the array.
2013-01-01Update years in copyright notice for the GDB files.Joel Brobecker1-1/+1
Two modifications: 1. The addition of 2013 to the copyright year range for every file; 2. The use of a single year range, instead of potentially multiple year ranges, as approved by the FSF.
2012-01-04Copyright year update in most files of the GDB Project.Joel Brobecker1-1/+1
gdb/ChangeLog: Copyright year update in most files of the GDB Project.
2011-10-04* gdb.python/py-value.c (main): Break before return.Paul Koning1-1/+4
2011-01-01run copyright.sh for 2011.Joel Brobecker1-1/+1
2010-08-23gdbTom Tromey1-0/+10
PR python/11145: * python/py-value.c: Include expression.h. (valpy_do_cast): New function. (valpy_cast): Use it. (valpy_dynamic_cast): New function. (valpy_reinterpret_cast): Likewise. (value_object_methods): Add dynamic_cast, reinterpret_cast. gdb/doc PR python/11145: * gdb.texinfo (Values From Inferior): Document dynamic_cast and reinterpret_cast methods. gdb/testsuite PR python/11145: * gdb.python/py-value.c (Base, Derived): New types. (base): New global. * gdb.python/py-value.exp (test_subscript_regression): Add dynamic_cast test.
2010-07-272010-07-27 Phil Muldoon <pmuldoon@redhat.com>Phil Muldoon1-0/+16
* python/py-value.c (valpy_call): New Function. 2010-07-27 Phil Muldoon <pmuldoon@redhat.com> * gdb.python/py-value.exp (test_inferior_function_call): New function. * gdb.python/py-value.c (func1): New function. (func2): Likewise. 2010-07-27 Phil Muldoon <pmuldoon@redhat.com> * gdb.texinfo (Values From Inferior): Add value inferior function call description.
2010-04-082010-04-08 Phil Muldoon <pmuldoon@redhat.com>Phil Muldoon1-1/+1
PR python/11417 * python/py-lazy-string.c (stpy_convert_to_value): Check for a NULL address. (gdbpy_create_lazy_string_object): Allow strings with a NULL address and a zero length. 2010-04-08 Phil Muldoon <pmuldoon@redhat.com> * gdb.python/py-value: Add null string variable. (test_lazy_string): Test zero length, NULL address lazy strings.
2010-01-142010-01-13 Phil Muldoon <pmuldoon@redhat.com>Phil Muldoon1-0/+2
PR python/10705 * python/python-internal.h: Add lazy_string_object_type definition. (create_lazy_string_object, gdbpy_initialize_lazy_string) (gdbpy_is_lazystring, gdbpy_extract_lazy_string): Define. * python/py-value.c (valpy_lazy_string): New function. (convert_value_from_python): Add lazy string conversion. * python/py-prettyprint.c (pretty_print_one_value): Check if return is also a lazy string. (print_string_repr): Add lazy string printing branch. (print_children): Likewise. * python/py-lazy-string.c: New file. Implement lazy strings. * python/python.c (_initialize_python): Call gdbpy_initialize_lazy_string. * varobj.c (value_get_print_value): Add lazy string printing branch. Account for encoding. * c-lang.c (c_printstr): Account for new encoding argument. If encoding is NULL, find encoding suited for type, otherwise use user encoding. * language.h (language_defn): Add encoding argument. (LA_PRINT_STRING): Likewise. * language.c (unk_lang_printstr): Update to reflect new encoding argument to language_defn. * ada-lang.h (ada_printstr): Likewise. * c-lang.h (c_printstr): Likewise. * p-lang.h (pascal_printstr); * f-lang.c (f_printstr): Likewise. * m2-lang.c (m2_printstr): Likewise. * objc-lang.c (objc_printstr): Likewise. * p-lang.c (pascal_printstr): Likewise. * scm-lang.c (scm_printstr): Likewise. * c-valprint.c (c_val_print): Update LA_PRINT_STRING call for encoding argument. * ada-valprint.c (ada_printstr): Likewise. * f-valprint.c (f_val_print): Likewise * m2-valprint.c (m2_val_print): Likewise. * p-valprint.c (pascal_val_print): Likewise. * expprint.c (print_subexp_standard): Likewise. * valprint.c (val_print_string): Likewise. * Makefile.in (SUBDIR_PYTHON_OBS): Add py-lazy-string. (SUBDIR_PYTHON_SRCS): Likewise. (py-lazy-string.o): New rule. 2010-01-13 Phil Muldoon <pmuldoon@redhat.com> * gdb.texinfo (Values From Inferior): Document lazy_string value method. (Python API): Add Lazy strings menu item. (Lazy Strings In Python): New node. 2010-01-13 Phil Muldoon <pmuldoon@redhat.com> * gdb.python/py-value.exp (test_lazy_strings): Add lazy string test. * gdb.python/py-prettyprint.py (pp_ls): New printer. * gdb.python/py-prettyprint.exp (run_lang_tests): Add lazy string test. * gdb.python/py-prettyprint.c: Define lazystring test structure. * gdb.python/py-mi.exp: Add lazy string test.
2010-01-01Update copyright year in most headers.Joel Brobecker1-1/+1
Automatic update by copyright.sh.
2009-09-212009-09-21 Phil Muldoon <pmuldoon@redhat.com>Phil Muldoon1-0/+15
* python/py-value.c (valpy_getitem): Test value before allowing subscript operation. 2009-09-21 Phil Muldoon <pmuldoon@redhat.com> * gdb.python/py-value.exp (test_subscript_regression): New function. Test for invalid subscripts. * gdb.python/py-value.c (main): Add test array, and pointer to it. (ptr_ref): New function.
2009-09-09Checking in this patch for Thiago: Rename python-* files into py-*,Joel Brobecker1-0/+55
more 8+3 friendly. gdb/ * Makefile.in (py-cmd.o): Renamed from python-cmd.o. Updated references. (py-frame.o): Renamed from python-frame.o. Updated references. (py-function.o): Renamed from python-function.o. Updated references. (py-objfile.o): Renamed from python-objfile.o. Updated references. (py-prettyprint.o): Renamed from python-prettyprint.o. Updated +references. (py-type.o): Renamed from python-type.o. Updated references. (py-utils.o): Renamed from python-utils.o. Updated references. (py-value.o): Renamed from python-value.o. Updated references. * py-cmd.o: Renamed from python-cmd.o. * py-frame.o: Renamed from python-frame.o. * py-function.o: Renamed from python-function.o. * py-objfile.o: Renamed from python-objfile.o. * py-prettyprint.o: Renamed from python-prettyprint.o. * py-type.o: Renamed from python-type.o. * py-utils.o: Renamed from python-utils.o. * py-value.o: Renamed from python-value.o. gdb/testsuite/ * gdb.python/Makefile.in (EXECUTABLES): Adjust to new executable names, add missing ones. * gdb.python/py-cmd.exp: Rename from python-cmd.exp. * gdb.python/py-frame.c: Rename from python-frame.c. * gdb.python/py-frame.exp: Rename from python-frame.exp. Adjust testfile name. * gdb.python/py-function.exp: Rename from python-function.exp. * gdb.python/py-mi.exp: Rename from python-mi.exp. Adjust testfile name. * gdb.python/py-prettyprint.c: Rename from python-prettyprint.c. * gdb.python/py-prettyprint.exp: Rename from python-prettyprint.exp. Adjust testfile name. * gdb.python/py-prettyprint.py: Rename from python-prettyprint.py. * gdb.python/py-template.cc: Rename from python-template.cc. * gdb.python/py-template.exp: Rename from python-template.exp. Adjust testfile name. * gdb.python/py-value.c: Rename from python-value.c. * gdb.python/py-value.exp: Rename from python-value.exp. Adjust testfile name.