summaryrefslogtreecommitdiff
path: root/gdb/typeprint.h
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright year range in header of all files managed by GDBJoel Brobecker2023-01-011-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.
* Move gdb obstack code to gdbsupportTom Tromey2022-01-181-1/+1
| | | | | | | | This moves the gdb-specific obstack code -- both extensions like obconcat and obstack_strdup, and things like auto_obstack -- to gdbsupport.
* Automatic Copyright Year update after running gdb/copyright.pyJoel Brobecker2022-01-011-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.
* [PR gdb/22640] ptype: add option to use hexadecimal notationLancelot SIX2021-04-251-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds a flag to the ptype command in order to print the offsets and sizes of struct members using the hexadecimal notation. The 'x' flag ensures use of the hexadecimal notation while the 'd' flag ensures use of the decimal notation. The default is to use decimal notation. Before this patch, gdb only uses decimal notation, as pointed out in PR gdb/22640. Here is an example of this new behavior with hex output turned on: (gdb) ptype /ox struct type_print_options /* offset | size */ type = struct type_print_options { /* 0x0000: 0x0 | 0x0004 */ unsigned int raw : 1; /* 0x0000: 0x1 | 0x0004 */ unsigned int print_methods : 1; /* 0x0000: 0x2 | 0x0004 */ unsigned int print_typedefs : 1; /* 0x0000: 0x3 | 0x0004 */ unsigned int print_offsets : 1; /* 0x0000: 0x4 | 0x0004 */ unsigned int print_in_hex : 1; /* XXX 3-bit hole */ /* XXX 3-byte hole */ /* 0x0004 | 0x0004 */ int print_nested_type_limit; /* 0x0008 | 0x0008 */ typedef_hash_table *local_typedefs; /* 0x0010 | 0x0008 */ typedef_hash_table *global_typedefs; /* 0x0018 | 0x0008 */ ext_lang_type_printers *global_printers; /* total size (bytes): 32 */ } This patch also adds the 'set print type hex' and 'show print type hex' commands in order to set and inspect the default behavior regarding the use of decimal or hexadecimal notation when printing struct sizes and offsets. Tested using on x86_64. gdb/ChangeLog: PR gdb/22640 * typeprint.h (struct type_print_options): Add print_in_hex flag. (struct print_offset_data): Add print_in_hex flag, add a constructor accepting a type_print_options* argument. * typeprint.c (type_print_raw_options, default_ptype_flags): Set default value for print_in_hex. (print_offset_data::indentation): Allow more horizontal space. (print_offset_data::print_offset_data): Add ctor. (print_offset_data::maybe_print_hole, print_offset_data::update): Handle the print_in_hex flag. (whatis_exp): Handle 'x' and 'd' flags. (print_offsets_and_sizes_in_hex): Declare. (set_print_offsets_and_sizes_in_hex): Create. (show_print_offsets_and_sizes_in_hex): Create. (_initialize_typeprint): Update help message for the ptype command, register the 'set print type hex' and 'show print type hex' commands. * c-typeprint.c (c_print_type, c_type_print_base_struct_union) (c_type_print_base): Construct the print_offset_data object using the type_print_optons parameter. * rust-lang.c (rust_language::print_type): Construct the print_offset_data object using the type_print_optons parameter. * NEWS: Mention the new flags of the ptype command. gdb/doc/ChangeLog: PR gdb/22640 * gdb.texinfo (Symbols): Describe the 'x' and 'd' flags of the ptype command, describe 'set print type hex' and 'show print type hex' commands. Update 'ptype/o' examples. gdb/testsuite/ChangeLog: PR gdb/22640 * gdb.base/ptype-offsets.exp: Add tests to verify the behavior of 'ptype/ox' and 'ptype/od'. Check that 'set print type hex' changes the default behavior of 'ptype/o'. Update to take into account new horizontal layout. * gdb.rust/simple.exp: Update ptype test to check new horizontal layout. * gdb.rust/union.exp: Same.
* gdb/typeprint.h: reorder struct declarationLancelot SIX2021-04-251-30/+30
| | | | | | | | | | | | Move the declaration of struct type_print_raw_options before struct print_offset_data to ease upcoming changes. This is a helper commit intended to make it easier to build a print_offset_data object from configurations given by a type_print_raw_options. gdb/ChangeLog: * typeprint.h (struct type_print_options): Move before print_offset_data.
* Update copyright year range in all GDB filesJoel Brobecker2021-01-011-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.
* Add ptype support for DWARF-based fixed-point typesJoel Brobecker2020-11-151-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Note that the ptype information printed for types described via pure DWARF debug info is slightly less informative as the one printed when the information is encoded in the type's name, via the GNAT encoding. As a result, the output in the case of DWARF-described fixed point types is slightly different. In pratice, this is no real loss because the information not available in DWARF has no bearing on how the type is actually stored in memory. gdb/ChangeLog: * ada-typeprint.c (ada_print_type): Add handing of fixed-point range types. * c-typeprint.c (c_type_print_varspec_prefix) (c_type_print_varspec_suffix, c_type_print_base_1): Add TYPE_CODE_FIXED_POINT handling. * p-typeprint.c (pascal_type_print_varspec_prefix) (pascal_type_print_varspec_suffix): Likewise. * typeprint.c (print_type_fixed_point): New function. * typeprint.h (print_type_fixed_point): Add declaration. gdb/testsuite/ChangeLog: * gdb.ada/fixed_points.exp: Add ptype tests. * gdb.dwarf2/dw2-fixed-point.exp: Likewise.
* Use htab_up in typedef_hash_tableTom Tromey2020-09-171-3/+1
| | | | | | | | | | | | | | | | | | | This changes typedef_hash_table to use htab_up rather than explicit calls to htab_delete. gdb/ChangeLog 2020-09-17 Tom Tromey <tom@tromey.com> * typeprint.h (class typedef_hash_table) <~typedef_hash_table>: Remove. <m_table>: Now htab_up. * typeprint.c (typedef_hash_table::recursively_update) (typedef_hash_table::add_template_parameters) (typedef_hash_table::typedef_hash_table): Update. (typedef_hash_table::~typedef_hash_table): Remove. (typedef_hash_table::typedef_hash_table) (typedef_hash_table::find_global_typedef) (typedef_hash_table::find_typedef): Update.
* Update copyright year range in all GDB files.Joel Brobecker2020-01-011-1/+1
| | | | | | gdb/ChangeLog: Update copyright year range in all GDB files.
* Update copyright year range in all GDB files.Joel Brobecker2019-01-011-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.
* Move ptype/o printing code to typeprint.cTom Tromey2018-06-261-0/+33
| | | | | | | | | | | | | | | | | | | | | | This moves the hole-printing support code for ptype/o from c-typeprint.c to be methods on print_offset_data. This allows the code to be used from non-C languages. gdb/ChangeLog 2018-06-26 Tom Tromey <tom@tromey.com> * typeprint.h (struct print_offset_data) <update, finish, maybe_print_hole>: New methods. <indentation>: New constant. * typeprint.c (print_offset_data::indentation): Define. (print_offset_data::maybe_print_hole, print_offset_data::update) (print_offset_data::finish): Move from c-typeprint.c and rename. * c-typeprint.c (OFFSET_SPC_LEN): Remove. (print_spaces_filtered_with_print_options): Update. (c_print_type_union_field_offset, maybe_print_hole) (c_print_type_struct_field_offset): Move to typeprint.c and rename. (c_type_print_base_struct_union): Update.
* Make c_type_print_varspec_suffix staticTom Tromey2018-06-011-3/+0
| | | | | | | | | | | I noticed that c_type_print_varspec_suffix is only called from c-typeprint.c, so this patch makes it "static". gdb/ChangeLog 2018-06-01 Tom Tromey <tom@tromey.com> * typeprint.h (c_type_print_varspec_suffix): Don't declare. * c-typeprint.c (c_type_print_varspec_suffix): Now static.
* C++-ify typedef hashTom Tromey2018-03-271-11/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes the typedef_hash_table structure to be a C++ class. It adds constructors and destructors and changes some functions to be methods of the class. Then it changes the various users of this class to adapt. This allows for the removal of some cleanups. Regression tested by the buildbot. gdb/ChangeLog 2018-03-27 Tom Tromey <tom@tromey.com> * typeprint.h (struct type_print_options) <local_typedefs, global_typedefs>: Remove "struct" keyword. (class typedef_hash_table): New class. (recursively_update_typedef_hash, add_template_parameters) (create_typedef_hash, free_typedef_hash, copy_typedef_hash) (find_typedef_in_hash): Don't declare. * typeprint.c (struct typedef_hash_table): Move to typeprint.h. (typedef_hash_table::recursively_update): Rename from recursively_update_typedef_hash. Now a member. (typedef_hash_table::add_template_parameters): Rename from add_template_parameters. Now a member. (typedef_hash_table::typedef_hash_table): Now a constructor; rename from create_typedef_hash. (typedef_hash_table::~typedef_hash_table): Now a destructor; rename from free_typedef_hash. (do_free_typedef_hash, make_cleanup_free_typedef_hash) (do_free_global_table): Remove. (typedef_hash_table::typedef_hash_table): New constructor; renamed from copy_type_recursive. (create_global_typedef_table): Remove. (typedef_hash_table::find_global_typedef): Now a member of typedef_hash_table. (typedef_hash_table::find_typedef): Rename from find_typedef_in_hash; now a member. (whatis_exp): Update. * extension.h (struct ext_lang_type_printers): Add constructor and destructor. (start_ext_lang_type_printers, free_ext_lang_type_printers): Don't declare. * extension.c (ext_lang_type_printers::ext_lang_type_printers): Now a constructor; rename from start_ext_lang_type_printers. (ext_lang_type_printers): Now a destructor; rename from free_ext_lang_type_printers. * c-typeprint.c (find_typedef_for_canonicalize, c_print_type_1): Update. (c_type_print_base_struct_union): Update. Remove cleanups.
* Update copyright year range in all GDB filesJoel Brobecker2018-01-021-1/+1
| | | | | | gdb/ChangeLog: Update copyright year range in all GDB files
* Implement pahole-like 'ptype /o' optionSergio Durigan Junior2017-12-151-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit implements the pahole-like '/o' option for 'ptype', which prints the offsets and sizes of struct fields, reporting whenever there is a hole found. The output is heavily based on pahole(1), with a few modifications here and there to adjust it to our reality. Here's an example: /* offset | size */ type = struct wer : public tuv { public: /* 32 | 24 */ struct tyu { /* 32:31 | 4 */ int a1 : 1; /* 32:28 | 4 */ int a2 : 3; /* 32: 5 | 4 */ int a3 : 23; /* 35: 3 | 1 */ char a4 : 2; /* XXX 3-bit hole */ /* XXX 4-byte hole */ /* 40 | 8 */ int64_t a5; /* 48:27 | 4 */ int a6 : 5; /* 48:56 | 8 */ int64_t a7 : 3; /* total size (bytes): 24 */ } a1; /* total size (bytes): 56 */ } A big part of this patch handles the formatting logic of 'ptype', which is a bit messy. The code to handle bitfield offsets, however, took some time to craft. My thanks to Pedro Alves for figuring things out and pointing me to the right direction, as well as coming up with a way to inspect the layout of structs with bitfields (see testcase for comments). After many discussions both on IRC and at the mailing list, I tried to implement printing vtables and inherited classes. Unfortunately the code grew too complex and there were still a few corner cases failing so I had to drop the attempt. This should be implemented in a future patch. This patch is the start of a long-term work I'll do to flush the local patches we carry for Fedora GDB. In this specific case, I'm aiming at upstreaming the feature implemented by the 'pahole.py' script that is shipped with Fedora GDB: <https://src.fedoraproject.org/rpms/gdb/blob/master/f/gdb-archer.patch#_311> This has been regression-tested on the BuildBot. There's a new testcase for it, along with an update to the documentation. I also thought it was worth mentioning this feature in the NEWS file. gdb/ChangeLog: 2017-12-15 Sergio Durigan Junior <sergiodj@redhat.com> Pedro Alves <palves@redhat.com> PR cli/16224 * NEWS (Changes since GDB 8.0): Mention new '/o' flag. * c-typeprint.c (OFFSET_SPC_LEN): New define. (c_type_print_varspec_prefix): New argument 'struct print_offset_data *'. (c_type_print_base_1): New function and prototype. (c_print_type_1): New function, with code from 'c_print_type'. (c_print_type): Use 'c_print_type_1'. (c_type_print_varspec_prefix): New argument 'struct print_offset_data *'. Use it. Call 'c_type_print_base_1' instead of 'c_print_type_base'. (print_spaces_filtered_with_print_options): New function. (output_access_specifier): Take new argument FLAGS. Modify function to call 'print_spaces_filtered_with_print_options'. (c_print_type_vtable_offset_marker): New function. (c_print_type_union_field_offset): New function. (c_print_type_struct_field_offset): New function. (c_print_type_no_offsets): New function. (c_type_print_base_struct_union): New argument 'struct print_offset_data *'. Print offsets and sizes for struct/union/class fields. * typeprint.c (const struct type_print_options type_print_raw_options): Initialize 'print_offsets'. (static struct type_print_options default_ptype_flags): Likewise. (struct print_offset_data print_offset_default_data): New variable. (whatis_exp): Handle '/o' option. (_initialize_typeprint): Add '/o' flag to ptype's help. * typeprint.h (struct print_offset_data): New struct. (struct type_print_options) <print_offsets>: New field. gdb/testsuite/ChangeLog: 2017-12-15 Sergio Durigan Junior <sergiodj@redhat.com> PR cli/16224 * gdb.base/ptype-offsets.cc: New file. * gdb.base/ptype-offsets.exp: New file. gdb/doc/ChangeLog: 2017-12-15 Sergio Durigan Junior <sergiodj@redhat.com> PR cli/16224 * gdb.texinfo (ptype): Add documentation for new flag '/o'.
* Record nested typesKeith Seitz2017-12-071-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GDB currently does not track types defined in classes. Consider: class A { public: class B { public: class C { }; }; }; (gdb) ptype A type = class A { <no data fields> } This patch changes this behavior so that GDB records these nested types and displays them to the user when he has set the (new) "print type" option "nested-type-limit." Example: (gdb) set print type nested-type-limit 1 (gdb) ptype A type = class A { <no data fields> class A::B { <no data fields> }; } (gdb) set print type nested-type-limit 2 type = class A { <no data fields> class A::B { <no data fields> class A::B::C { <no data fields> }; }; } By default, the code maintains the status quo, that is, it will not print any nested type definitions at all. Testing is carried out via cp_ptype_class which required quite a bit of modification to permit recursive calling (for the nested types). This was most easily facilitated by turning the ptype command output into a queue. Upshot: the test suite now has stack and queue data structures that may be used by test writers. gdb/ChangeLog * NEWS (New commands): Mention set/show print type nested-type-limit. * c-typeprint.c (c_type_print_base): Print out nested types. * dwarf2read.c (struct typedef_field_list): Rename to ... (struct decl_field_list): ... this. Change all uses. (struct field_info) <nested_types_list, nested_types_list_count>: New fields. (add_partial_symbol): Look for nested type definitions in C++, too. (dwarf2_add_typedef): Rename to ... (dwarf2_add_type_defn): ... this. (type_can_define_types): New function. Update assertion to use type_can_define_types. Permit NULL for a field's name. (process_structure_scope): Handle child DIEs of types that can define types. Copy the list of nested types into the type struct. * gdbtypes.h (struct typedef_field): Rename to ... (struct decl_field): ... this. Change all uses. [is_protected, is_private]: New fields. (struct cplus_struct_type) <nested_types, nested_types_count>: New fields. (TYPE_NESTED_TYPES_ARRAY, TYPE_NESTED_TYPES_FIELD) (TYPE_NESTED_TYPES_FIELD_NAME, TYPE_NESTED_TYPES_FIELD_TYPE) (TYPE_NESTED_TYPES_COUNT, TYPE_NESTED_TYPES_FIELD_PROTECTED) (TYPE_NESTED_TYPES_FIELD_PRIVATE): New macros. * typeprint.c (type_print_raw_options, default_ptype_flags): Add default value for print_nested_type_limit. (print_nested_type_limit): New static variable. (set_print_type_nested_types, show_print_type_nested_types): New functions. (_initialize_typeprint): Register new commands for set/show `print-nested-type-limit'. * typeprint.h (struct type_print_options) [print_nested_type_limit]: New field. gdb/testsuite/ChangeLog * gdb.cp/nested-types.cc: New file. * gdb.cp/nested-types.exp: New file. * lib/cp-support.exp: Load data-structures.exp library. (debug_cp_test_ptype_class): New global. (cp_ptype_class_verbose, next_line): New procedures. (cp_test_ptype_class): Add and document new parameter `recursive_qid'. Add and document new return value. Switch the list of lines to a queue. Add support for new `type' key for nested type definitions. Add debugging/troubleshooting messages. * lib/data-structures.exp: New file. gdb/doc/ChangeLog * gdb.texinfo (Symbols): Document "set print type nested-type-limit" and "show print type nested-type-limit".
* Stop assuming no-debug-info variables have type intPedro Alves2017-09-041-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An earlier commit made GDB no longer assume no-debug-info functions return int. This commit gives the same treatment to variables. Currently, you can end misled by GDB over output like this: (gdb) p var $1 = -1 (gdb) p /x var $2 = 0xffffffff until you realize that GDB is assuming that the variable is an "int", because: (gdb) ptype var type = <data variable, no debug info> You may try to fix it by casting, but that doesn't really help: (gdb) p /x (unsigned long long) var $3 = 0xffffffffffffffff # incorrect ^^ That's incorrect output, because the variable was defined like this: uint64_t var = 0x7fffffffffffffff; ^^ What happened is that with the cast, GDB did an int -> 'unsigned long long' conversion instead of reinterpreting the variable as the cast-to type. To get at the variable properly you have to reinterpret the variable's address manually instead, with either: (gdb) p /x *(unsigned long long *) &var $4 = 0x7fffffffffffffff (gdb) p /x {unsigned long long} &var $5 = 0x7fffffffffffffff After this commit GDB does it for you. This is what you'll get instead: (gdb) p var 'var' has unknown type; cast it to its declared type (gdb) p /x (unsigned long long) var $1 = 0x7fffffffffffffff As in the functions patch, the "compile" machinery doesn't currently have the cast-to type handy, so it continues assuming no-debug variables have int type, though now at least it warns. The change to gdb.cp/m-static.exp deserves an explanation: - gdb_test "print 'gnu_obj_1::method()::sintvar'" "\\$\[0-9\]+ = 4" \ + gdb_test "print (int) 'gnu_obj_1::method()::sintvar'" "\\$\[0-9\]+ = 4" \ That's printing the "sintvar" function local static of the "gnu_obj_1::method()" method. The problem with that test is that that "'S::method()::static_var'" syntax doesn't really work in C++ as you'd expect. The way to make it work correctly currently is to quote the method part, not the whole expression, like: (gdb) print 'gnu_obj_1::method()'::sintvar If you wrap the whole expression in quotes, like in m-static.exp, what really happens is that the parser considers the whole string as a symbol name, but there's no debug symbol with that name. However, local statics have linkage and are given a mangled name that demangles to the same string as the full expression, so that's what GDB prints. After this commit, and without the cast, the print in m-static.exp would error out saying that the variable has unknown type: (gdb) p 'gnu_obj_1::method()::sintvar' 'gnu_obj_1::method()::sintvar' has unknown type; cast it to its declared type TBC, if currently (even before this series) you try to print any function local static variable of type other than int, you'll get bogus results. You can see that with m-static.cc as is, even. Printing the "svar" local, which is a boolean (1 byte) still prints as "int" (4 bytes): (gdb) p 'gnu_obj_1::method()::svar' $1 = 1 (gdb) ptype 'gnu_obj_1::method()::svar' type = <data variable, no debug info> This probably prints some random bogus value on big endian machines. If 'svar' was of some aggregate type (etc.) we'd still print it as int, so the problem would have been more obvious... After this commit, you'll get instead: (gdb) p 'gnu_obj_1::method()::svar' 'gnu_obj_1::method()::svar' has unknown type; cast it to its declared type ... so at least GDB is no longer misleading. Making GDB find the real local static debug symbol is the subject of the following patches. In the end, it'll all "Just Work". gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ax-gdb.c: Include "typeprint.h". (gen_expr_for_cast): New function. (gen_expr) <OP_CAST, OP_CAST_TYPE>: Use it. <OP_VAR_VALUE, OP_MSYM_VAR_VALUE>: Error out if the variable's type is unknown. * dwarf2read.c (new_symbol_full): Fallback to int instead of nodebug_data_symbol. * eval.c: Include "typeprint.h". (evaluate_subexp_standard) <OP_VAR_VALUE, OP_VAR_MSYM_VALUE>: Error out if symbol has unknown type. <UNOP_CAST, UNOP_CAST_TYPE>: Common bits factored out to evaluate_subexp_for_cast. (evaluate_subexp_for_address, evaluate_subexp_for_sizeof): Handle OP_VAR_MSYM_VALUE. (evaluate_subexp_for_cast): New function. * gdbtypes.c (init_nodebug_var_type): New function. (objfile_type): Use it to initialize types of variables with no debug info. * typeprint.c (error_unknown_type): New. * typeprint.h (error_unknown_type): New declaration. * compile/compile-c-types.c (convert_type_basic): Handle TYPE_CODE_ERROR; warn and fallback to int for variables with unknown type. gdb/testsuite/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * gdb.asm/asm-source.exp: Add casts to int. * gdb.base/nodebug.c (dataglobal8, dataglobal32_1, dataglobal32_2) (dataglobal64_1, dataglobal64_2): New globals. * gdb.base/nodebug.exp: Test different expressions involving the new globals, with print, whatis and ptype. Add casts to int. * gdb.base/solib-display.exp: Add casts to int. * gdb.compile/compile-ifunc.exp: Expect warning. Add cast to int. * gdb.cp/m-static.exp: Add cast to int. * gdb.dwarf2/dw2-skip-prologue.exp: Add cast to int. * gdb.threads/tls-nodebug.exp: Check that gdb errors out printing tls variable with no debug info without a cast. Test with a cast to int too. * gdb.trace/entry-values.exp: Add casts.
* Stop assuming no-debug-info functions return intPedro Alves2017-09-041-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fact that GDB defaults to assuming that functions return int, when it has no debug info for the function has been a recurring source of user confusion. Recently this came up on the errno pretty printer discussions. Shortly after, it came up again on IRC, with someone wondering why does getenv() in GDB return a negative int: (gdb) p getenv("PATH") $1 = -6185 This question (with s/getenv/random-other-C-runtime-function) is a FAQ on IRC. The reason for the above is: (gdb) p getenv $2 = {<text variable, no debug info>} 0x7ffff7751d80 <getenv> (gdb) ptype getenv type = int () ... which means that GDB truncated the 64-bit pointer that is actually returned from getent to 32-bit, and then sign-extended it: (gdb) p /x -6185 $6 = 0xffffe7d7 The workaround is to cast the function to the right type, like: (gdb) p ((char *(*) (const char *)) getenv) ("PATH") $3 = 0x7fffffffe7d7 "/usr/local/bin:/"... IMO, we should do better than this. I see the "assume-int" issue the same way I see printing bogus values for optimized-out variables instead of "<optimized out>" -- I'd much rather that the debugger tells me "I don't know" and tells me how to fix it than showing me bogus misleading results, making me go around tilting at windmills. If GDB prints a signed integer when you're expecting a pointer or aggregate, you at least have some sense that something is off, but consider the case of the function actually returning a 64-bit integer. For example, compile this without debug info: unsigned long long function () { return 0x7fffffffffffffff; } Currently, with pristine GDB, you get: (gdb) p function () $1 = -1 # incorrect (gdb) p /x function () $2 = 0xffffffff # incorrect maybe after spending a few hours debugging you suspect something is wrong with that -1, and do: (gdb) ptype function type = int () and maybe, just maybe, you realize that the function actually returns unsigned long long. And you try to fix it with: (gdb) p /x (unsigned long long) function () $3 = 0xffffffffffffffff # incorrect ... which still produces the wrong result, because GDB simply applied int to unsigned long long conversion. Meaning, it sign-extended the integer that it extracted from the return of the function, to 64-bits. and then maybe, after asking around on IRC, you realize you have to cast the function to a pointer of the right type, and call that. It won't be easy, but after a few missteps, you'll get to it: ..... (gdb) p /x ((unsigned long long(*) ()) function) () $666 = 0x7fffffffffffffff # finally! :-) So to improve on the user experience, this patch does the following (interrelated) things: - makes no-debug-info functions no longer default to "int" as return type. Instead, they're left with NULL/"<unknown return type>" return type. (gdb) ptype getenv type = <unknown return type> () - makes calling a function with unknown return type an error. (gdb) p getenv ("PATH") 'getenv' has unknown return type; cast the call to its declared return type - and then to make it easier to call the function, makes it possible to _only_ cast the return of the function to the right type, instead of having to cast the function to a function pointer: (gdb) p (char *) getenv ("PATH") # now Just Works $3 = 0x7fffffffe7d7 "/usr/local/bin:/"... (gdb) p ((char *(*) (const char *)) getenv) ("PATH") # continues working $4 = 0x7fffffffe7d7 "/usr/local/bin:/"... I.e., it makes GDB default the function's return type to the type of the cast, and the function's parameters to the type of the arguments passed down. After this patch, here's what you'll get for the "unsigned long long" example above: (gdb) p function () 'function' has unknown return type; cast the call to its declared return type (gdb) p /x (unsigned long long) function () $4 = 0x7fffffffffffffff # correct! Note that while with "print" GDB shows the name of the function that has the problem: (gdb) p getenv ("PATH") 'getenv' has unknown return type; cast the call to its declared return type which can by handy in more complicated expressions, "ptype" does not: (gdb) ptype getenv ("PATH") function has unknown return type; cast the call to its declared return type This will be fixed in the next patch. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ada-lang.c (ada_evaluate_subexp) <TYPE_CODE_FUNC>: Don't handle TYPE_GNU_IFUNC specially here. Throw error if return type is unknown. * ada-typeprint.c (print_func_type): Handle functions with unknown return type. * c-typeprint.c (c_type_print_base): Handle functions and methods with unknown return type. * compile/compile-c-symbols.c (convert_symbol_bmsym) <mst_text_gnu_ifunc>: Use nodebug_text_gnu_ifunc_symbol. * compile/compile-c-types.c: Include "objfiles.h". (convert_func): For functions with unknown return type, warn and default to int. * compile/compile-object-run.c (compile_object_run): Adjust call to call_function_by_hand_dummy. * elfread.c (elf_gnu_ifunc_resolve_addr): Adjust call to call_function_by_hand. * eval.c (evaluate_subexp_standard): Adjust calls to call_function_by_hand. Handle functions and methods with unknown return type. Pass expect_type to call_function_by_hand. * f-typeprint.c (f_type_print_base): Handle functions with unknown return type. * gcore.c (call_target_sbrk): Adjust call to call_function_by_hand. * gdbtypes.c (objfile_type): Leave nodebug text symbol with NULL return type instead of int. Make nodebug_text_gnu_ifunc_symbol be an integer address type instead of nodebug. * guile/scm-value.c (gdbscm_value_call): Adjust call to call_function_by_hand. * infcall.c (error_call_unknown_return_type): New function. (call_function_by_hand): New "default_return_type" parameter. Pass it down. (call_function_by_hand_dummy): New "default_return_type" parameter. Use it instead of defaulting to int. If there's no default and the return type is unknown, throw an error. If there's a default return type, and the called function has no debug info, then assume the function is prototyped. * infcall.h (call_function_by_hand, call_function_by_hand_dummy): New "default_return_type" parameter. (error_call_unknown_return_type): New declaration. * linux-fork.c (call_lseek): Cast return type of lseek. (inferior_call_waitpid, checkpoint_command): Adjust calls to call_function_by_hand. * linux-tdep.c (linux_infcall_mmap, linux_infcall_munmap): Adjust calls to call_function_by_hand. * m2-typeprint.c (m2_procedure): Handle functions with unknown return type. * objc-lang.c (lookup_objc_class, lookup_child_selector) (value_nsstring, print_object_command): Adjust calls to call_function_by_hand. * p-typeprint.c (pascal_type_print_varspec_prefix): Handle functions with unknown return type. (pascal_type_print_func_varspec_suffix): New function. (pascal_type_print_varspec_suffix) <TYPE_CODE_FUNC, TYPE_CODE_METHOD>: Use it. * python/py-value.c (valpy_call): Adjust call to call_function_by_hand. * rust-lang.c (rust_evaluate_funcall): Adjust call to call_function_by_hand. * valarith.c (value_x_binop, value_x_unop): Adjust calls to call_function_by_hand. * valops.c (value_allocate_space_in_inferior): Adjust call to call_function_by_hand. * typeprint.c (type_print_unknown_return_type): New function. * typeprint.h (type_print_unknown_return_type): New declaration. gdb/testsuite/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * gdb.base/break-main-file-remove-fail.exp (test_remove_bp): Cast return type of munmap in infcall. * gdb.base/break-probes.exp: Cast return type of foo in infcall. * gdb.base/checkpoint.exp: Simplify using for loop. Cast return type of ftell in infcall. * gdb.base/dprintf-detach.exp (dprintf_detach_test): Cast return type of getpid in infcall. * gdb.base/infcall-exec.exp: Cast return type of execlp in infcall. * gdb.base/info-os.exp: Cast return type of getpid in infcall. Bail on failure to extract the pid. * gdb.base/nodebug.c: #include <stdint.h>. (multf, multf_noproto, mult, mult_noproto, add8, add8_noproto): New functions. * gdb.base/nodebug.exp (test_call_promotion): New procedure. Change expected output of print/whatis/ptype with functions with no debug info. Test all supported languages. Call test_call_promotion. * gdb.compile/compile.exp: Adjust expected output to expect warning. * gdb.threads/siginfo-threads.exp: Likewise.
* update copyright year range in GDB filesJoel Brobecker2017-01-011-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.
* GDB copyright headers update after running GDB's copyright.py script.Joel Brobecker2016-01-011-1/+1
| | | | | | gdb/ChangeLog: Update year range in copyright notice of all files.
* fort_dyn_array: add basic fortran dyn array supportKeven Boell2015-10-211-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fortran provide types whose values may be dynamically allocated or associated with a variable under explicit program control. The purpose of this commit is: * to read allocated/associated DWARF tags and store them in the dynamic property list of main_type. * enable GDB to print the value of a dynamic array in Fortran in case the type is allocated or associated (pointer to dynamic array). Examples: (gdb) p vla_not_allocated $1 = <not allocated> (gdb) p vla_allocated $1 = (1, 2, 3) (gdb) p vla_ptr_not_associated $1 = <not associated> (gdb) p vla_ptr_associated $1 = (1, 2, 3) Add basic test coverage for most dynamic array use-cases in Fortran. The commit contains the following tests: * Ensure that values of Fortran dynamic arrays can be evaluated correctly in various ways and states. * Ensure that Fortran primitives can be evaluated correctly when used as a dynamic array. * Dynamic arrays passed to subroutines and handled in different ways inside the routine. * Ensure that the ptype of dynamic arrays in Fortran can be printed in GDB correctly. * Ensure that dynamic arrays in different states (allocated/associated) can be evaluated. * Dynamic arrays passed to functions and returned from functions. * History values of dynamic arrays can be accessed and printed again with the correct values. * Dynamic array evaluations using MI protocol. * Sizeof output of dynamic arrays in various states. The patch was tested using the test suite on Ubuntu 12.04 64bit. gdb/ChangeLog: * dwarf2read.c (set_die_type): Add read of DW_AT_allocated and DW_AT_associated. * f-typeprint.c: New include of typeprint.h (f_print_type): Add check for allocated/associated status of type. (f_type_print_varspec_suffix): Add check for allocated/associated status of type. * gdbtypes.c (create_array_type_with_stride): Add check for valid data location of type in case allocated or associated attributes are set. Length of an array should be only calculated if allocated or associated is resolved as true. (is_dynamic_type_internal): Add check for allocated/ associated. (resolve_dynamic_array): Evaluate allocated/associated properties. * gdbtypes.h (enum dynamic_prop_node_kind): <DYN_PROP_ALLOCATED> <DYN_PROP_ASSOCIATED>: New enums. (TYPE_ALLOCATED_PROP, TYPE_ASSOCIATED_PROP): New macros. (type_not_allocated): New function. (type_not_associated): New function. * valarith.c (value_subscripted_rvalue): Add check for allocated/associated. * valprint.c: New include of typeprint.h. (valprint_check_validity): Add check for allocated/associated. (value_check_printable): Add check for allocated/ associated. * typeprint.h (val_print_not_allocated): New function. (val_print_not_associated): New function. * typeprint.c (val_print_not_allocated): New function. (val_print_not_associated): New function. gdb/testsuite/ChangeLog: * gdb.fortran/vla-alloc-assoc.exp: New file. * gdb.fortran/vla-datatypes.exp: New file. * gdb.fortran/vla-datatypes.f90: New file. * gdb.fortran/vla-history.exp: New file. * gdb.fortran/vla-ptype-sub.exp: New file. * gdb.fortran/vla-ptype.exp: New file. * gdb.fortran/vla-sizeof.exp: New file. * gdb.fortran/vla-sub.f90: New file. * gdb.fortran/vla-value-sub-arbitrary.exp: New file. * gdb.fortran/vla-value-sub-finish.exp: New file. * gdb.fortran/vla-value-sub.exp: New file. * gdb.fortran/vla-value.exp: New file. * gdb.fortran/vla-ptr-info.exp: New file. * gdb.mi/mi-vla-fortran.exp: New file. * gdb.mi/vla.f90: New file.
* Update year range in copyright notice of all files owned by the GDB project.Joel Brobecker2015-01-011-1/+1
| | | | | | gdb/ChangeLog: Update year range in copyright notice of all files.
* Extension Language APIDoug Evans2014-02-051-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac (libpython checking): Remove all but python.o from CONFIG_OBS. Remove all but python.c from CONFIG_SRCS. * configure: Regenerate. * Makefile.in (SFILES): Add extension.c. (HFILES_NO_SRCDIR): Add extension.h, extension-priv.h (COMMON_OBS): Add extension.o. * extension.h: New file. * extension-priv.h: New file. * extension.c: New file. * python/python-internal.h: #include "extension.h". (gdbpy_auto_load_enabled): Declare. (gdbpy_apply_val_pretty_printer): Declare. (gdbpy_apply_frame_filter): Declare. (gdbpy_preserve_values): Declare. (gdbpy_breakpoint_cond_says_stop): Declare. (gdbpy_breakpoint_has_cond): Declare. (void source_python_script_for_objfile): Delete. * python/python.c: #include "extension-priv.h". Delete inclusion of "observer.h". (extension_language_python): Moved here and renamed from script_language_python in py-auto-load.c. Redefined to be of type extension_language_defn. (python_extension_script_ops): New global. (python_extension_ops): New global. (struct python_env): New member previous_active. (restore_python_env): Call restore_active_ext_lang. (ensure_python_env): Call set_active_ext_lang. (gdbpy_clear_quit_flag): Renamed from clear_quit_flag, made static. New arg extlang. (gdbpy_set_quit_flag): Renamed from set_quit_flag, made static. New arg extlang. (gdbpy_check_quit_flag): Renamed from check_quit_flag, made static. New arg extlang. (gdbpy_eval_from_control_command): Renamed from eval_python_from_control_command, made static. New arg extlang. (gdbpy_source_script) Renamed from source_python_script, made static. New arg extlang. (gdbpy_before_prompt_hook): Renamed from before_prompt_hook. Change result to int. New arg extlang. (gdbpy_source_objfile_script): Renamed from source_python_script_for_objfile, made static. New arg extlang. (gdbpy_start_type_printers): Renamed from start_type_printers, made static. New args extlang, extlang_printers. Change result type to "void". (gdbpy_apply_type_printers): Renamed from apply_type_printers, made static. New arg extlang. Rename arg printers to extlang_printers and change type to ext_lang_type_printers *. (gdbpy_free_type_printers): Renamed from free_type_printers, made static. Replace argument arg with extlang, extlang_printers. (!HAVE_PYTHON, eval_python_from_control_command): Delete. (!HAVE_PYTHON, source_python_script): Delete. (!HAVE_PYTHON, gdbpy_should_stop): Delete. (!HAVE_PYTHON, gdbpy_breakpoint_has_py_cond): Delete. (!HAVE_PYTHON, start_type_printers): Delete. (!HAVE_PYTHON, apply_type_printers): Delete. (!HAVE_PYTHON, free_type_printers): Delete. (_initialize_python): Delete call to observer_attach_before_prompt. (finalize_python): Set/restore active extension language. (gdbpy_finish_initialization) Renamed from finish_python_initialization, made static. New arg extlang. (gdbpy_initialized): New function. * python/python.h: #include "extension.h". Delete #include "value.h", "mi/mi-cmds.h". (extension_language_python): Declare. (GDBPY_AUTO_FILE_NAME): Delete. (enum py_bt_status): Moved to extension.h and renamed to ext_lang_bt_status. (enum frame_filter_flags): Moved to extension.h. (enum py_frame_args): Moved to extension.h and renamed to ext_lang_frame_args. (finish_python_initialization): Delete. (eval_python_from_control_command): Delete. (source_python_script): Delete. (apply_val_pretty_printer): Delete. (apply_frame_filter): Delete. (preserve_python_values): Delete. (gdbpy_script_language_defn): Delete. (gdbpy_should_stop, gdbpy_breakpoint_has_py_cond): Delete. (start_type_printers, apply_type_printers, free_type_printers): Delete. * auto-load.c: #include "extension.h". (GDB_AUTO_FILE_NAME): Delete. (auto_load_gdb_scripts_enabled): Make public. New arg extlang. (script_language_gdb): Delete, moved to extension.c and renamed to extension_language_gdb. (source_gdb_script_for_objfile): Delete. (auto_load_pspace_info): New member unsupported_script_warning_printed. (loaded_script): Change type of language member to struct extension_language_defn *. (init_loaded_scripts_info): Initialize unsupported_script_warning_printed. (maybe_add_script): Make static. Change type of language arg to struct extension_language_defn *. (clear_section_scripts): Reset unsupported_script_warning_printed. (auto_load_objfile_script_1): Rewrite to use extension language API. (auto_load_objfile_script): Make public. Remove support-compiled-in and auto-load-enabled checks, moved to auto_load_scripts_for_objfile. (source_section_scripts): Rewrite to use extension language API. (load_auto_scripts_for_objfile): Rewrite to use auto_load_scripts_for_objfile. (collect_matching_scripts_data): Change type of language member to struct extension_language_defn *. (auto_load_info_scripts): Change type of language arg to struct extension_language_defn *. (unsupported_script_warning_print): New function. (script_not_found_warning_print): Make static. (_initialize_auto_load): Rewrite construction of scripts-directory help. * auto-load.h (struct objfile): Add forward decl. (struct script_language): Delete. (struct auto_load_pspace_info): Add forward decl. (struct extension_language_defn): Add forward decl. (maybe_add_script): Delete. (auto_load_objfile_script): Declare. (script_not_found_warning_print): Delete. (auto_load_info_scripts): Update prototype. (auto_load_gdb_scripts_enabled): Declare. * python/py-auto-load.c (gdbpy_auto_load_enabled): Renamed from auto_load_python_scripts_enabled and made public. (script_language_python): Delete, moved to python.c. (gdbpy_script_language_defn): Delete. (info_auto_load_python_scripts): Update to use extension_language_python. * breakpoint.c (condition_command): Replace call to gdbpy_breakpoint_has_py_cond with call to get_breakpoint_cond_ext_lang. (bpstat_check_breakpoint_conditions): Replace call to gdbpy_should_stop with call to breakpoint_ext_lang_cond_says_stop. * python/py-breakpoint.c (gdbpy_breakpoint_cond_says_stop): Renamed from gdbpy_should_stop. Change result type to enum scr_bp_stop. New arg slang. Return SCR_BP_STOP_UNSET if py_bp_object is NULL. (gdbpy_breakpoint_has_cond): Renamed from gdbpy_breakpoint_has_py_cond. New arg slang. (local_setattro): Print name of extension language with existing stop condition. * valprint.c (val_print, value_print): Update to call apply_ext_lang_val_pretty_printer. * cp-valprint.c (cp_print_value): Update call to apply_ext_lang_val_pretty_printer. * python/py-prettyprint.c: Remove #ifdef HAVE_PYTHON. (gdbpy_apply_val_pretty_printer): Renamed from apply_val_pretty_printer. New arg extlang. (!HAVE_PYTHON, apply_val_pretty_printer): Delete. * cli/cli-cmds.c (source_script_from_stream): Rewrite to use extension language API. * cli/cli-script.c (execute_control_command): Update to call eval_ext_lang_from_control_command. * mi/mi-cmd-stack.c (mi_cmd_stack_list_frames): Update to use enum ext_lang_bt_status values. Update call to apply_ext_lang_frame_filter. (mi_cmd_stack_list_locals): Ditto. (mi_cmd_stack_list_args): Ditto. (mi_cmd_stack_list_variables): Ditto. * mi/mi-main.c: Delete #include "python/python-internal.h". Add #include "extension.h". (mi_cmd_list_features): Replace reference to python internal variable gdb_python_initialized with call to ext_lang_initialized_p. * stack.c (backtrace_command_1): Update to use enum ext_lang_bt_status. Update to use enum ext_lang_frame_args. Update to call apply_ext_lang_frame_filter. * python/py-framefilter.c (extract_sym): Update to use enum ext_lang_bt_status. (extract_value, py_print_type, py_print_value): Ditto. (py_print_single_arg, enumerate_args, enumerate_locals): Ditto. (py_mi_print_variables, py_print_locals, py_print_args): Ditto. (py_print_frame): Ditto. (gdbpy_apply_frame_filter): Renamed from apply_frame_filter. New arg extlang. Update to use enum ext_lang_bt_status. * top.c (gdb_init): Delete #ifdef HAVE_PYTHON call to finish_python_initialization. Replace with call to finish_ext_lang_initialization. * typeprint.c (do_free_global_table): Update to call free_ext_lang_type_printers. (create_global_typedef_table): Update to call start_ext_lang_type_printers. (find_global_typedef): Update to call apply_ext_lang_type_printers. * typeprint.h (struct ext_lang_type_printers): Add forward decl. (type_print_options): Change type of global_printers from "void *" to "struct ext_lang_type_printers *". * value.c (preserve_values): Update to call preserve_ext_lang_values. * python/py-value.c: Remove #ifdef HAVE_PYTHON. (gdbpy_preserve_values): Renamed from preserve_python_values. New arg extlang. (!HAVE_PYTHON, preserve_python_values): Delete. * utils.c (quit_flag): Delete, moved to extension.c. (clear_quit_flag, set_quit_flag, check_quit_flag): Delete, moved to extension.c. * eval.c: Delete #include "python/python.h". * main.c: Delete #include "python/python.h". * defs.h: Update comment. testsuite/ * gdb.python/py-breakpoint.exp (test_bkpt_eval_funcs): Update expected output. * gdb.gdb/python-interrupts.exp: New file.
* Update Copyright year range in all files maintained by GDB.Joel Brobecker2014-01-011-1/+1
|
* Update years in copyright notice for the GDB files.Joel Brobecker2013-01-011-2/+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.
* * NEWS: Update.Tom Tromey2012-11-121-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * data-directory/Makefile.in (PYTHON_FILES): Add type_printers.py. * python/lib/gdb/command/type_printers.py: New file. * python/lib/gdb/command/types.py (TypePrinter): New class. (_get_some_type_recognizers, get_type_recognizers, apply_type_recognizers, register_type_printer): New functions. * python/py-objfile.c (objfile_object) <type_printers>: New field. (objfpy_dealloc): Decref new field. (objfpy_new): Set new field. (objfpy_get_type_printers, objfpy_set_type_printers): New functions. (objfile_to_objfile_object): Set new field. (objfile_getset): Add "type_printers". * python/py-progspace.c (pspace_object) <type_printers>: New field. (pspy_dealloc): Decref new field. (pspy_new): Set new field. (pspy_get_type_printers, pspy_set_type_printers): New functions. (pspace_to_pspace_object): Set new field. (pspace_getset): Add "type_printers". * python/python.c (start_type_printers, apply_type_printers, free_type_printers): New functions. (_initialize_python): Set gdb.type_printers. * python/python.h (start_type_printers, apply_type_printers, free_type_printers): Declare. * typeprint.c (type_print_raw_options, default_ptype_flags): Update for new fields. (do_free_global_table, create_global_typedef_table, find_global_typedef): New functions. (find_typedef_in_hash): Use find_global_typedef. (whatis_exp): Use create_global_typedef_table. Change cleanup handling. * typeprint.h (struct type_print_options) <global_typedefs, global_printers>: New fields. doc * gdb.texinfo (Symbols): Document "info type-printers", "enable type-printer" and "disable type-printer". (Python API): Add new node to menu. (Type Printing API): New node. (Progspaces In Python): Document type_printers field. (Objfiles In Python): Likewise. (gdb.types) <get_type_recognizers, apply_type_recognizers, register_type_printer, TypePrinter>: Document. testsuite * gdb.base/completion.exp: Update for "info type-printers". * gdb.python/py-typeprint.cc: New file. * gdb.python/py-typeprint.exp: New file. * gdb.python/py-typeprint.py: New file.
* * c-typeprint.c (find_typedef_for_canonicalize,Tom Tromey2012-11-121-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | print_name_maybe_canonical): New functions. (c_print_type): Look up type name. (cp_type_print_derivation_info): Add flags argument. Use print_name_maybe_canonical. (cp_type_print_method_args): Add wrapping. (c_type_print_varspec_prefix): Use print_name_maybe_canonical. (c_type_print_template_args): New function. (c_type_print_base): Change wrapping. Use print_name_maybe_canonical. <TYPE_CODE_STRUCT>: Possibly create a typedef hash, and do type name lookups. * gdbtypes.c (types_equal): No longer static. * gdbtypes.h (types_equal): Declare. * typeprint.c (type_print_raw_options, default_ptype_flags): Update. (struct typedef_hash_table): New. (hash_typedef_field, eq_typedef_field, recursively_update_typedef_hash, add_template_parameters, create_typedef_hash, free_typedef_hash, do_free_typedef_hash, make_cleanup_free_typedef_hash, copy_typedef_hash_element, copy_typedef_hash, find_typedef_in_hash): New functions. * typeprint.h (struct type_print_options) <local_typedefs>: New field. (recursively_update_typedef_hash, add_template_parameters, create_typedef_hash, free_typedef_hash, make_cleanup_free_typedef_hash, copy_typedef_hash, find_typedef_in_hash): Declare. testsuite * gdb.base/call-sc.exp: Use "ptype/r". * gdb.base/volatile.exp: Don't expect "int". * gdb.cp/ptype-flags.cc: New file. * gdb.cp/ptype-flags.exp: New file. * gdb.cp/templates.exp: Use ptype/r. (test_ptype_of_templates, test_template_typedef): Likewise. * lib/cp-support.exp (cp_test_ptype_class): Add in_ptype_arg argument. Handle template names and template parameters. * gdb.mi/mi-var-cmd.exp: Accept "long". * gdb.mi/mi-var-child.exp: Accept "long". * gdb.mi/mi-var-display.exp: Accept "long". * gdb.mi/mi2-var-child.exp: Accept "long".
* * NEWS: Update.Tom Tromey2012-11-121-0/+6
| | | | | | | | | | | | | | | | | | | | | | | * c-typeprint.c (c_type_print_base): Handle print_method and print_typedefs flags. * gdbcmd.h (setprinttypelist, showprinttypelist): Declare. * python/py-type.c (typy_str): Use LA_PRINT_TYPE and raw options. * typeprint.c (type_print_raw_options, default_ptype_flags): Update for new field.s (whatis_exp): Parse flags. Use LA_PRINT_TYPE. (setprinttypelist, showprinttypelist, print_methods, print_typedefs): New globals. (set_print_type, show_print_type, set_print_type_methods, show_print_type_methods, set_print_type_typedefs, show_print_type_typedefs): New functions. (_initialize_typeprint): Update documentation. Add "print type methods" and "print type typedefs" parameters. * typeprint.h (struct type_print_options) <print_methods, print_typedefs>: New fields. doc * gdb.texinfo (Symbols): Document "set print type methods", "set print type typedefs", and flags to ptype and whatis.
* * ada-lang.c (user_select_syms, ada_print_subexp): Pass flagsTom Tromey2012-11-121-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to type-printing functions. * ada-lang.h (ada_print_type): Add argument. * ada-typeprint.c (print_array_type, print_variant_clauses, print_variant_part, print_selected_record_field_types, print_record_field_types, print_unchecked_union_type, print_func_type, ada_print_type): Add flags argument. (ada_print_typedef): Update. * c-exp.y (OPERATOR conversion_type_id): Update. * c-lang.h (c_print_type, c_type_print_base): Update. * c-typeprint.c (c_print_type, c_type_print_varspec_prefix, c_type_print_modifier, c_type_print_args, c_type_print_varspec_suffix, c_type_print_base): Add flags argument. * cp-valprint.c (cp_print_class_member): Update. * dwarf2read.c (dwarf2_compute_name): Update. * f-lang.h (f_print_type): Add argument. * f-typeprint.c (f_print_type): Add flags argument. * gnu-v3-abi.c (gnuv3_print_method_ptr): Update. * go-lang.h (go_print_type): Add argument. * go-typeprint.c (go_print_type): Add flags argument. * jv-lang.h (java_print_type): Add argument. * jv-typeprint.c (java_type_print_base, java_print_type): Add flags argument. * language.c (unk_lang_print_type): Add flags argument. * language.h (struct language_defn) <la_print_type>: Add flags argument. (LA_PRINT_TYPE): Likewise. * m2-lang.h (m2_print_type): Add argument. * m2-typeprint.c (m2_print_type, m2_range, m2_typedef, m2_array, m2_pointer, m2_ref, m2_procedure, m2_long_set, m2_unbounded_array, m2_record_fields): Add flags argument. * p-lang.h (pascal_print_type, pascal_type_print_base, pascal_type_print_varspec_prefix): Add argument. * p-typeprint.c (pascal_print_type, pascal_type_print_varspec_prefix, pascal_print_func_args, pascal_type_print_varspec_suffix, pascal_type_print_base): Add flags argument. * symmisc.c (print_symbol): Update. * typeprint.c (type_print_raw_options, default_ptype_flags): New globals. (type_print): Update. * typeprint.h (struct type_print_options): New. (type_print_raw_options): Declare. (c_type_print_varspec_suffix, c_type_print_args): Add argument.
* Copyright year update in most files of the GDB Project.Joel Brobecker2012-01-041-2/+2
| | | | | | gdb/ChangeLog: Copyright year update in most files of the GDB Project.
* run copyright.sh for 2011.Joel Brobecker2011-01-011-1/+1
|
* dwarf2_physname patchset:Keith Seitz2010-03-091-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on work from Daniel Jacobowitz <dan@codesourcery.com> * c-typeprint.c (cp_type_print_method_args): For non-static methods, print out const or volatile qualifiers, too. (c_type_print_args): Add parameters show_artificial and language. Skip artificial parameters when requested. Use the appropriate language printer. (c_type_print_varspec): Tell c_type_print_args to skip artificial parameters and pass language_c. * dwarf2read.c (die_list): New file global. (struct partial_die_info): Update comments for name field. (pdi_needs_namespace): Renamed to ... (die_needs_namespace): ... this. Rewrite. (dwarf2_linkage_name): Remove. (add_partial_symbol): Do not predicate the call to partial_die_full_name based on pdi_needs_namespace. Remove call to cp_check_possible_namespace_symbols and associated outdated comments. (guess_structure_name): Do not inspect child subprogram DIEs. (dwarf2_fullname): Update comments. Use die_needs_namespace to assist in computing the name. (read_func_scope): Use dwarf2_name to get the DIE's name. Use dwarf2_physname to get the "linkage name" of the DIE. (dwarf2_add_member_field): Use dwarf2_physname instead of dwarf2_linkage_name. (read_structure_type): For structs and classes, set TYPE_NAME, too. (determine_class): Remove. (read_partial_die): Ignore DW_AT_MIPS_linkage_name for all languages except Ada. (new_symbol): Unconditionally call dwarf2_name. Compute the "linkage name" using dwarf2_physname. Use dwarf2_name instead of dwarf2_full_name for enumerator DIEs. When determining to scan for anonymous C++ namespaces, ignore the linkage name. (dwarf2_physname): New function. (dwarf2_full_name): Move content to new function and call that. (dwarf2_compute_name): "New" function. (_initialize_dwarf2_read): Initialize die_list. * gnu-v3-eabi.c (gnu_v3_find_method_in): Remove unused variable physname. (gnu_v3_print_method_ptr): Use the physname for virtual methods without a demangled name. Print out type information for non-virtual methods. * linespec.c (decode_line_1): Force ANY string using "::" (or "." for java) to use decode_compound, and clean up any stray quoting. If we found a file symtab, re-evaluate whether the remainder is_quoted. (decode_compound): Stop consuming at an open parenthesis. Keep template parameters. Keep any overload information. Keep keywords like "const". Remove paren_pointer. Move is_quoted check from set_flags to here. Remove #if 0 code from 2000. Ten years is long enough. (find_method): Before comparing symbol names, canonicalize the string from the user. If a specific overload is requested, find it. Otherwise throw an error. (find_method_overload_end): New function. (set_flags): Remove. (decode_compound): Assume that parentheses are matched. It's a lot easier. * symtab.c (symbol_find_demangled_name): Add DMGL_VERBOSE flag to cplus_demangle. * linespec.c (decode_line_1): Keep important keywords like "const" and "volatile". * symtab.h (SYMBOL_CPLUS_DEMANGLED_NAME): Remove. * typeprint.h (c_type_print_args): Add declaration. * ui-file.c (do_ui_file_obsavestring): New function. (ui_file_obsavestring): New function. * ui-file.h (ui_file_obsavestring): Add declaration. * valops.c (find_overload_match): Resolve the object to a non-pointer type. If the object is a data member, search the object for the member and return with staticp set. Use SYMBOL_NATURAL_NAME instead of SYMBOL_CPLUS_DEMANGLED_NAME. Do not attempt to extract a function name from non-function types. If the extracted function name and the original name are the same, we don't have a C++ method. From Jan Kratochvil <jan.kratochvil@redhat.com>: * dwarf2read.c (new_symbol <DW_TAG_enumerator>): Call dwarf2_full_name. * ada-lang.c (ada_lookup_symbol): Remove linkage_name parameters and arguments from symbol lookups. * ax-gdb.c (gen_expr): Likewise. * cp-namespace.c (cp_lookup_symbol_nonlocal, lookup_namespace_scope, cp_lookup_symbol_namespace, lookup_symbol_file, lookup_nested_type, lookup_possible_namespace_symbol): Likewise. * cp-support.c (read_in_psymtabs): Likewise. * cp-support.h (cp_lookup_symbol_nonlocal): Likewise. * language.h (la_lookup_symbol_nonlocal): Likewise. * scm-valprint.c (scm_inferior_print): Likewise. * solib-darwin.c (darwin_relocate_section_addresses): Likewise. * solib-svr.c (elf_lookup_lib): Likewise. * solib.c (show_auto_solib_add): Likewise. * solist.h (lookup_lib_global, solib_global_lookup): Likewise. * symmisc.c (maintenance_check_symtabs): Likewise. * symtab.c (lookup_symbol_in_language, lookup_symbol_aux, lookup_symbol_aux_local, lookup_symbol_aux_block, lookup_symbol_from_objfile, lookup_symbol_aux_symtabs, lookup_symbol_aux_psymtabs,basic_lookup_symbol_nonlocal, lookup_symbol_static, lookup_symbol_global, symbol_matches_domain, basic_lookup_transparent_type, find_main_psymtab, lookup_block_symbol): Likewise. * symtab.h (basic_lookp_symbol_nonlocal, lookup_symbol_static, lookup_symbol_global, lookup_symbol_aux_block, lookup_symbol_partial_symbol, lookup_block_symbol, lookup_global_symbol, value_maybe_namespace_elt): Likewise.
* Update copyright year in most headers.Joel Brobecker2010-01-011-2/+2
| | | | Automatic update by copyright.sh.
* Updated copyright notices for most files.Joel Brobecker2009-01-031-1/+1
|
* Updated copyright notices for most files.Daniel Jacobowitz2008-01-011-1/+1
|
* Switch the license of all .c files to GPLv3.Joel Brobecker2007-08-231-4/+2
| | | | | Switch the license of all .h files to GPLv3. Switch the license of all .cc files to GPLv3.
* Copyright updates for 2007.Daniel Jacobowitz2007-01-091-1/+1
|
* * breakpoint.c:Eli Zaretskii2005-12-171-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * arm-tdep.c: * ia64-tdep.c: * i386-tdep.c: * hpread.c: * hppa-tdep.c: * hppa-hpux-tdep.c: * gnu-nat.c: * gdbtypes.c: * gdbarch.h: * gdbarch.c: * eval.c: * dwarf2read.c: * dbxread.c: * copying: * symfile.c: * stabsread.c: * sh64-tdep.c: * sh-tdep.c: * s390-tdep.c: * rs6000-tdep.c: * remote.c: * remote-mips.c: * mips-tdep.c: * mdebugread.c: * linux-nat.c: * infrun.c: * xcoffread.c: * win32-nat.c: * valops.c: * utils.c: * tracepoint.c: * target.c: * symtab.c: * c-exp.y: * ada-valprint.c: * ada-typeprint.c: * ada-lex.l: * ada-lang.h: * ada-lang.c: * ada-exp.y: * alphafbsd-tdep.c: * alphabsd-tdep.h: * alphabsd-tdep.c: * alphabsd-nat.c: * alpha-tdep.h: * alpha-tdep.c: * alpha-osf1-tdep.c: * alpha-nat.c: * alpha-mdebug-tdep.c: * alpha-linux-tdep.c: * alpha-linux-nat.c: * aix-thread.c: * abug-rom.c: * arch-utils.c: * annotate.h: * annotate.c: * amd64obsd-tdep.c: * amd64obsd-nat.c: * amd64nbsd-tdep.c: * amd64nbsd-nat.c: * amd64fbsd-tdep.c: * amd64fbsd-nat.c: * amd64bsd-nat.c: * amd64-tdep.h: * amd64-tdep.c: * amd64-sol2-tdep.c: * amd64-nat.h: * amd64-nat.c: * amd64-linux-tdep.c: * amd64-linux-nat.c: * alphanbsd-tdep.c: * block.h: * block.c: * bfd-target.h: * bfd-target.c: * bcache.h: * bcache.c: * ax.h: * ax-general.c: * ax-gdb.h: * ax-gdb.c: * avr-tdep.c: * auxv.h: * auxv.c: * armnbsd-tdep.c: * armnbsd-nat.c: * arm-tdep.h: * arm-linux-nat.c: * arch-utils.h: * charset.c: * call-cmds.h: * c-valprint.c: * c-typeprint.c: * c-lang.h: * c-lang.c: * buildsym.h: * buildsym.c: * bsd-uthread.h: * bsd-uthread.c: * bsd-kvm.h: * bsd-kvm.c: * breakpoint.h: * core-regset.c: * core-aout.c: * completer.h: * completer.c: * complaints.h: * complaints.c: * command.h: * coffread.c: * coff-solib.h: * coff-solib.c: * coff-pe-read.h: * coff-pe-read.c: * cli-out.h: * cli-out.c: * charset.h: * dink32-rom.c: * dictionary.h: * dictionary.c: * demangle.c: * defs.h: * dcache.h: * dcache.c: * d10v-tdep.c: * cpu32bug-rom.c: * cp-valprint.c: * cp-support.h: * cp-support.c: * cp-namespace.c: * cp-abi.h: * cp-abi.c: * corelow.c: * corefile.c: * environ.c: * elfread.c: * dwarfread.c: * dwarf2loc.c: * dwarf2expr.h: * dwarf2expr.c: * dwarf2-frame.h: * dwarf2-frame.c: * dve3900-rom.c: * dummy-frame.h: * dummy-frame.c: * dsrec.c: * doublest.h: * doublest.c: * disasm.h: * disasm.c: * fork-child.c: * findvar.c: * fbsd-nat.h: * fbsd-nat.c: * f-valprint.c: * f-typeprint.c: * f-lang.h: * f-lang.c: * expression.h: * expprint.c: * exec.h: * exec.c: * exceptions.h: * exceptions.c: * event-top.h: * event-top.c: * event-loop.h: * event-loop.c: * gdb.c: * gdb-stabs.h: * gdb-events.h: * gdb-events.c: * gcore.c: * frv-tdep.h: * frv-tdep.c: * frv-linux-tdep.c: * frame.h: * frame.c: * frame-unwind.h: * frame-unwind.c: * frame-base.h: * frame-base.c: * gdb_vfork.h: * gdb_thread_db.h: * gdb_string.h: * gdb_stat.h: * gdb_regex.h: * gdb_ptrace.h: * gdb_proc_service.h: * gdb_obstack.h: * gdb_locale.h: * gdb_dirent.h: * gdb_curses.h: * gdb_assert.h: * gdbarch.sh: * gdb.h: * hpux-thread.c: * hppabsd-nat.c: * hppa-tdep.h: * hpacc-abi.c: * h8300-tdep.c: * gregset.h: * go32-nat.c: * gnu-v3-abi.c: * gnu-v2-abi.h: * gnu-v2-abi.c: * gnu-nat.h: * glibc-tdep.c: * gdbtypes.h: * gdbcore.h: * gdbcmd.h: * i386nbsd-tdep.c: * i386nbsd-nat.c: * i386gnu-tdep.c: * i386gnu-nat.c: * i386fbsd-tdep.c: * i386fbsd-nat.c: * i386bsd-tdep.c: * i386bsd-nat.h: * i386bsd-nat.c: * i386-tdep.h: * i386-sol2-nat.c: * i386-nto-tdep.c: * i386-nat.c: * i386-linux-tdep.h: * i386-linux-tdep.c: * i386-linux-nat.c: * i386-cygwin-tdep.c: * inf-ttrace.c: * inf-ptrace.h: * inf-ptrace.c: * inf-loop.h: * inf-loop.c: * inf-child.h: * inf-child.c: * ia64-tdep.h: * ia64-linux-nat.c: * i387-tdep.h: * i387-tdep.c: * i386v4-nat.c: * i386v-nat.c: * i386obsd-tdep.c: * i386obsd-nat.c: * kod.c: * jv-valprint.c: * jv-typeprint.c: * jv-lang.h: * jv-lang.c: * irix5-nat.c: * iq2000-tdep.c: * interps.h: * interps.c: * inftarg.c: * inflow.h: * inflow.c: * inferior.h: * infcmd.c: * infcall.h: * infcall.c: * inf-ttrace.h: * m32r-tdep.h: * m32r-tdep.c: * m32r-rom.c: * m32r-linux-tdep.c: * m32r-linux-nat.c: * m2-valprint.c: * m2-typeprint.c: * m2-lang.h: * m2-lang.c: * lynx-nat.c: * linux-thread-db.c: * linux-nat.h: * linespec.c: * libunwind-frame.h: * libunwind-frame.c: * language.h: * language.c: * macroexp.c: * macrocmd.c: * m88kbsd-nat.c: * m88k-tdep.h: * m88k-tdep.c: * m68klinux-tdep.c: * m68klinux-nat.c: * m68kbsd-tdep.c: * m68kbsd-nat.c: * m68k-tdep.h: * m68k-tdep.c: * mips-linux-nat.c: * mips-irix-tdep.c: * minsyms.c: * memattr.h: * memattr.c: * mem-break.c: * mdebugread.h: * main.h: * main.c: * macrotab.h: * macrotab.c: * macroscope.h: * macroscope.c: * macroexp.h: * nbsd-tdep.c: * mt-tdep.c: * monitor.h: * monitor.c: * mn10300-tdep.h: * mn10300-tdep.c: * mn10300-linux-tdep.c: * mipsv4-nat.c: * mipsread.c: * mipsnbsd-tdep.h: * mipsnbsd-tdep.c: * mipsnbsd-nat.c: * mips64obsd-tdep.c: * mips64obsd-nat.c: * mips-tdep.h: * mips-mdebug-tdep.c: * mips-linux-tdep.c: * osabi.h: * osabi.c: * ocd.h: * ocd.c: * observer.c: * objfiles.h: * objfiles.c: * objc-lang.h: * objc-lang.c: * objc-exp.y: * nto-tdep.h: * nto-tdep.c: * nto-procfs.c: * nlmread.c: * nbsd-tdep.h: * ppcobsd-tdep.c: * ppcobsd-nat.c: * ppcnbsd-tdep.h: * ppcnbsd-tdep.c: * ppcnbsd-nat.c: * ppcbug-rom.c: * ppc-tdep.h: * ppc-sysv-tdep.c: * ppc-linux-tdep.c: * ppc-linux-nat.c: * ppc-bdm.c: * parser-defs.h: * parse.c: * p-valprint.c: * p-typeprint.c: * p-lang.h: * p-lang.c: * remote-fileio.h: * remote-fileio.c: * remote-est.c: * remote-e7000.c: * regset.h: * regset.c: * reggroups.h: * reggroups.c: * regcache.h: * regcache.c: * proc-why.c: * proc-service.c: * proc-events.c: * printcmd.c: * ppcobsd-tdep.h: * sentinel-frame.h: * sentinel-frame.c: * scm-valprint.c: * scm-tags.h: * scm-lang.h: * scm-lang.c: * scm-exp.c: * s390-tdep.h: * rom68k-rom.c: * remote.h: * remote-utils.c: * remote-st.c: * remote-sim.c: * remote-sds.c: * remote-rdp.c: * remote-rdi.c: * remote-hms.c: * sim-regno.h: * shnbsd-tdep.h: * shnbsd-tdep.c: * shnbsd-nat.c: * sh-tdep.h: * serial.h: * serial.c: * ser-unix.h: * ser-unix.c: * ser-tcp.c: * ser-pipe.c: * ser-go32.c: * ser-e7kpc.c: * ser-base.h: * ser-base.c: * solib.c: * solib-svr4.h: * solib-svr4.c: * solib-sunos.c: * solib-som.h: * solib-som.c: * solib-pa64.h: * solib-pa64.c: * solib-osf.c: * solib-null.c: * solib-legacy.c: * solib-irix.c: * solib-frv.c: * solib-aix5.c: * sol-thread.c: * sparc64-linux-tdep.c: * sparc64-linux-nat.c: * sparc-tdep.h: * sparc-tdep.c: * sparc-sol2-tdep.c: * sparc-sol2-nat.c: * sparc-nat.h: * sparc-nat.c: * sparc-linux-tdep.c: * sparc-linux-nat.c: * source.h: * source.c: * somread.c: * solist.h: * solib.h: * std-regs.c: * stack.h: * stack.c: * stabsread.h: * sparcobsd-tdep.c: * sparcnbsd-tdep.c: * sparcnbsd-nat.c: * sparc64obsd-tdep.c: * sparc64nbsd-tdep.c: * sparc64nbsd-nat.c: * sparc64fbsd-tdep.c: * sparc64fbsd-nat.c: * sparc64-tdep.h: * sparc64-tdep.c: * sparc64-sol2-tdep.c: * sparc64-nat.c: * ui-file.c: * typeprint.h: * typeprint.c: * tramp-frame.h: * tramp-frame.c: * trad-frame.h: * trad-frame.c: * tracepoint.h: * top.c: * tobs.inc: * thread.c: * terminal.h: * target.h: * symfile.h: * stop-gdb.c: * vaxbsd-nat.c: * vax-tdep.h: * vax-tdep.c: * vax-nat.c: * varobj.h: * varobj.c: * value.h: * value.c: * valprint.h: * valprint.c: * v850-tdep.c: * uw-thread.c: * user-regs.c: * ui-out.h: * ui-out.c: * ui-file.h: * xcoffsolib.h: * xcoffsolib.c: * wrapper.c: * wince.c: * wince-stub.h: * wince-stub.c: * vaxobsd-tdep.c: * vaxnbsd-tdep.c: * gdb_gcore.sh: * copying.c: * configure.ac: * aclocal.m4: * acinclude.m4: * reply_mig_hack.awk: * observer.sh: * gdb_mbuild.sh: * arm-linux-tdep.c: * blockframe.c: * dbug-rom.c: * environ.h: * dwarf2loc.h: * gdb-events.sh: * glibc-tdep.h: * gdb_wait.h: * gdbthread.h: * i386-sol2-tdep.c: * hppabsd-tdep.c: * hppa-linux-nat.c: * hppa-hpux-nat.c: * ia64-linux-tdep.c: * infptrace.c: * linespec.h: * maint.c: * mips-mdebug-tdep.h: * remote-m32r-sdi.c: * s390-nat.c: * rs6000-nat.c: * remote-utils.h: * sh3-rom.c: * sh-linux-tdep.c: * top.h: * symtab.h: * symmisc.c: * symfile-mem.c: * srec.h: * user-regs.h: * version.h: * valarith.c: * xstormy16-tdep.c: * wrapper.h: * Makefile.in: * f-exp.y: * cris-tdep.c: * cp-name-parser.y: * procfs.c: * proc-utils.h: * proc-flags.c: * proc-api.c: * p-exp.y: * m68hc11-tdep.c: * m2-exp.y: * kod.h: * kod-cisco.c: * jv-exp.y: * hppa-linux-tdep.c: Add (c) after Copyright. Update the FSF address.
* 2003-04-12 Andrew Cagney <cagney@redhat.com>Andrew Cagney2003-04-121-0/+2
| | | | | | | | | | | | | | | | | | | * gdbarch.sh: Add missing opaque declarations. * gdbarch.h: Regnerate. * symtab.h: Add missing opaque declarations. * value.h, target.h, symfile.h, stabsread.h: Ditto. * x86-64-tdep.h, xmodem.h, monitor.h, typeprint.h: Ditto. * srec.h, solib-svr4.h, source.h, inferior.h: Ditto. * ser-unix.h, serial.h, remote-utils.h, gdbcore.h: Ditto. * ppc-tdep.h, ocd.h, mips-tdep.h, gdbtypes.h: Ditto. * buildsym.h, builtin-regs.h, linespec.h, language.h: Ditto. * i387-tdep.h, gdbthread.h, event-top.h, gdb.h: Ditto. * dwarf2cfi.h, doublest.h, disasm.h, cp-abi.h: Ditto. * cli-out.h, c-lang.h, ax-gdb.h, arch-utils.h: Ditto. * ada-lang.h, config/nm-lynx.h, config/nm-linux.h: Ditto. * config/sparc/tm-sp64.h, config/rs6000/tm-rs6000.h: Ditto. * config/pa/tm-hppah.h, config/m68k/tm-delta68.h: Ditto. * cli/cli-setshow.h, cli/cli-script.h: Ditto.
* Update makefile.in dependencies. Add header wrappers.Andrew Cagney2001-10-211-0/+4
|
* import gdb-2000-02-01 snapshotJason Molenda2000-02-021-5/+4
|
* import gdb-1999-07-07 post reformatJason Molenda1999-07-071-13/+14
|
* Initial creation of sourceware repositorygdb-4_18-branchpointStan Shebs1999-04-161-0/+25
|
* Initial creation of sourceware repositoryStan Shebs1999-04-161-21/+0
|
* Update FSF address.Fred Fish1995-08-021-1/+1
|
* Change the stream argument to _filtered to GDB_FILE *.Thomas Lord1993-11-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change all references to stdout/stderr to gdb_stdout/gdb_stderr. Replace all calls to stdio output functions with calls to corresponding _unfiltered functions (`fprintf_unfiltered') Replaced calls to fopen for output to gdb_fopen. Added sufficient goo to utils.c and defs.h to make the above work. The net effect is that stdio output functions are only directly used in utils.c. Elsewhere, the _unfiltered and _filtered functions and GDB_FILE type are used. In the near future, GDB_FILE will stop being equivalant to FILE. The semantics of some commands has changed in a very subtle way: called in the right context, they may cause new occurences of prompt_for_continue() behavior. The testsuite doesn't notice anything like this, though. Please respect this change by not reintroducing stdio output dependencies in the main body of gdb code. All output from commands should go to a GDB_FILE. Target-specific code can still use stdio directly to communicate with targets.
* * Makefile.in (HFILES): Add typeprint.h.John Gilmore1993-01-311-3/+1
| | | | * typeprint.[ch]: Update copyrights.
* * Makefile.in (VERSION): Bump to 4.7.4.Fred Fish1992-12-181-0/+23
* Makefile.in (SFILES_MAINDIR): Add typeprint.c, c-typeprint.c, m2-typeprint.c, c-valprint.c cp-valprint.c m2-valprint.c. * Makefile.in (HFILES): Add valprint.h. * Makefile.in (OBS): Add typeprint.o, c-typeprint.o, m2-typeprint.o, c-valprint.o, cp-valprint.o m2-valprint.o. * typeprint.c, typeprint.h: New files for language independent type printing functions. * c-typeprint.c, m2-typeprint.c: New files for language dependent type printing functions and definitions. * valprint.h: New include file for language independent value printing definitions. * c-valprint.c, cp-valprint.c, m2-valprint.c: New files for language dependent value printing functions. * c-exp.y (production ptype): Add range_type variable and use new create_range_type function. * c-exp.y (tokentab2, tokentab3), c-lang.c (c_op_print_tab), infcmd.c (path_var_name), language.c (unk_op_print_tab), m2-lang.c (m2_op_print_tab): Change from ANSI-obsolescent "const static" to ANSI-conformant "static const". * c-exp.y (c_create_fundamental_type): Remove unused nbytes. * c-exp.y (c_language_defn, cplus_language_defn): Add c_print_type, and c_val_print. * c-lang.h (c_print_type, c_val_print): Add prototypes. * coffread.c (decode_type): Add range_type variable and call to new create_range_type function. * complaints.c (complain): Remove unused val variable. * complaints.c (_initialize_complaints): Make it void. * convex-tdep.c (value_of_trapped_internalvar): Add range_type variable and call new create_range_type function. * defs.h (enum val_prettyprint): Move enum from value.h to here so we can avoid having to include value.h just for prototypes that need the enum (thanks ANSI). * dwarfread.c (struct_type): Local anonymous_size variable is only used if !BITS_BIG_ENDIAN. * dwarfread.c (decode_subscript_data_item): Add rangetype variable and call new create_range_type function. * elfread.c (elf_symfile_read): Remove unused dbx and text_sect variables. * eval.c (evaluate_subexp): Remove unused local variable name and the statement with no side effects that initializes it. * expprint.c (print_subexp): Change local_printstr to LA_PRINT_STRING. * gdbtypes.c (create_range_type): New function that creates a range type using code fragments from object file readers as an example of what has to be initialized. * gdbtypes.c (create_array_type): Removed index_type, low_bound, and high_bound parameters, replaced with a single range_type parameter. Change function body to use passed in range_type rather than handcrafting one. * gdbtypes.h (create_range_type): Add prototype. * gdbtypes.h (create_array_type): Change prototype parameters. * infrun.c (normal_stop): Remove unused local variables tem and c. * infrun.c (hook_stop_stub): Return 0 rather than random value. * language.c (unk_lang_print_type, unk_lang_val_print): Add stub functions that call error if called. * language.c (unknown_language_defn, auto_language_defn, local_language_defn): Add initializers unk_lang_print_type and unk_lang_val_print. * language.h (struct language_defn): Reformat for larger comments, add la_print_type and la_val_print members. Add LA_PRINT_TYPE and LA_VAL_PRINT macros. Change local_printchar to LA_PRINT_CHAR and local_printstr to LA_PRINT_STRING. * m2-lang.c (m2_create_fundamental_type): Remove unused local variable nbytes. * m2-lang.c (m2_language_defn): Add initializers m2_print_type and m2_val_print. * m2-lang.h (m2_print_type, m2_val_print): Add prototypes. * main.c (execute_command): Remove unused local variable cmdlines. * main.c (echo_command), stabsread.c (read_type), printcmd.c (clear_displays), symmisc.c (block_depth), values.c (clear_value_history): Make testing of truth value of assignment result explicit. * mipsread.c (upgrade_type): Update FIXME to include future use of create_range_type. * printcmd.c (ptype_command, ptype_eval, whatis_command, whatis_exp, maintenance_print_type): Move prototypes and functions to new typeprint.c. * printcmd.c (_initialize_printcmd): Move add_com calls for ptype_command and whatis_command to new typeprint.c. * ser-bsd.c (serial_open): Remove unused variable sgttyb. * source.c (find_source_lines): Local variable c only used when LSEEK_NOT_LINEAR is defined. * stabsread.c (read_array_type): Use new create_range_type function. * stabsread.c (read_range_type): Add new index_type variable and call new create_range_type function rather than handcrafting range types. * symmisc.c (type_print_1): Change usages to LA_PRINT_TYPE. * symtab.c (typedef_print usages): Use c_typedef_print, renamed. * symtab.c (type_print_base usages): Use c_type_print_base. * symtab.c (type_print_varspec_prefix usages): Use c_type_print_varspec_prefix. * symtab.c (type_print_method_args usages): Use cp_type_print_method_args. * valprint.c: Completely ripped apart and the fragments used to create c-valprint.c, cp-valprint.c, m2-valprint.c, and valprint.h. Remaining stuff is language independent. * value.h (struct fn_field): Forward declare for prototypes. * value.h (type_print_1): Remove prototype. * value.h (enum val_prettyprint): Moved to defs.h. * value.h (typedef_print): Prototype renamed to c_typedef_print. * value.h (baseclass_offset): Add prototype. **** start-sanitize-chill **** * Makefile.in (SFILES_MAINDIR): Add ch-typeprint.c, ch-valprint.c. * Makefile.in (OBS): Add ch-typeprint.o, ch-valprint.o. * ch-typeprint.c: New file for language dependent type printing. * ch-valprint.c: New file for language dependent value printing. * ch-exp.y (parse_number): Remove prototype and stub function. * ch-exp.y (decode_integer_literal): Removed unused digits and temp variables. * ch-exp.y (convert_float): Completely ifdef out for now. * ch-exp.y (tokentab2, tokentab3, tokentab4, tokentab5), ch-lang.c (chill_op_print_tab): Change from ANSI-obsolescent "const static" to ANSI-conformant "static const". * ch-exp.y (yylex): Add unhandled storage class enumeration literals to switch statement for completeness. * ch-lang.c (chill_create_fundamental_types): Remove unused nbytes variable. Change dummy type to 2 bytes to match int. Handle FT_VOID types gratuituously added to chill DWARF by compiler. Change FT_CHAR case to generate an TYPE_CODE_CHAR type rather than a one byte TYPE_CODE_INT type. * ch-lang.c (chill_language_defn): Add chill_print_type and chill_val_print. * ch-lang.h (chill_print_type, chill_val_print): Add prototypes. **** end-sanitize-chill ****