aboutsummaryrefslogtreecommitdiff
path: root/gdb
AgeCommit message (Collapse)AuthorFilesLines
2018-07-19Eliminate remaining gdb/guile cleanupsPedro Alves9-80/+62
The remaining gdb/guile cleanups all handle the memory returned by gdbscm_scm_to_c_string. This commit makes gdbscm_scm_to_c_string return a gdb::unique_xmalloc_ptr instead of a naked pointer, and eliminates the remaining cleanups. gdb/ChangeLog: 2018-07-19 Pedro Alves <palves@redhat.com> * guile/guile-internal.h (gdbscm_scm_to_c_string): Now returns a gdb::unique_xmalloc_ptr. * guile/scm-breakpoint.c (gdbscm_set_breakpoint_condition_x): Adjust to use dbscm_wrap and gdb::unique_xmalloc_ptr. * guile/scm-exception.c (gdbscm_exception_message_to_string): Use copy-initialization. * guile/scm-pretty-print.c (ppscm_print_children): Use gdb::unique_xmalloc_ptr instead of cleanups. (gdbscm_apply_val_pretty_printer): Remove cleanups. * guile/scm-string.c (gdbscm_scm_to_c_string): Now returns a gdb::unique_xmalloc_ptr. * guile/scm-type.c (gdbscm_type_field, gdbscm_type_has_field_p): Adjust to use gdb::unique_xmalloc_ptr. * guile/scm-utils.c (extract_arg): Adjust. * guile/scm-value.c (gdbscm_value_field): Adjust to use gdb::unique_xmalloc_ptr instead of a cleanup.
2018-07-19Remove make_cleanup_value_free_to_markTom Tromey3-21/+6
Pedro's patch to introduce gdbscm_wrap removed the last caller of make_cleanup_value_free_to_mark. This patch removes this function. I'm checking this in as obvious. Tested by rebuilding, and by grepping. gdb/ChangeLog 2018-07-19 Tom Tromey <tom@tromey.com> * utils.c (do_value_free_to_mark) (make_cleanup_value_free_to_mark): Remove. * utils.h (make_cleanup_value_free_to_mark): Remove.
2018-07-19[gdb/testsuite] Fix regexp in list-thread-groups-available.expTom de Vries2-1/+6
I ran into a gdb.mi/list-thread-groups-available.exp failure: ... Running gdb/testsuite/gdb.mi/list-thread-groups-available.exp ... FAIL: gdb.mi/list-thread-groups-available.exp: list available thread groups (unexpected output) PASS: gdb.mi/list-thread-groups-available.exp: list available thread groups with filter ... When doing an experiment of running it 100 times in a row, the failure reproduced 3 times. Analyzing the original failure led to insufficient quoting of square brackets in a regexp. This patch fixes the regexp, which resulted in 0 failures in a 100-in-a-row run. Tested on x86_64-linux. 2018-07-19 Tom de Vries <tdevries@suse.de> * gdb.mi/list-thread-groups-available.exp (cores_re): Fix quoting in regular expression.
2018-07-19gdbscm_wrap, really forward argsPedro Alves2-1/+6
Commit 557e56be2648 ("Eliminate most remaining cleanups under gdb/guile/") missed adding the && to Args to really forward the arguments properly. Noticed by inspection. gdb/ChangeLog: 2018-07-19 Pedro Alves <palves@redhat.com> * guile/guile-internal.h (gdbscm_wrap): Really make 'args' a forwarding reference.
2018-07-18Eliminate cleanup in gdbscm_execute_gdb_commandPedro Alves2-21/+14
Note: the "may be modified" comment is no longer true nowadays. gdb/ChangeLog: 2018-07-18 Pedro Alves <palves@redhat.com> * guile/guile.c (gdbscm_execute_gdb_command): Adjust to use gdbscm_wrap. Use gdb::unique_xmalloc_ptr<char> instead of a cleanup.
2018-07-18Eliminate most remaining cleanups under gdb/guile/Pedro Alves7-561/+398
The main complication with the Guile code is that we have two types of exceptions to consider. GDB/C++ exceptions, and Guile/SJLJ exceptions. Code that is facing the Guile interpreter must not throw GDB exceptions, instead Scheme exceptions must be thrown. Also, because Guile exceptions are SJLJ based, Guile-facing code must not use local objects with dtors, unless wrapped in a scope with a TRY/CATCH, because the dtors won't otherwise be run when a Guile exceptions is thrown. This commit adds a new gdbscm_wrap wrapper function than encapsulates a pattern I noticed in many of the functions using GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS. The wrapper is written such that you can pass either a lambda to it, or a function plus a variable number of forwarded args. I used a lambda when its body would be reasonably short, and a separate function in the larger cases. This also convers a few functions that were using GDBSCM_HANDLE_GDB_EXCEPTION to use gdbscm_wrap too because they followed a similar pattern. A few cases of make_cleanup calls are replaced with explicit xfree calls. The make_cleanup/do_cleanups calls in those cases are pointless, because do_cleanups won't be called when a Scheme exception is thrown. We also have a couple cases of Guile-facing code using RAII-type objects to manage memory, but those are incorrect, exactly because their dtor won't be called if a Guile exception is thrown. gdb/ChangeLog: 2018-07-18 Pedro Alves <palves@redhat.com> * guile/guile-internal.h: Add comment about mixing GDB and Scheme exceptions. (GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS): Delete. (gdbscm_wrap): New. * guile/scm-frame.c (gdbscm_frame_read_register): Use xfree directly instead of a cleanup. * guile/scm-math.c (vlscm_unop_gdbthrow): New, factored out from ... (vlscm_unop): ... this. Reimplement using gdbscm_wrap. (vlscm_binop_gdbthrow): New, factored out from ... (vlscm_binop): ... this. Reimplement using gdbscm_wrap. (vlscm_rich_compare): Use gdbscm_wrap. * guile/scm-symbol.c (gdbscm_lookup_symbol): Use xfree directly instead of a cleanup. (gdbscm_lookup_global_symbol): Use xfree directly instead of a cleanup. * guile/scm-type.c (gdbscm_type_field, gdbscm_type_has_field_p): Use xfree directly instead of a cleanup. * guile/scm-value.c (gdbscm_make_value, gdbscm_make_lazy_value): Adjust to use gdbscm_wrap and scoped_value_mark. (gdbscm_value_optimized_out_p): Adjust to use gdbscm_wrap. (gdbscm_value_address, gdbscm_value_dereference) (gdbscm_value_referenced_value): Adjust to use gdbscm_wrap and scoped_value_mark. (gdbscm_value_dynamic_type): Use scoped_value_mark. (vlscm_do_cast, gdbscm_value_field): Adjust to use gdbscm_wrap and scoped_value_mark. (gdbscm_value_subscript, gdbscm_value_call): Adjust to use gdbscm_wrap and scoped_value_mark. (gdbscm_value_to_string): Use xfree directly instead of a cleanup. Move 'buffer' unique_ptr to TRY scope. (gdbscm_value_to_lazy_string): Use xfree directly instead of a cleanup. Move 'buffer' unique_ptr to TRY scope. Use scoped_value_mark. (gdbscm_value_fetch_lazy_x): Use gdbscm_wrap. (gdbscm_parse_and_eval): Adjust to use gdbscm_wrap and scoped_value_mark. (gdbscm_history_ref, gdbscm_history_append_x): Adjust to use gdbscm_wrap.
2018-07-18[gdb/exp] Fix printing of type of optimized out vlaTom de Vries5-0/+86
Consider this snippet from gcc/testsuite/gcc.dg/guality/vla-1.c: ... int __attribute__((noinline)) f1 (int i) { char a[i + 1]; a[0] = 5; /* { dg-final { gdb-test .+1 "i" "5" } } */ return a[0]; /* { dg-final { gdb-test . "sizeof (a)" "6" } } */ } ... When we compile the test-case with -O1 -g, and query the size of optimized out vla 'a', we get: ... $ ./gdb -batch -ex "b f1" -ex "r" -ex "p sizeof (a)" vla-1.exe Breakpoint 1 at 0x4004a8: file vla-1.c, line 17. Breakpoint 1, f1 (i=i@entry=5) at vla-1.c:17 17 return a[0]; $1 = 0 ... while we expect a size of '6'. The problem is that default_read_var_value does not resolve the dynamic type of a variable if the variable is optimized out. This patch fixes that, and consequently gdb prints '6', as expected. Tested on x86_64-linux. 2018-07-18 Tom de Vries <tdevries@suse.de> * findvar.c (default_read_var_value): Also resolve dynamic type for LOC_OPTIMIZED_OUT vars. * gdb.base/vla-optimized-out.c: New test. * gdb.base/vla-optimized-out.exp: New file.
2018-07-18microMIPS: Add SYSCALL instruction decodingMaciej W. Rozycki2-6/+29
Fix a bug with commit 4cc0665f24bb ("microMIPS support"), <https://sourceware.org/ml/gdb-patches/2012-05/msg00724.html>, and add missing microMIPS SYSCALL instruction decoding needed to determine the location to put a breakpoint at when single-stepping though a syscall. gdb/ * mips-tdep.c (micromips_next_pc): Add SYSCALL instruction decoding.
2018-07-17Return unique_xmalloc_ptr from gdbscm_scm_to_stringTom Tromey7-53/+51
This changes gdbscm_scm_to_string to return a unique_xmalloc_ptr and then fixes all the callers. This allows for the removal of some cleanups. gdb/ChangeLog 2018-07-17 Tom Tromey <tom@tromey.com> * guile/scm-param.c (pascm_set_func, pascm_show_func) (compute_enum_list, pascm_set_param_value_x) (gdbscm_parameter_value): Update. * guile/guile-internal.h (gdbscm_scm_to_string): Update. (gdbscm_scm_to_host_string): Update. * guile/scm-math.c (vlscm_convert_typed_value_from_scheme): Update. * guile/scm-cmd.c (cmdscm_add_completion): Update. * guile/scm-pretty-print.c (ppscm_print_string_repr): Update. * guile/scm-string.c (gdbscm_scm_to_string): Return unique_xmalloc_ptr. (gdbscm_scm_to_host_string): Likewise.
2018-07-17Return unique_xmalloc_ptr from gdbscm_safe_eval_stringTom Tromey5-29/+21
This changes gdbscm_safe_eval_string to return a unique_xmalloc_ptr. This allows for the removal of some cleanups. It also fixes a potential latent memory leak in gdbscm_set_backtrace. gdb/ChangeLog 2018-07-17 Tom Tromey <tom@tromey.com> * guile/guile.c (gdbscm_eval_from_control_command): Update. * guile/guile-internal.h (gdbscm_safe_eval_string): Update. * guile/scm-objfile.c (gdbscm_execute_objfile_script): Update. * guile/scm-safe-call.c (gdbscm_safe_eval_string): Return unique_xmalloc_ptr.
2018-07-17Change gdbscm_exception_message_to_string to return a unique_xmalloc_ptrTom Tromey6-23/+31
This changes gdbscm_exception_message_to_string to return a unique_xmalloc_ptr, allowing for the removal of some cleanups. unique_xmalloc_ptr was chosen because at the root of the call chains is a function from Guile that returns a malloc'd string. gdb/ChangeLog 2018-07-17 Tom Tromey <tom@tromey.com> * guile/scm-param.c (pascm_signal_setshow_error): Update. * guile/guile-internal.h (gdbscm_exception_message_to_string): Update. * guile/scm-cmd.c (cmdscm_function): Update. * guile/scm-pretty-print.c (ppscm_print_exception_unless_memory_error): Update. * guile/scm-exception.c (gdbscm_exception_message_to_string): Return unique_xmalloc_ptr.
2018-07-17Use std::string in ppscm_make_pp_type_error_exceptionTom Tromey2-10/+9
This changes ppscm_make_pp_type_error_exception to use std::string, removing a cleanup. gdb/ChangeLog 2018-07-17 Tom Tromey <tom@tromey.com> * guile/scm-pretty-print.c (ppscm_make_pp_type_error_exception): Use string_printf.
2018-07-17RISC-V: Don't decrement pc after break.Jim Wilson2-23/+8
gdb/ * riscv-tdep.c (riscv_has_feature): Delete comment that refers to set_gdbarch_decr_pc_after_break. Call riscv_read_misa_reg always. (riscv_gdbarch_init): Delete local has_compressed_isa. Delete now unecessary braces after EF_RISCV_RVC test. Delete call to set_gdbarch_decr_pc_after_break.
2018-07-17RISC-V: Correct legacy misa register number.Jim Wilson2-2/+8
gdb/ * riscv-tdep.h (DECLARE_CSR): Use RISCV_FIRST_CSR_REGNUM instead of RISCV_LAST_FP_REGNUM + 1. (RSICV_CSR_LEGACY_MISA_REGNUM): Add RISCV_FIRST_CSR_REGNUM.
2018-07-17Remove --disable-gdbcliTom Tromey5-56/+15
I think it doesn't really make sense to allow building gdb without the CLI. Perhaps at one time this was a goal, but libgdb is long gone and the CLI is intrinsic to gdb. So, this patch removes the implementation of this configure option. It is still recognized (this is autoconf's default), but does nothing. This simplifies configure.ac and Makefile.in a bit. Tested by rebuilding. gdb/ChangeLog 2018-07-17 Tom Tromey <tom@tromey.com> * configure.ac: Remove --disable-gdbcli. * configure: Rebuild. * Makefile.in (SUBDIR_CLI_DEPS, SUBDIR_CLI_LDFLAGS) (SUBDIR_CLI_CFLAGS): Remove. (SFILES): Use SUBDIR_CLI_SRCS. (COMMON_OBS): Use SUBDIR_CLI_OBS.
2018-07-17Use scoped_free_pendings in coff_symtab_readTom Tromey2-0/+8
PR gdb/18624 concerns an assertion failure that occurs when setting a breakpoint in a Go program on Windows. What happens here is that coff_symtab_read uses buildsym but does not instantiate scoped_free_pendings. So, the struct pending objects are never released. Later, dwarf2read.c calls buildsym_init, which asserts. This patch fixes the problem by instantiating scoped_free_pendings in coff_symtab_read. Tested using the test executable from the PR. I don't know how to test this more fully. gdb/ChangeLog 2018-07-17 Tom Tromey <tom@tromey.com> PR gdb/18624: * coffread.c (coff_symtab_read): Use scoped_free_pendings.
2018-07-16RISC-V: Add osabi support.Jim Wilson2-0/+7
gdb/ * riscv-tdep.c (riscv_gdbarch_init): Call gdbarch_init_osabi.
2018-07-16Add missing ChangeLog entrySimon Marchi1-0/+12
I forgot (yes, again) the ChangeLog entry in my latest patch.
2018-07-16Remove unused variables in ia64*tdep.cSimon Marchi3-14/+4
gdb/ChangeLog: * ia64-libunwind-tdep.c (libunwind_frame_cache): Remove unused variable. (libunwind_frame_sniffer): Likewise. (libunwind_frame_prev_register): Likewise. (libunwind_sigtramp_frame_sniffer): Likewise. * ia64-tdep.c (ia64_access_reg): Likewise. (ia64_access_rse_reg): Likewise. (ia64_libunwind_sigtramp_frame_this_id): Likewise. * ia64-vms-tdep.c (ia64_vms_find_proc_info_x): Likewise.
2018-07-16Fix compilation error in ia64-vms-tdep.c with libunwind-ia64Simon Marchi2-1/+5
I found this when doing a --enable-targets=all build with libunwind-ia64 properly configured. CXX ia64-vms-tdep.o /home/emaisin/src/binutils-gdb/gdb/ia64-vms-tdep.c: In function ‘int ia64_vms_find_proc_info_x(unw_addr_space_t, unw_word_t, unw_proc_info_t*, int, void*)’: /home/emaisin/src/binutils-gdb/gdb/ia64-vms-tdep.c:79:33: error: invalid conversion from ‘void*’ to ‘gdb_byte* {aka unsigned char*}’ [-fpermissive] pi->unwind_info, pi->unwind_info_size); ^ In file included from /home/emaisin/src/binutils-gdb/gdb/target.h:70:0, from /home/emaisin/src/binutils-gdb/gdb/exec.h:23, from /home/emaisin/src/binutils-gdb/gdb/gdbcore.h:29, from /home/emaisin/src/binutils-gdb/gdb/ia64-vms-tdep.c:25: /home/emaisin/src/binutils-gdb/gdb/target/target.h:35:12: note: initializing argument 2 of ‘int target_read_memory(CORE_ADDR, gdb_byte*, ssize_t)’ extern int target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, ^ gdb/ChangeLog: * ia64-vms-tdep.c (ia64_vms_find_proc_info_x): Add cast.
2018-07-16remote-sim.c: Remove unused variablesSimon Marchi2-6/+5
gdb/ChangeLog: * remote-sim.c (gdbsim_target::close, gdbsim_target::mourn_inferior): Remove unused variables.
2018-07-16Add missing ChangeLog entrySimon Marchi1-0/+6
I forgot to append the ChangeLog entry to the last commit...
2018-07-16Fix compilation error in ia64-tdep.c with libunwind-ia64Simon Marchi1-15/+9
Commit 9018be22e022 ("Make target_read_alloc & al return vectors") failed to update the code in ia64-tdep.c, for HAVE_LIBUNWIND_IA64_H. This patch fixes that. gdb/ChangeLog: * ia64-tdep.c (ktab_buf): New global. (getunwind_table): Return a gdb::optional<gdb::byte_vector>. (get_kernel_table): Adjust.
2018-07-16Use outermost_context_p in more placesTom Tromey5-13/+21
This changes a few explicit checks of context_stack_depth to use outermost_context_p instead. This simplifies some future work. gdb/ChangeLog 2018-07-16 Tom Tromey <tom@tromey.com> * xcoffread.c (read_xcoff_symtab): Use outermost_context_p. * dwarf2read.c (using_directives, new_symbol): Use outermost_context_p. * dbxread.c (process_one_symbol): Use outermost_context_p. * coffread.c (coff_symtab_read): Use outermost_context_p.
2018-07-16Move the using directives to buildsym_compunitTom Tromey5-26/+77
This moves the globals local_using_directives and global_using_directives to be members of buildsym_compunit, and adds the necessary accessors. gdb/ChangeLog 2018-07-16 Tom Tromey <tom@tromey.com> * dwarf2read.c (using_directives, read_func_scope) (read_lexical_block_scope): Update. * cp-namespace.c (cp_scan_for_anonymous_namespaces): Update. * buildsym.h (local_using_directives, global_using_directives): Don't declare. (get_local_using_directives, set_local_using_directives) (get_global_using_directives): Declare. * buildsym.c (struct buildsym_compunit) <m_local_using_directives, m_global_using_directives>: New members. (finish_block_internal, prepare_for_building) (reset_symtab_globals, end_symtab_get_static_block) (push_context): Update. (get_local_using_directives, set_local_using_directives) (get_global_using_directives): New functions. (buildsym_init): Update.
2018-07-16Make free_pending_blocks staticTom Tromey5-8/+20
free_pending_blocks can be static because scoped_free_pendings (et al) arrange for it to be NULL in the "steady state". This removes a couple of unnecessary calls to free_pending_blocks and changes it to be static. gdb/ChangeLog 2018-07-16 Tom Tromey <tom@tromey.com> * xcoffread.c (xcoff_initial_scan): Don't call free_pending_blocks. * dbxread.c (dbx_symfile_read): Don't call free_pending_blocks. * buildsym.h (class scoped_free_pendings): Add constructor. (free_pending_blocks): Don't declare. * buildsym.c (scoped_free_pendings::scoped_free_pendings): New. (free_pending_blocks): Now static.
2018-07-16Move the subfile stack to buildsym_compunitTom Tromey3-28/+24
This moves the global subfile_stack to be a member of buildsym_compunit. It also change this to be a std::vector, which simplifies the code. gdb/ChangeLog 2018-07-16 Tom Tromey <tom@tromey.com> * buildsym.h (push_subfile, pop_subfile): Update declarations. * buildsym.c (struct buildsym_compunit) <m_subfile_stack>: New member. (struct subfile_stack): Remove. (subfile_stack): Remove. (push_subfile, pop_subfile, buildsym_init): Update.
2018-07-16Use gdb_assert in two places in buildsym.cTom Tromey2-10/+7
This changes buildsym.c to use gdb_assert rather than internal_error in a couple of spots. gdb/ChangeLog 2018-07-16 Tom Tromey <tom@tromey.com> * buildsym.c (push_subfile): Use gdb_assert. (pop_subfile): Use gdb_assert.
2018-07-16Remove merge_symbol_listsTom Tromey3-30/+5
I discovered that merge_symbol_lists is unused, so this removes it. gdb/ChangeLog 2018-07-16 Tom Tromey <tom@tromey.com> * buildsym.h (merge_symbol_lists): Remove. * buildsym.c (merge_symbol_lists): Remove.
2018-07-16Move scan_file_globals declaration to stabsread.hTom Tromey4-7/+13
scan_file_globals is defined in stabsread.c, so move its declaration to stabsread.h. gdb/ChangeLog 2018-07-16 Tom Tromey <tom@tromey.com> * stabsread.c (scan_file_globals): Update comment. * stabsread.h (scan_file_globals): Move from buildsym.h. * buildsym.h (scan_file_globals): Move to stabsread.h.
2018-07-16Remove buildsym_new_initTom Tromey8-22/+21
buildsym_new_init is just an alias for buildsym_init. This removes it. In the long run buildsym_init will also go away; this patch just helps make things a bit clearer in the meantime. gdb/ChangeLog 2018-07-16 Tom Tromey <tom@tromey.com> * xcoffread.c (xcoff_new_init): Update. * mipsread.c (mipscoff_new_init): Update. * mdebugread.c (mdebug_build_psymtabs): Update. * elfread.c (elf_new_init): Update. * dbxread.c (dbx_new_init, coffstab_build_psymtabs) (elfstab_build_psymtabs, stabsect_build_psymtabs): Update. * buildsym.h (buildsym_new_init): Don't declare. * buildsym.c (buildsym_new_init): Remove.
2018-07-16Move within_function to stabsreadTom Tromey6-6/+15
The global within_function is only used by a few symbol readers. This patch moves the global out of buildsym and into stabsread, which seemed like a better fit. It also arranges for the existing readers to clear the global at the appropriate time. gdb/ChangeLog 2018-07-16 Tom Tromey <tom@tromey.com> * stabsread.h (within_function): Move from buildsym.h. * stabsread.c (start_stabs): Clear within_function. * coffread.c (coff_start_symtab): Clear within_function. * buildsym.h (within_function): Move to stabsread.h. * buildsym.c (prepare_for_building): Update.
2018-07-16Move processing_gcc to stabsreadTom Tromey4-8/+12
processing_gcc is also only used by stabsread -- it is set by the DWARF reader, but this turns out not to be needed. So, this patch moves processing_gcc and removes the assignment from the DWARF reader. gdb/ChangeLog 2018-07-16 Tom Tromey <tom@tromey.com> * stabsread.h (processing_gcc_compilation): Move from buildsym.h. * dwarf2read.c (dwarf2_start_symtab): Don't set processing_gcc_compilation. * buildsym.h (processing_gcc_compilation): Move to stabsread.h.
2018-07-16Move some code from buildsym to stabsreadTom Tromey5-25/+36
A few things that currently reside in buildsym.c turn out to be specific to the stabs reader. This patch moves these from buildsym.[ch] to stabsread.[ch]. gdb/ChangeLog 2018-07-16 Tom Tromey <tom@tromey.com> * stabsread.h (HASHSIZE, hashname, symnum, next_symbol_text) (next_symbol_text_func): Move from buildsym.h. * stabsread.c (hashname): Move from buildsym.c. * buildsym.h (HASHSIZE, symnum, next_symbol_text) (next_symbol_text_func, hashname): Move to stabsread.h. * buildsym.c: Don't include bcache.h (hashname): Move to stasbread.c.
2018-07-16Make context_stack_size static in buildsym.cTom Tromey3-4/+9
context_stack_size is declared in buildsym.h, but only used in buildsym.c. This makes it static in buildsym.c. gdb/ChangeLog 2018-07-16 Tom Tromey <tom@tromey.com> * buildsym.h (context_stack_size): Don't declare. * buildsym.c (context_stack_size): New global.
2018-07-16Move processing_acc_compilation to dbxread.cTom Tromey3-8/+13
processing_acc_compilation is only used in dbxread.c, so move it there. gdb/ChangeLog 2018-07-16 Tom Tromey <tom@tromey.com> * dbxread.c (processing_acc_compilation): New global. * buildsym.h (processing_acc_compilation): Don't declare.
2018-07-16Move last_source_start_addr to buildsym_compunitTom Tromey6-27/+73
This moves the global last_source_start_addr into buildsym_compunit, adding some accessors as well. gdb/ChangeLog 2018-07-16 Tom Tromey <tom@tromey.com> * xcoffread.c (aix_process_linenos, complete_symtab): Update. * dbxread.c (read_ofile_symtab): Update. * coffread.c (coff_start_symtab, coff_end_symtab): Update. * buildsym.h (last_source_start_addr): Remove. (set_last_source_start_addr, get_last_source_start_addr): Declare. * buildsym.c (buildsym_compunit::buildsym_compunit): Add last_addr parameter. (struct buildsym_compunit) <m_last_source_start_addr>: New member. (prepare_for_building): Remove start_addr parameter. (start_symtab, restart_symtab, end_symtab_get_static_block) (end_symtab_with_blockvector): Update. (set_last_source_start_addr, get_last_source_start_addr): New functions.
2018-07-16Move have_line_numbers to buildsym_compunitTom Tromey2-9/+15
This moves the global have_line_numbers into buildsym_compunit. gdb/ChangeLog 2018-07-16 Tom Tromey <tom@tromey.com> * buildsym.c (struct buildsym_compunit) <m_have_line_numbers>: New member. (have_line_numbers): Remove. (record_line, prepare_for_building, end_symtab_get_static_block) (augment_type_symtab): Update.
2018-07-16Move pending_macros to buildsym_compunitTom Tromey2-28/+39
This moves the pending_macros global into buildsym_compunit. gdb/ChangeLog 2018-07-16 Tom Tromey <tom@tromey.com> * buildsym.c (~buildsym_compunit): Free the macro table. (struct buildsym_compunit) <get_macro_table, release_macros>: New methods. <m_pending_macros>: New member. (pending_macros): Remove. (~scoped_free_pendings, get_macro_table, prepare_for_building) (reset_symtab_globals, end_symtab_get_static_block) (end_symtab_with_blockvector, augment_type_symtab) (buildsym_init): Update.
2018-07-16Move last_source file to buildsym_compunitTom Tromey2-18/+36
This moves the global last_source_file into buildsym_compunit. gdb/ChangeLog 2018-07-16 Tom Tromey <tom@tromey.com> * buildsym.c (buildsym_compunit::buildsym_compunit): Add name parameter. (buildsym_compunit::set_last_source_file): New method. <m_last_source_file>: New member. (prepare_for_building): Remove "name" parameter. (start_symtab, restart_symtab, reset_symtab_globals): Update. (last_source_file): Remove. (set_last_source_file, get_last_source_file): Update.
2018-07-16Add assert in prepare_for_buildingTom Tromey2-0/+5
This adds an assertion in prepare_for_building. This was useful for verifying whether some subsequent changes were valid. gdb/ChangeLog 2018-07-16 Tom Tromey <tom@tromey.com> * buildsym.c (prepare_for_building): Add assert.
2018-07-16Change buildsym_compunit::comp_dir to be a unique_xmalloc_ptrTom Tromey2-6/+12
This change buildsym_compunit::comp_dir to be a unique_xmalloc_ptr. This is just a small cleanup to remove some manual memory management. gdb/ChangeLog 2018-07-16 Tom Tromey <tom@tromey.com> * buildsym.c (~buildsym_compunit): Update. (struct buildsym_compunit) <comp_unit>: Now a unique_xmalloc_ptr. (start_subfile, patch_subfile_names) (end_symtab_with_blockvector): Update.
2018-07-16Use new and delete for buildsym_compunitTom Tromey2-50/+49
This changes buildsym_compunit to use new and delete. gdb/ChangeLog 2018-07-16 Tom Tromey <tom@tromey.com> * buildsym.c (struct buildsym_compunit): Add constructor, destructor, initializers. (start_buildsym_compunit): Remove. (free_buildsym_compunit): Use "delete". (start_symtab, restart_symtab): Use "new".
2018-07-15Fix filename in prior ChangeLog entrySimon Marchi1-4/+5
2018-07-13Remove struct keyword in range-based for loopSimon Marchi2-1/+6
Fix this with gcc 6.3.0: /home/simark/src/binutils-gdb/gdb/symfile.c: In function 'void set_objfile_default_section_offset(objfile*, const section_addr_info&, CORE_ADDR)': /home/simark/src/binutils-gdb/gdb/symfile.c:2114:14: error: types may not be defined in a for-range-declaration [-Werror] for (const struct other_sections *objf_sect : objf_addrs_sorted) ^~~~~~ gdb/ChangeLog: * symfile.c (set_objfile_default_section_offset): Remove struct keyword.
2018-07-14gdb: Add Stafford Horne as or1k maintainer.Stafford Horne2-0/+7
Since I helped upstream openrisc I would like to claim responsibility to maintain it. gdb/ChangeLog: yyyy-mm-dd Stafford Horne <shorne@gmail.com> * (Responsible Maintainers): Add myself as or1k maintainer. Signed-off-by: Stafford Horne <shorne@gmail.com>
2018-07-13Expect for another variant of error message when gdbserver cannot resolve ↵Sergio Durigan Junior2-1/+7
hostname I've noticed that on a few hosts, when given an invalid hostname, gdbserver fails with: spawn /../../gdb/gdbserver/gdbserver --once tcp8:123:2353 /gdb/build/fedora-s390x/build/gdb/testsuite/outputs/gdb.server/server-connect/server-connect tcp8:123:2353: cannot resolve name: No address associated with hostname ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Exiting Unfortunately, this causes a fail on the new gdb.server/server-connect.exp test (introduced by the IPv6 patch): FAIL: gdb.server/server-connect.exp: tcp8: start gdbserver: gdbserver should fail but did not This happens because we're expecting for another variant of this error message: cannot resolve name: Name or service not known Therefore, this patch extends the helper function 'gdbserver_start' to also recognize the "No address associated with hostname" message. This "fixes" the testcase on the hosts that use this variant. gdb/testsuite/ChangeLog: 2018-07-13 Sergio Durigan Junior <sergiodj@redhat.com> * lib/gdbserver-support.exp (gdbserver_start): Expect for the message "No address associated with hostname" when gdbserver cannot resolve the hostname.
2018-07-13Remove a warning on macOSTom Tromey2-1/+6
This removes a clang warning coming from -Wmissing-braces. ChangeLog 2018-07-13 Tom Tromey <tom@tromey.com> * symfile.c (set_objfile_default_section_offset): Use extra braces around initializer.
2018-07-13S390: Fix displaced stepping of "basr r,0"Andreas Arnez2-0/+8
The BASR instruction behaves differently depending on whether the second operand is a number from 1 to 15, or zero. In the former case BASR jumps to the address contained in the general register of that number, but in the latter case no jump is performed. GDB's displaced-stepping logic does not distinguish these cases, although it should. This is fixed. In the case where no jump is performed the PC is adjusted to point back after the original instruction. Otherwise the PC is left alone. gdb/ChangeLog: * s390-tdep.c (s390_displaced_step_fixup): Adjust PC for a non-branching basr.
2018-07-13GDBserver: Pass process_info pointer to target_killPedro Alves9-40/+43
We start from a process_info pointer, pass down process->pid, and then the target_kill implementations need to find the process from the pid again. Pass the process_info pointer down directly instead. gdb/gdbserver/ChangeLog: 2018-07-13 Pedro Alves <palves@redhat.com> * linux-low.c (linux_kill): Change parameter to process_info pointer instead of pid. Adjust. * lynx-low.c (lynx_kill): Likewise. * nto-low.c (nto_kill): Likewise. * spu-low.c (spu_kill): Likewise. * win32-low.c (win32_kill): Likewise. * server.c (handle_v_kill, kill_inferior_callback) (detach_or_kill_for_exit): Adjust. * target.c (kill_inferior): Change parameter to process_info pointer instead of pid. Adjust. * target.h (struct target_ops) <kill>: Change parameter to process_info pointer instead of pid. Adjust all implementations and callers. (kill_inferior): Likewise.