aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2019-03-09Split rank_one_type_parm_range from rank_one_typeSimon Marchi2-14/+27
gdb/ChangeLog: * gdbtypes.c (rank_one_type_parm_range): New function extracted from... (rank_one_type): ... this.
2019-03-09Split rank_one_type_parm_char from rank_one_typeSimon Marchi2-41/+54
gdb/ChangeLog: * gdbtypes.c (rank_one_type_parm_char): New function extracted from... (rank_one_type): ... this.
2019-03-09Split rank_one_type_parm_enum from rank_one_typeSimon Marchi2-16/+29
gdb/ChangeLog: * gdbtypes.c (rank_one_type_parm_enum): New function extracted from... (rank_one_type): ... this.
2019-03-09Split rank_one_type_parm_int from rank_one_typeSimon Marchi2-83/+96
gdb/ChangeLog: * gdbtypes.c (rank_one_type_parm_int): New function extracted from... (rank_one_type): ... this.
2019-03-09Split rank_one_type_parm_func from rank_one_typeSimon Marchi2-7/+21
gdb/ChangeLog: * gdbtypes.c (rank_one_type_parm_func): New function extracted from... (rank_one_type): ... this.
2019-03-09Split rank_one_type_parm_array from rank_one_typeSimon Marchi2-9/+23
gdb/ChangeLog: * gdbtypes.c (rank_one_type_parm_array): New function extracted from... (rank_one_type): ... this.
2019-03-09Split rank_one_type_parm_ptr from rank_one_typeSimon Marchi2-63/+79
gdb/ChangeLog: * gdbtypes.c (rank_one_type_parm_ptr): New function extracted from... (rank_one_type): ... this.
2019-03-09Ensure 'help set/show print inferior-events' shows the example events.Philippe Waroquiers2-2/+7
Without this patch, the help stops after 'e.g.' : (gdb) apropos \(inferior\|thread\) event set print inferior-events -- Set printing of inferior events (e.g. set print thread-events -- Set printing of thread events (such as thread start and exit) show print inferior-events -- Show printing of inferior events (e.g. show print thread-events -- Show printing of thread events (such as thread start and exit) Using the same notation as for the thread evenets (i.e. 'such as') gives: (gdb) apropos \(inferior\|thread\) event set print inferior-events -- Set printing of inferior events (such as inferior start and exit) set print thread-events -- Set printing of thread events (such as thread start and exit) show print inferior-events -- Show printing of inferior events (such as inferior start and exit) show print thread-events -- Show printing of thread events (such as thread start and exit)
2019-03-09Support styling on native MS-Windows consoleEli Zaretskii7-1/+237
gdb/ChangeLog: 2019-03-08 Eli Zaretskii <eliz@gnu.org> PR/24315 * utils.c (can_emit_style_escape) [_WIN32]: Don't disable styling on MS-Windows if $TERM is not defined. * cli/cli-style.c: Set cli_styling to 1 in the MinGW build. * posix-hdep.c (gdb_console_fputs): * mingw-hdep.c (rgb_to_16colors, gdb_console_fputs): New functions. * ui-file.h (gdb_console_fputs): Add prototype. * ui-file.c (stdio_file::puts): Call gdb_console_fputs, and fall back to fputs only if the former returns zero.
2019-03-09Automatic date update in version.inGDB Administrator1-1/+1
2019-03-08PR24311, FAIL: S-records with constructorsAlan Modra2-22/+39
Not padding string merge section output to its alignment can cause failures of the S-record tests when input string merge sections are padded, since the ELF linker output for the single string section would shrink compared to the SREC linker output. That might result in following sections having different addresses. On the other hand, padding string merge section output when input string merge sections are *not* padded can also cause failures, in this case due to the ELF linker output for the string section being larger (due to padding) than the SREC linker output. It would be better to write a more robust test, but it is also nice to leave input unchanged when no string merges occur. PR 24311 * merge.c (merge_strings): Return secinfo. Don't pad section to alignment here. (_bfd_merge_sections): Pad section to alignment here, if input sections contributing to merged output all pad to alignment. Formatting.
2019-03-08Automatic date update in version.inGDB Administrator1-1/+1
2019-03-07C++-ify bcacheTom Tromey16-316/+228
This somewhat C++-ifies bcache. It replaces bcache_xmalloc and bcache_xfree with constructors; changes some functions into methods; and changes various structures to include a bcache directly (as opposed to a pointer to a bcache). Tested by the buildbot. gdb/ChangeLog 2019-03-07 Tom Tromey <tom@tromey.com> * symmisc.c (print_symbol_bcache_statistics): Update. (print_objfile_statistics): Update. * symfile.c (allocate_symtab): Update. * stabsread.c: Don't include bcache.h. * psymtab.h (struct psymbol_bcache): Don't declare. (class psymtab_storage) <psymbol_cache>: Now a bcache. (psymbol_bcache_init, psymbol_bcache_free) (psymbol_bcache_get_bcache): Don't declare. * psymtab.c (struct psymbol_bcache): Remove. (psymtab_storage::psymtab_storage): Update. (psymtab_storage::~psymtab_storage): Update. (psymbol_bcache_init, psymbol_bcache_free) (psymbol_bcache_get_bcache, psymbol_bcache_full): Remove. (add_psymbol_to_bcache): Update. (allocate_psymtab): Update. * objfiles.h (struct objfile_per_bfd_storage) <filename_cache, macro_cache>: No longer pointers. * objfiles.c (get_objfile_bfd_data): Don't call bcache_xmalloc. (free_objfile_per_bfd_storage): Don't call bcache_xfree. * macrotab.c (macro_bcache): Update. * macroexp.c: Don't include bcache.h. * gdbtypes.c (check_types_worklist): Update. (types_deeply_equal): Remove TRY/CATCH. Update. * elfread.c (elf_symtab_read): Update. * dwarf2read.c: Don't include bcache.h. * buildsym.c (buildsym_compunit::get_macro_table): Update. * bcache.h (bcache, bcache_full, bcache_xffree, bcache_xmalloc) (print_bcache_statistics, bcache_memory_used): Don't declare. (struct bcache): Move from bcache.c. Add constructor, destructor, methods. Rename all data members. * bcache.c (struct bcache): Move to bcache.h. (bcache::expand_hash_table): Rename from expand_hash_table. (bcache): Remove. (bcache::insert): Rename from bcache_full. (bcache::compare): Rename from bcache_compare. (bcache_xmalloc): Remove. (bcache::~bcache): Rename from bcache_xfree. (bcache::print_statistics): Rename from print_bcache_statistics. (bcache::memory_used): Rename from bcache_memory_used.
2019-03-07Fix normal_stop latent bugPedro Alves2-1/+7
TARGET_WAITKIND_NO_RESUMED doesn't have an associated event thread, so we shouldn't be referring to inferior_thread() assuming it points to one. This was caught on the multi-target branch, where we always switch to no-thread-selected whenever we start handling an event, exactly to catch places that incorrectly use "inferior_ptid/inferior_thread()" without switching to the right event thread / target. Here, on the branch, we assert in inferior_thread() because TARGET_WAITKIND_NO_RESUMED doesn't have an associated event thread, so inferior_ptid is still null_ptid. gdb/ChangeLog: 2019-03-07 Pedro Alves <palves@redhat.com> * infrun.c (normal_stop): Also check for TARGET_WAITKIND_NO_RESUMED before referring to inferior_thread().
2019-03-07gdb: Move value_from_host_double into value.c and make more use of itAndrew Burgess7-35/+29
The function value_from_host_double can be moved from f-lang.c into value.c as a generally useful function, and then used more widely. Tested on X86-64/GNU Linux with no regressions. gdb/ChangeLog: * f-lang.c (value_from_host_double): Moved to... * value.c (value_from_host_double): ...here. * value.h (value_from_host_double): Declare. * guile/scm-math.c (vlscm_convert_typed_number): Use value_from_host_double. (vlscm_convert_number): Likewise. * guile/scm-value.c (gdbscm_value_to_real): Likewise. * python/py-value.c (convert_value_from_python): Likewise.
2019-03-07Automatic date update in version.inGDB Administrator1-1/+1
2019-03-06Use SCOPE_EXIT in write_gcore_fileTom Tromey2-17/+7
This replaces a TRY/CATCH in write_gcore_file with a use of SCOPE_EXIT instead. I find that this is simpler to understand. 2019-03-06 Tom Tromey <tom@tromey.com> * gcore.c (write_gcore_file): Use SCOPE_EXIT.
2019-03-06Remove free_current_contentsTom Tromey3-31/+5
free_current_contents is no longer used, so this patch removes it. 2019-03-06 Tom Tromey <tom@tromey.com> * utils.h (free_current_contents): Don't declare. * utils.c (free_current_contents): Remove.
2019-03-06Remove basic cleanup codeTom Tromey7-217/+31
This removes the basic cleanup code: make_cleanups, do_cleanups, discard_cleanups, and friends. This code is no longer needed, as nothing in gdb makes an ordinary cleanup. Final cleanups are still needed. 2019-03-06 Tom Tromey <tom@tromey.com> * top.c (quit_force): Update. * main.c (captured_command_loop): Update. * common/new-op.c (operator new): Update. * common/common-exceptions.c (struct catcher) <save_cleanup_chain>: Remove member. (exceptions_state_mc_init): Update. (exception_try_scope_entry): Return nullptr. (exception_try_scope_exit, exception_rethrow) (throw_exception_sjlj, throw_exception_cxx): Update. * common/cleanups.h (make_cleanup, make_cleanup_dtor) (all_cleanups, do_cleanups, discard_cleanups) (discard_final_cleanups, save_cleanups, save_final_cleanups) (restore_cleanups, restore_final_cleanups): Don't declare. (do_final_cleanups): Remove parameter. * common/cleanups.c (cleanup_chain, make_cleanup) (make_cleanup_dtor, all_cleanups, do_cleanups) (discard_my_cleanups, discard_cleanups) (discard_final_cleanups, save_my_cleanups, save_cleanups) (save_final_cleanups, restore_my_cleanups, restore_cleanups) (null_cleanup): Remove. (do_final_cleanups): Remove parameter.
2019-03-06Use unique_xmalloc_ptr in remote.cTom Tromey2-5/+9
This removes a cleanup from remote.c, replacing it with unique_xmalloc_ptr. 2019-03-06 Tom Tromey <tom@tromey.com> * remote.c (remote_target::remote_parse_stop_reply): Use unique_xmalloc_ptr.
2019-03-06Remove last cleanups from stabsread.cTom Tromey2-46/+47
This removes the last cleanups from stabsread.c. Similar code in dwarf2read.c was C++-ified, but considering that stabs are deprecated, it seemed simpler to just change these allocations to use an obstack and leave the data structures in place. This patch renames field_info to stabs_field_info -- adding a constructor here provoked a bug due to the resulting ODR violation. 2019-03-06 Tom Tromey <tom@tromey.com> * stabsread.c (struct stabs_field_info): Rename from field_info. <list, fnlist>: Add initializers. <obstack>: New member. (read_member_functions, read_struct_fields, read_baseclasses): Allocate on obstack. Don't use cleanups. (read_one_struct_field, read_member_functions, read_struct_fields) (read_baseclasses, read_tilde_fields, attach_fn_fields_to_type) (attach_fields_to_type, read_cpp_abbrev, read_member_functions) (read_struct_type): Update.
2019-03-06Remove last cleanup from linux-namespaces.cTom Tromey4-51/+22
This removes the last cleanup from linux-namespaces.c, replacing it with a use of SCOPE_EXIT. 2019-03-06 Tom Tromey <tom@tromey.com> * nat/linux-namespaces.c (linux_mntns_access_fs): Use SCOPE_EXIT. * common/filestuff.h (make_cleanup_close): Don't declare. * common/filestuff.c (do_close_cleanup, make_cleanup_close): Remove.
2019-03-06Remove last cleanup solib-aix.cTom Tromey2-4/+10
This removes the last cleanup solib-aix.c, replacing it with a use of make_scope_exit. 2019-03-06 Tom Tromey <tom@tromey.com> * solib-aix.c: Use make_scope_exit.
2019-03-06Remove last cleanups from solib-svr4.cTom Tromey2-7/+15
This removes the last cleanups from solib-svr4.c, replacing them with uses of make_scope_exit. 2019-03-06 Tom Tromey <tom@tromey.com> * solib-svr4.c (svr4_parse_libraries, svr4_current_sos_direct): Use make_scope_exit.
2019-03-06Remove cleanup from solib-svr4.cTom Tromey2-30/+15
This removes a cleanup from solib-svr4.c, replacing it with make_scope_exit. 2019-03-06 Tom Tromey <tom@tromey.com> * solib-svr4.c (disable_probes_interface): Remove parameter. (svr4_handle_solib_event): Use make_scope_exit.
2019-03-06Remove last cleanup from gdbserverTom Tromey2-5/+11
This removes the last cleanup from gdbserver, replacing it with SCOPE_EXIT. This could perhaps be done in a different way, but this approach was direct and obviously correct. 2019-03-06 Tom Tromey <tom@tromey.com> * server.c (detach_or_kill_for_exit_cleanup): Remove parameter. (captured_main): Use SCOPE_EXIT.
2019-03-06C++ify remote notification codeTom Tromey4-99/+59
This C++ifies the remote notification code -- replacing function pointers with virtual methods and using unique_ptr. This allows for the removal of some cleanups. 2019-03-06 Tom Tromey <tom@tromey.com> * remote.c (struct stop_reply_deleter): Remove. (stop_reply_up): Update. (struct stop_reply): Derive from notif_event. Don't typedef. <regcache>: Now a std::vector. (stop_reply_xfree): Remove. (stop_reply::~stop_reply): Rename from stop_reply_dtr. (remote_notif_stop_alloc_reply): Return a unique_ptr. Use new. (remote_target::discard_pending_stop_replies): Use delete. (remote_target::remote_parse_stop_reply): Update. (remote_target::process_stop_reply): Update. * remote-notif.h (struct notif_event): Add virtual destructor. Remove "dtr" member. (struct notif_client) <alloc_event>: Return a unique_ptr. (notif_event_xfree): Don't declare. (notif_event_up): New typedef. * remote-notif.c (remote_notif_ack, remote_notif_parse): Update. (notif_event_xfree, do_notif_event_xfree): Remove. (remote_notif_state_xfree): Update.
2019-03-06Change displaced_step_clear_cleanup to a forward_scope_exitTom Tromey2-19/+18
This changes displaced_step_clear_cleanup to be a forward_scope_exit and updates the callers. gdb/ChangeLog 2019-03-06 Tom Tromey <tom@tromey.com> * infrun.c (displaced_step_clear_cleanup): Now a forward_scope_exit type. (displaced_step_prepare_throw): Update. (displaced_step_fixup): Update.
2019-03-06Update two cleanup commentsTom Tromey3-2/+7
This updates another couple of comments to remove mentions of cleanups. gdb/ChangeLog 2019-03-06 Tom Tromey <tom@tromey.com> * inferior.h (class inferior): Update comment. * gdbthread.h (class thread_info): Update comment.
2019-03-06Remove cleanups from coffread.cTom Tromey4-109/+72
This removes the remaining cleanups from coffread.c. Tested by the buildbot and also some manual testing. This version includes the fix provided by Joel. gdb/ChangeLog 2019-03-06 Joel Brobecker <brobecker@adacore.com> Tom Tromey <tom@tromey.com> * stabsread.h (struct stab_section_list): Remove. (coffstab_build_psymtabs): Update. * dbxread.c (symbuf_sections): Now a std::vector. (sect_idx): New global. (fill_symbuf): Update. (coffstab_build_psymtabs): Change type of stabsects parameter. Update. * coffread.c (struct coff_symfile_info) <stabsects>: Now a std::vector. (linetab, linetab_offset, linetab_size, stringtab): Move earlier. (coff_locate_sections): Update. (coff_symfile_read): Remove cleanups. Update. (init_stringtab): Add storage parameter. (free_stringtab, free_stringtab_cleanup): Remove. (init_lineno): Add storage parameter. (free_linetab, free_linetab_cleanup): Remove.
2019-03-06Eliminate fork_info::clobber_regsPedro Alves2-44/+45
All fork_save_infrun_state callers pass '1' as CLOBBER_REGS nowadays. The larger hunk in fork_save_infrun_state is just a reindentation. gdb/ChangeLog: 2019-03-06 Pedro Alves <palves@redhat.com> * linux-fork.c (fork_info::clobber_regs): Delete. (fork_load_infrun_state): Remove reference to 'clobber_regs'. (fork_save_infrun_state): Remove 'clobber_regs' parameter. Update comment. Adjust. (scoped_switch_fork_info::scoped_switch_fork_info) (checkpoint_command, linux_fork_context): Adjust fork_save_infrun_state calls.
2019-03-06linux-fork.c: rewrite inf_has_multiple_threadsPedro Alves2-20/+15
There's no need to iterate over all threads of all inferiors here. gdb/ChangeLog: 2019-03-06 Pedro Alves <palves@redhat.com> * linux-fork.c (inf_has_multiple_thread_cb): Delete. (inf_has_multiple_threads): Return 'bool' and rewrite using inferior_info::threads().
2019-03-06C++ify fork_info, use std::listPedro Alves2-153/+125
- Convert new_fork and free_fork to fork_info ctor/dtor. - Use std::list. gdb/ChangeLog: 2019-03-06 Pedro Alves <palves@redhat.com> * linux-fork.c: Include <list>. (fork_list): Now a std::list instance. (fork_info): Add ctor, dtor, and in-class initialize all fields. (forks_exist_p, find_last_fork): Adjust. (new_fork): Delete. (one_fork_p): New. (add_fork): Adjust. (free_fork): Delete, folded into fork_info::~fork_info(). (delete_fork, find_fork_ptid, find_fork_id, find_fork_pid): Adjust. (init_fork_list): Delete. (linux_fork_killall, linux_fork_mourn_inferior) (linux_fork_detach, info_checkpoints_command): Adjust. (_initialize_linux_fork): No longer call init_fork_list.
2019-03-06Make "checkpoint" not rely on inferior_ptidPedro Alves3-17/+37
Don't rely on "inferior_ptid" deep within add_fork. In the multi-target branch, I'm forcing inferior_ptid to null_ptid early in infrun event handling to make sure we don't inadvertently rely on the current thread/target when we shouldn't, and that caught some bad or unnecessary assumptions throughout. gdb/ChangeLog: 2019-03-06 Pedro Alves <palves@redhat.com> * linux-fork.c (new_fork): New, split out of ... (add_fork): ... this. Return void. Move "first fork" special case from here, to ... (checkpoint_command): ... here. * linux-linux.h (add_fork): Return void.
2019-03-06gdb/fortran: Handle older TYPE*SIZE typenamesAndrew Burgess4-0/+33
This patch adds support for the older TYPE*SIZE typenames that are still around in older code. For implementation this currently reuses the kind mechanism, as under gFortran the kind number is equivalent to the size, however, this is not necessarily true for all compilers. If the rules for other compilers are better understood then this code might need to be improved slightly to allow for a distinction between size and kind, however, adding this extra complexity now seems pointless. gdb/ChangeLog: * f-exp.y (direct_abs_decl): Handle TYPE*SIZE type names. gdb/testsuite/ChangeLog: * gdb.fortran/type-kinds.exp: Extend to cover TYPE*SIZE cases.
2019-03-06gdb/fortran: Add support for the ABS intrinsic functionAndrew Burgess5-1/+70
Adds support for the abs intrinsic function, this requires adding a new pattern to the Fortran parser. Currently only float and integer argument types are supported to ABS, complex is still not supported, this can be added later if needed. gdb/ChangeLog: * f-exp.y: New token, UNOP_INTRINSIC. (exp): New pattern using UNOP_INTRINSIC token. (f77_keywords): Add 'abs' keyword. * f-lang.c: Add 'target-float.h' and 'math.h' includes. (value_from_host_double): New function. (evaluate_subexp_f): Support UNOP_ABS. gdb/testsuite/ChangeLog: * gdb.fortran/intrinsics.exp: Extend to cover ABS.
2019-03-06gdb/fortran: Use TYPE_CODE_CHAR for character typesAndrew Burgess4-2/+11
Switch to using TYPE_CODE_CHAR for character types. This appears to have little impact on the test results as gFortran uses the DW_TAG_string_type to represent all character variables (as far as I can see). The only place this has an impact is when the user casts a variable to a character type, in which case GDB does now use the CHAR type, and prints the variable as both a value and a character, for example, before: (gdb) p ((character) 97) $1 = 97 and after: (gdb) p ((character) 97) $1 = 97 'a' gdb/ChangeLog: * f-lang.c (build_fortran_types): Use TYPE_CODE_CHAR for character types. gdb/testsuite/ChangeLog: * gdb.fortran/type-kinds.exp: Update expected results.
2019-03-06gdb/fortran: Add builtin 8-byte integer type with (kind=8) supportAndrew Burgess6-0/+18
Add a new builtin type, an 8-byte integer, and allow GDB to parse 'integer (kind=8)', returning the new 8-byte integer. gdb/ChangeLog: * f-exp.y (convert_to_kind_type): Handle integer (kind=8). * f-lang.c (build_fortran_types): Setup builtin_integer_s8. * f-lang.h (struct builtin_f_type): Add builtin_integer_s8 field. gdb/testsuite/ChangeLog: * gdb.fortran/type-kinds.exp: Test new integer type kind.
2019-03-06gdb/fortran: Expand the set of types that support (kind=N)Andrew Burgess4-1/+87
Expand the number of types that can be adjusted with a (kind=N) type extension. gdb/ChangeLog: * f-exp.y (convert_to_kind_type): Handle more type kinds. gdb/testsuite/ChangeLog: * gdb.fortran/type-kinds.exp (test_cast_1_to_type_kind): New function. (test_basic_parsing_of_type_kinds): Expand types tested. (test_parsing_invalid_type_kinds): New function.
2019-03-06gdb/fortran: Add Fortran 'kind' intrinsic and keywordAndrew Burgess11-4/+249
The 'kind' keyword has two uses in Fortran, it is the name of a builtin intrinsic function, and it is also a keyword used to create a type of a specific kind. This commit adds support for using kind as an intrinsic function, and also adds some initial support for using kind to create types of a specific kind. This commit only allows the creation of the type 'character(kind=1)', however, it will be easy enough to extend this in future to support more type kinds. The kind of any expression can be queried using the kind intrinsic function. At the moment the kind returned corresponds to the size of the type, this matches how gfortran handles kinds. However, the correspondence between kind and type size depends on the compiler and/or the specific target, so this might not be correct for everyone. If we want to support different compilers/targets in future the code to compute the kind from a type will need to be updated. gdb/ChangeLog: * expprint.c (dump_subexp_body_standard): Support UNOP_KIND. * f-exp.y: Define 'KIND' token. (exp): New pattern for KIND expressions. (ptype): Handle types with a kind extension. (direct_abs_decl): Extend to spot kind extensions. (f77_keywords): Add 'kind' to the list. (push_kind_type): New function. (convert_to_kind_type): New function. * f-lang.c (evaluate_subexp_f): Support UNOP_KIND. * parse.c (operator_length_standard): Likewise. * parser-defs.h (enum type_pieces): Add tp_kind. * std-operator.def: Add UNOP_KIND. gdb/testsuite/ChangeLog: * gdb.fortran/intrinsics.exp: New file. * gdb.fortran/intrinsics.f90: New file. * gdb.fortran/type-kinds.exp: New file.
2019-03-06gdb/fortran: Enable debugging of the Fortran parserAndrew Burgess2-0/+6
This commit allows 'set debug parser on' to work for the Fortran parser. gdb/ChangeLog: * f-exp.y (f_parse): Set yydebug.
2019-03-06gdb/fortran: Add new function to evaluate Fortran expressionsAndrew Burgess2-1/+28
This is an initial restructure, it adds a new function in which Fortran specific expressions can be evaluated. No Fortran specific expressions are added with this commit though, so for now, the new function just forwards all expressions to the default expression handler, as such, there should be no user visible changes after this commit. However, the new function will be useful in later commits. gdb/ChangeLog: * f-lang.c (evaluate_subexp_f): New function. (exp_descriptor_f): New global. (f_language_defn): Use exp_descriptor_f instead of exp_descriptor_standard.
2019-03-06gdb/fortran: Simplify handling of Fortran dot operations and keywordsAndrew Burgess4-52/+189
Use strncasecmp to compare Fortran dot operations (like .AND.) and for the keywords list. This allows for some duplication to be removed from the token arrays. I've also performed whitespace cleanup around the code I've changed. I have added some tests to ensure that upper and lowercase dot operations are correctly tested. The keywords list remains always lowercase for now. There should be no user visible changes after this commit. gdb/ChangeLog: * f-exp.y (struct token): Add comments. (dot_ops): Remove uppercase versions and the end marker. (f77_keywords): Likewise. (yylex): Use ARRAY_SIZE to iterate over dot_ops, assert all entries in the dot_ops array are case insensitive, and use strncasecmp to compare strings. Also some whitespace cleanup in this area. Similar for the f77_keywords array, except entries in this list might be case sensitive. gdb/testsuite/ChangeLog: * gdb.fortran/dot-ops.exp: New file.
2019-03-06gdb/fortran: Cleanup code for parsing logical constantsAndrew Burgess4-17/+36
This patch cleans up the code used for parsing the Fortran logical constants '.TRUE.' and '.FALSE.'. Instead of listing both upper and lowercase versions of these strings we now use strncasecmp. I've also switched to use ARRAY_SIZE for the array iteration, and I've cleaned up whitespace in the vicinity of the code I've changed. Finally, I've added a test to ensure that both the upper and lower case versions of the logical constants are understood by GDB, something that was missing previously. There should be no user visible changes after this commit. gdb/ChangeLog: * f-exp.y (struct f77_boolean_val): Add comments. (boolean_values): Remove uppercase versions, and end marker. (yylex): Use ARRAY_SIZE for iterating over boolean_values array, and use strncasecmp to achieve case insensitivity. Additionally, perform whitespace cleanup around this code. gdb/testsuite/ChangeLog: * gdb.fortran/types.exp (test_logical_literal_types_accepted): Check upper and lower case logical literals.
2019-03-06gdb/fortran: Remove some duplicate testsAndrew Burgess2-4/+5
Make the test names unique in gdb.fortran/types.exp by removing a few duplicate tests. gdb/testsuite/ChangeLog: * gdb.fortran/types.exp (test_float_literal_types_accepted): Remove duplicate tests.
2019-03-06Allow the use of the ORIGIN and LENGTH attributes in expressions inside ↵Nick Bowler2-24/+26
MEMORY regions. PR 24289 * ldexp.c (fold_name): Allow lookups of the LENGTH and ORIGIN attributes during the first phase.
2019-03-06Fix remote-sim.c build after warn-unused-result changeTom Tromey2-3/+7
John Darrington pointed out that commit 18cb7c9f3 ("Introduce ATTRIBUTE_UNUSED_RESULT and use it") broke the build: /home/john/binutils-gdb/gdb/remote-sim.c: In function 'void gdbsim_target_open(const char*, int)': /home/john/binutils-gdb/gdb/remote-sim.c:765:18: error: ignoring return value of 'char** gdb_argv::release()', declared with attribute warn_unused_result [-Werror=unused-result] This patch fixes the problem by arranging to use the result of the release method. Tested by rebuilding with a simulator enabled. gdb/ChangeLog 2019-03-06 Tom Tromey <tromey@adacore.com> * remote-sim.c (gdbsim_target_open): Use result of gdb_argv::release.
2019-03-06Testsuite: Ensure changing directory does not break the log fileAlan Hayward2-2/+43
get_compiler_info switches to a new log file before checking the compiler to ensure the checks are not logged. Afterwards it restores back to using the original log file. However, the logfile uses a relative path name - if the current test has changed the current directory then all further output for the test will be lost. This can confuse the code that collates the main gdb.log file at the end of a FORCE_PARALLEL run. fullpath-expand.exp calls gdb_compile after changing the current directory. The "Ensure stack protection is off for GCC" patch added a call to get_compiler_info from inside of gdb_compile, causing log file collection to break for FORCE_PARALLEL runs. The ideal solution would be to ensure the log file is always created using an absolute path name. However, this is set at multiple points in Makefile.in and in some instances just relies on dejagnu common code to set the log file directory to "." The simpler and safer solution is to override the builtin cd function. The new function checks the current log file and if the path is relative, then it resets the logging using an absolute path. Finally it calls the builtin cd. This ensures get_compiler_info (and any other code) can correctly backup and restore the current log file. gdb/testsuite/ChangeLog: * lib/gdb.exp (builtin_cd): rename of cd. (cd): Override builtin.
2019-03-06Fix a segmentation fault triggered by disassembling an EFi file with source ↵Nick Clifton3-3/+11
included. * dwarf2.c (_bfd_dwarf2_find_symbol_bias): Check for a NULL symbol table pointer. * coffgen.c (coff_find_nearest_line_with_names): Do not call _bfd_dwarf2_find_symbol_bias if there is no symbol table available. https://bugzilla.redhat.com/show_bug.cgi?id=1685727
2019-03-06Fortran function calls with argumentsRichard Bunt8-3/+457
Prior to this patch, calling functions on the inferior with arguments and then using these arguments within a function resulted in an invalid memory access. This is because Fortran arguments are typically passed as pointers to values. It is possible to call Fortran functions, but memory must be allocated in the inferior, so a pointer can be passed to the function, and the language must be set to C to enable C-style casting. This is cumbersome and not a pleasant debug experience. This patch implements the GNU Fortran argument passing conventions with caveats. Firstly, it does not handle the VALUE attribute as there is insufficient DWARF information to determine when this is the case. Secondly, functions with optional parameters can only be called with all parameters present. Both these cases are marked as KFAILS in the test. Since the GNU Fortran argument passing convention has been implemented, there is no guarantee that this patch will work correctly, in all cases, with other compilers. Despite these limitations, this patch improves the ease with which functions can be called in many cases, without taking away the existing approach of calling with the language set to C. Regression tested on x86_64, aarch64 and POWER9 with GCC 7.3.0. Regression tested with Ada on x86_64. Regression tested with native-extended-gdbserver target board. gdb/ChangeLog: * eval.c (evaluate_subexp_standard): Call Fortran argument wrapping logic. * f-lang.c (struct value): A value which can be passed into a Fortran function call. (fortran_argument_convert): Wrap Fortran arguments in a pointer where appropriate. (struct type): Value ready for a Fortran function call. (fortran_preserve_arg_pointer): Undo check_typedef, the pointer is needed. * f-lang.h (fortran_argument_convert): Declaration. (fortran_preserve_arg_pointer): Declaration. * infcall.c (value_arg_coerce): Call Fortran argument logic. gdb/testsuite/ChangeLog: * gdb.fortran/function-calls.exp: New file. * gdb.fortran/function-calls.f90: New test.