aboutsummaryrefslogtreecommitdiff
path: root/gdb
AgeCommit message (Collapse)AuthorFilesLines
2015-07-15Validate symbol file using build-idJan Kratochvil13-1/+279
Consumer part of the "build-id" attribute. gdb/ChangeLog 2015-07-15 Aleksandar Ristovski <aristovski@qnx.com Jan Kratochvil <jan.kratochvil@redhat.com> Validate symbol file using build-id. * NEWS (Changes since GDB 7.10): Add 'set validate-build-id' and 'show validate-build-id'. Add build-id attribute. * solib-darwin.c (_initialize_darwin_solib): Assign validate value. * solib-dsbt.c (_initialize_dsbt_solib): Ditto. * solib-frv.c (_initialize_frv_solib): Ditto. * solib-spu.c (set_spu_solib_ops): Ditto. * solib-svr4.c: Include rsp-low.h. (NOTE_GNU_BUILD_ID_NAME): New define. (svr4_validate): New function. (svr4_copy_library_list): Duplicate field build_id. (library_list_start_library): Parse 'build-id' attribute. (svr4_library_attributes): Add 'build-id' attribute. (_initialize_svr4_solib): Assign validate value. * solib-target.c (solib.h): Include. (_initialize_solib_target): Assign validate value. * solib.c (validate_build_id, show_validate_build_id): New. (solib_map_sections): Use ops->validate. (clear_so): Free build_id. (default_solib_validate): New function. (_initialize_solib): Add "validate-build-id". * solib.h (default_solib_validate): New declaration. * solist.h (struct so_list): New fields 'build_idsz' and 'build_id'. (target_so_ops): New field 'validate'. gdb/doc/ChangeLog 2015-07-15 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.texinfo (Files): Add 'set validate-build-id' and 'show validate-build-id'.
2015-07-15gdbserver build-id attribute generatorJan Kratochvil6-49/+409
Producer part of the new "build-id" XML attribute. gdb/ChangeLog 2015-07-15 Aleksandar Ristovski <aristovski@qnx.com Jan Kratochvil <jan.kratochvil@redhat.com> gdbserver build-id attribute generator. * features/library-list-svr4.dtd (library-list-svr4): New 'build-id' attribute. gdb/doc/ChangeLog 2015-07-15 Aleksandar Ristovski <aristovski@qnx.com Jan Kratochvil <jan.kratochvil@redhat.com> gdbserver build-id attribute generator. * gdb.texinfo (Library List Format for SVR4 Targets): Add 'build-id' in description, example, new attribute in dtd. gdb/gdbserver/ChangeLog 2015-07-15 Aleksandar Ristovski <aristovski@qnx.com Jan Kratochvil <jan.kratochvil@redhat.com> gdbserver build-id attribute generator. * linux-low.c (nat/linux-maps.h, search.h, rsp-low.h): Include. (ElfXX_Ehdr, ElfXX_Phdr, ElfXX_Nhdr): New. (ELFXX_FLD, ELFXX_SIZEOF, ELFXX_ROUNDUP, BUILD_ID_INVALID): New. (find_phdr): New. (get_dynamic): Use find_pdhr to traverse program headers. (struct mapping_entry, mapping_entry_s, free_mapping_entry_vec) (compare_mapping_entry_range, struct find_memory_region_callback_data) (read_build_id, find_memory_region_callback, lrfind_mapping_entry) (get_hex_build_id): New. (linux_qxfer_libraries_svr4): Add optional build-id attribute to reply XML document.
2015-07-15Move linux_find_memory_regions_full & co.Jan Kratochvil11-597/+695
This should be just a move with no changes. gdb/ChangeLog 2015-07-15 Aleksandar Ristovski <aristovski@qnx.com Jan Kratochvil <jan.kratochvil@redhat.com> Move linux_find_memory_regions_full & co. * linux-tdep.c (nat/linux-maps.h): Include. (gdb_regex.h): Remove the include. (enum filterflags, struct smaps_vmflags, read_mapping, decode_vmflags) (mapping_is_anonymous_p, dump_mapping_p): Moved to nat/linux-maps.c. (linux_find_memory_region_ftype): Moved typedef to nat/linux-maps.h. (linux_find_memory_regions_full): Moved definition to nat/linux-maps.c. * nat/linux-maps.c: Include ctype.h, target/target-utils.h, gdb_regex.h and target/target.h. (struct smaps_vmflags, read_mapping, decode_vmflags) (mapping_is_anonymous_p, dump_mapping_p): Move from linux-tdep.c. (linux_find_memory_regions_full): Move from linux-tdep.c. * nat/linux-maps.h (read_mapping): New declaration. (linux_find_memory_region_ftype, enum filterflags): Moved from linux-tdep.c. (linux_find_memory_regions_full): New declaration. * target.c (target/target-utils.h): Include. (read_alloc_pread_ftype): Moved typedef to target/target-utils.h. (read_alloc, read_stralloc_func_ftype, read_stralloc): Moved definitions to target/target-utils.c. * target.h (target_fileio_read_stralloc): Move it to target/target.h. * target/target-utils.c (read_alloc, read_stralloc): Move definitions from target.c. * target/target-utils.h (read_alloc_pread_ftype): New typedef. (read_alloc): New declaration. (read_stralloc_func_ftype): New typedef. (read_stralloc): New declaration. * target/target.h (target_fileio_read_stralloc): Move it from target.h. gdb/gdbserver/ChangeLog 2015-07-15 Aleksandar Ristovski <aristovski@qnx.com Jan Kratochvil <jan.kratochvil@redhat.com> * target.c: Include target/target-utils.h and fcntl.h. (target_fileio_read_stralloc_1_pread, target_fileio_read_stralloc_1) (target_fileio_read_stralloc): New functions.
2015-07-15Prepare linux_find_memory_regions_full & co. for moveJan Kratochvil3-79/+160
Prepare code for move into gdb/common/. gdb/ChangeLog 2015-07-15 Aleksandar Ristovski <aristovski@qnx.com Jan Kratochvil <jan.kratochvil@redhat.com> Prepare linux_find_memory_regions_full & co. for move. * linux-tdep.c (linux_find_memory_region_ftype): Comment. (linux_find_memory_regions_full): Change signature and prepare for moving to linux-maps. (linux_find_memory_regions_data): Rename field 'obfd' to 'data'. (linux_find_memory_regions_thunk): New. (linux_find_memory_regions_thunk): Use 'data' field instead of 'obfd'. (linux_find_memory_regions_gdb): New. (linux_find_memory_regions): Rename argument 'obfd' to 'func_data'. (linux_make_mappings_corefile_notes): Use linux_find_memory_regions_gdb. * target.c (read_alloc_pread_ftype): New typedef. (target_fileio_read_alloc_1_pread): New function. (read_alloc): Refactor from target_fileio_read_alloc_1. (read_stralloc_func_ftype): New typedef. (target_fileio_read_alloc_1): New implementation. Use read_alloc. (read_stralloc): Refactored from target_fileio_read_stralloc. (target_fileio_read_stralloc): New implementation, use read_stralloc.
2015-07-15Move gdb_regex* to common/Jan Kratochvil12-140/+251
Later patches need regex support also in gdbserver. gdb/ChangeLog 2015-07-15 Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (HFILES_NO_SRCDIR): Change gdb_regex.h to common/gdb_regex.h. (COMMON_OBS): Add gdb_regex.o. (gdb_regex.o): New. * common/common.m4 (GDB_AC_COMMON): Add gdb_use_included_regex, --without-included-regex and USE_INCLUDED_REGEX. * common/gdb_regex.c: New file from utils.c functions. * common/gdb_regex.h: Move it here from gdb_regex.h, update include file wrapping define name. * configure: Rebuilt. * configure.ac (gdb_use_included_regex, --without-included-regex) (USE_INCLUDED_REGEX): Move them to common/common.m4. * gdb_regex.h: Move it to common/gdb_regex.h. * utils.c: Remove include gdb_regex.h. (do_regfree_cleanup, make_regfree_cleanup, get_regcomp_error) (compile_rx_or_error): Move them to common/gdb_regex.c. gdb/gdbserver/ChangeLog 2015-07-15 Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (OBS): Add gdb_regex.o. (gdb_regex.o): New. * config.in: Rebuilt. * configure: Rebuilt.
2015-07-15Create empty nat/linux-maps.[ch] and common/target-utils.[ch]Jan Kratochvil11-7/+130
Prepare new files for later move. gdb/ChangeLog 2015-07-15 Aleksandar Ristovski <aristovski@qnx.com Jan Kratochvil <jan.kratochvil@redhat.com> Create empty nat/linux-maps.[ch] and common/target-utils.[ch]. * Makefile.in (HFILES_NO_SRCDIR); Add nat/linux-maps.h, common/target-utils.h. (COMMON_OBS): Add target-utils.o. (linux-maps.o, target-utils.o): New. * target/target-utils.c: New file. * target/target-utils.h: New file. * config/i386/linux.mh (NATDEPFILES): Add linux-maps.o. * config/i386/linux64.mh (NATDEPFILES): Ditto. * nat/linux-maps.c: New file. * nat/linux-maps.h: New file. gdb/gdbserver/ChangeLog 2015-07-15 Aleksandar Ristovski <aristovski@qnx.com Jan Kratochvil <jan.kratochvil@redhat.com> Create empty nat/linux-maps.[ch] and common/target-utils.[ch]. * Makefile.in (OBS): Add target-utils.o. (linux-maps.o, target-utils.o): New. * configure.srv (srv_linux_obj): Add linux-maps.o.
2015-07-15Unbreak nios2-*-linux* GDB testing.Sandra Loosemore5-0/+22
2015-07-15 Sandra Loosemore <sandra@codesourcery.com> gdb/testsuite/ * gdb.base/sigaltstack.exp (finish_test): Add kfail for nios2-*-linux*. * gdb.base/sigbpt.exp (stepi_out): Likewise. * gdb.base/siginfo.exp: Likewise. * gdb.base/sigstep.exp (advance, advancei): Likewise.
2015-07-15Move ChangeLog entry to gdbserverPierre Langlois2-6/+6
gdb/gdbserver/ChangeLog: * linux-aarch64-low.c (aarch64_supports_range_stepping): New function, return 1. (the_low_target): Install it.
2015-07-15[GDBserver][AArch64] Enable support for range steppingPierre Langlois2-0/+19
gdb/gdbserver/Changelog: * linux-aarch64-low.c (aarch64_supports_range_stepping): New function, return 1. (the_low_target): Install it.
2015-07-15[testsuite] Skip gdb.trace/range-stepping.exp test case if not supportedPierre Langlois4-21/+35
Tracepoints and range stepping are independent features. This patch skips the gdb.trace/range-stepping.exp test case if the target does not support range stepping. gdb/testsuite/ChangeLog: * gdb.base/range-stepping.exp (gdb_range_stepping_enabled): Move it to ... * lib/range-stepping-support.exp (gdb_range_stepping_enabled): ... here. * gdb.trace/range-stepping.exp: Check that the target supports range stepping.
2015-07-15ari, btrace: avoid unsigned long longMarkus Metzger6-47/+108
Fix the ARI warning about the use of unsigned long long. We can't use ULONGEST as this is defined unsigned long on 64-bit systems. This will result in a compile error when storing a pointer to an unsigned long long structure field (declared in perf_event.h as __u64) in a ULONGEST * variable. Use size_t to hold the buffer size inside GDB and __u64 when interfacing the Linux kernel. gdb/ * nat/linux-btrace.c (perf_event_read): Change the type of DATA_HEAD. (perf_event_read_all): Change the type of SIZE and DATA_HEAD. (perf_event_read_bts): Change the type of SIZE and READ. (linux_enable_bts): Change the type of SIZE, PAGES, DATA_SIZE, and DATA_OFFSET. Move DATA_SIZE declaration. Restrict the buffer size to UINT_MAX. Check for overflows when using DATA_HEAD from the perf mmap page. (linux_enable_pt): Change the type of PAGES and SIZE. Restrict the buffer size to UINT_MAX. (linux_read_bts): Change the type of BUFFER_SIZE, SIZE, DATA_HEAD, and DATA_TAIL. * nat/linux-btrace.h (struct perf_event_buffer)<size, data_head> <last_head>: Change type. * common/btrace-common.h (struct btrace_dat_pt) <size>: Change type. * common/btrace-common.c (btrace_data_append): Change the type of SIZE. * btrace.c (parse_xml_raw): Change the type of SIZE. Change oddness check.
2015-07-14Remove CHECK_TYPEDEF, use check_typedef insteadSimon Marchi51-131/+179
I think that the CHECK_TYPEDEF macro is not necessary, and even a bit annoying. It makes unclear the fact that the "type" variables gets overwritten. It has actually bitten me a few times. I think the following, explicit form, is better. type = check_typedef (type); This patches changes all instances of CHECK_TYPEDEF for an equivalent call to check_typedef. The bulk of the change was done with this sed: sed -i 's/CHECK_TYPEDEF (\([^)]*\));/\1 = check_typedef (\1);/' <file>.c The ChangeLog was generated using David Malcom's generate_changelog.py. I manually fixed those places where it gets the wrong function name, hopefully all of them. The patch was built-tested, and I ran a few smoke tests. gdb/ChangeLog: * gdbtypes.h (CHECK_TYPEDEF): Remove. * aarch64-tdep.c (aarch64_return_in_memory): Replace CHECK_TYPEDEF with check_typedef. * ada-lang.c (decode_constrained_packed_array_type): Likewise. (ada_array_length): Likewise. (find_parallel_type_by_descriptive_type): Likewise. (ada_check_typedef): Likewise. * arm-tdep.c (arm_return_in_memory): Likewise. * ax-gdb.c (gen_trace_static_fields): Likewise. (gen_struct_ref_recursive): Likewise. * c-exp.y (exp : SIZEOF '(' type ')' %prec UNARY): Likewise. (variable: block COLONCOLON name): Likewise. (qualified_name: TYPENAME COLONCOLON name): Likewise. * c-lang.c (classify_type): Likewise. * c-typeprint.c (c_print_type): Likewise. (c_print_typedef): Likewise. (c_type_print_base): Likewise. * c-valprint.c (c_val_print): Likewise. * compile/compile-c-types.c (convert_type): Likewise. * compile/compile-object-load.c (get_out_value_type): Likewise. * completer.c (add_struct_fields): Likewise. (expression_completer): Likewise. * cp-namespace.c (cp_find_type_baseclass_by_name): Likewise. (cp_lookup_nested_symbol_1): Likewise. (cp_lookup_nested_symbol): Likewise. * cp-valprint.c (cp_print_value_fields): Likewise. (cp_print_static_field): Likewise. * d-valprint.c (d_val_print): Likewise. * eval.c (evaluate_subexp_standard): Likewise. (evaluate_subexp_for_sizeof): Likewise. * f-exp.y (exp : SIZEOF '(' type ')' %prec UNARY): Likewise. * f-typeprint.c (f_type_print_base): Likewise. * f-valprint.c (f_val_print): Likewise. * gdbtypes.c (get_discrete_bounds): Likewise. (create_array_type_with_stride): Likewise. (type_name_no_tag_or_error): Likewise. (lookup_struct_elt_type): Likewise. (get_unsigned_type_max): Likewise. (internal_type_vptr_fieldno): Likewise. (set_type_vptr_fieldno): Likewise. (internal_type_vptr_basetype): Likewise. (set_type_vptr_basetype): Likewise. (get_vptr_fieldno): Likewise. (is_integral_type): Likewise. (is_scalar_type): Likewise. (is_scalar_type_recursive): Likewise. (distance_to_ancestor): Likewise. (is_unique_ancestor_worker): Likewise. (check_types_equal): Likewise. * gnu-v2-abi.c (gnuv2_value_rtti_type): Likewise. * gnu-v3-abi.c (gnuv3_dynamic_class): Likewise. (gnuv3_get_vtable): Likewise. (gnuv3_pass_by_reference): Likewise. * go-exp.y (exp : SIZEOF_KEYWORD '(' type ')' %prec UNARY): Likewise. * go-lang.c (gccgo_string_p): Likewise. (go_classify_struct_type): Likewise. * go-typeprint.c (go_print_type): Likewise. * go-valprint.c (go_val_print): Likewise. * guile/scm-math.c (vlscm_binop): Likewise. * guile/scm-value.c (gdbscm_value_dynamic_type): Likewise. (gdbscm_value_to_bytevector): Likewise. (gdbscm_value_to_bool): Likewise. (gdbscm_value_to_integer): Likewise. (gdbscm_value_to_real): Likewise. * infcall.c (call_function_by_hand_dummy): Likewise. * infcmd.c (get_return_value): Likewise. * jv-lang.c (is_object_type): Likewise. * jv-typeprint.c (java_type_print_base): Likewise. * jv-valprint.c (java_print_value_fields): Likewise. (java_val_print): Likewise. * linespec.c (find_methods): Likewise. (collect_one_symbol): Likewise. * m2-typeprint.c (m2_print_type): Likewise. (m2_print_typedef): Likewise. (m2_get_discrete_bounds): Likewise. * m2-valprint.c (m2_print_long_set): Likewise. (m2_print_unbounded_array): Likewise. (m2_print_array_contents): Likewise. (m2_val_print): Likewise. * opencl-lang.c (opencl_print_type): Likewise. * p-exp.y (exp : SIZEOF '(' type ')' %prec UNARY): Likewise. * p-typeprint.c (pascal_print_type): Likewise. (pascal_print_typedef): Likewise. (pascal_type_print_base): Likewise. * p-valprint.c (pascal_val_print): Likewise. (pascal_object_print_value_fields): Likewise. (pascal_object_print_static_field): Likewise. * python/py-type.c (typy_fields_items): Likewise. (typy_get_composite): Likewise. * python/py-value.c (valpy_get_dynamic_type): Likewise. (valpy_binop): Likewise. (valpy_long): Likewise. (valpy_float): Likewise. * stack.c (return_command): Likewise. * symtab.c (check_field): Likewise. (lookup_symbol_aux): Likewise. * tic6x-tdep.c (tic6x_return_value): Likewise. * typeprint.c (print_type_scalar): Likewise. * valarith.c (value_vector_widen): Likewise. * valops.c (value_cast): Likewise. (value_assign): Likewise. (do_search_struct_field): Likewise. (search_struct_method): Likewise. (find_method_list): Likewise. * valprint.c (val_print_scalar_type_p): Likewise. (valprint_check_validity): Likewise. (generic_val_print): Likewise. * value.c (unpack_double): Likewise. (value_primitive_field): Likewise. (unpack_bits_as_long): Likewise.
2015-07-14Add support reading D modules from DWARFIain Buclaw2-8/+38
Extends existing support for namespaces/modules in C++/Fortran/Java to include language_d too. However unlike Fortran/C++, the separator for qualified names is a single dot. 2015-07-14 Iain Buclaw <ibuclaw@gdcproject.org> * dwarf2read.c (find_slot_in_mapped_hash): Extend language support to also test for language_d. (dwarf2_compute_name): Likewise. (read_func_scope): Likewise. (read_structure_type): Likewise. (determine_prefix): Likewise. (read_import_statement): Use dot as the separator for language_d. (typename_concat): Likewise, but don't prefix the D main function.
2015-07-14i386-biarch-core.exp: Fix comment typoJan Kratochvil2-1/+5
gdb/testsuite/ChangeLog 2015-07-14 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.arch/i386-biarch-core.exp: Fix comment typo.
2015-07-14Fix build issue with nat/linux-namespaces.c.Peter Bergner2-6/+12
* nat/linux-namespaces.c (setns): Rename from this ... (do_setns): ... to this. Support calling setns if it exists. (mnsh_handle_setns): Call do_setns.
2015-07-14Add test that exercises the inferior being killed while stopped under GDBPedro Alves3-0/+169
This exercises the case of the inferior disappearing while GDB is debugging it, such as something doing "kill -9 PID" while the program is stopped under GDB or GDBserver. This triggered a set of internal errors, fixed by previous patches. gdb/testsuite/ChangeLog: 2015-07-14 Pedro Alves <palves@redhat.com> * gdb.base/killed-outside.exp: New file. * gdb.base/killed-outside.c: New file.
2015-07-14gdbserver/Linux: internal error when killing a process that is already gonePedro Alves2-1/+9
If the process disappears (e.g., killed with "kill -9" from the shell) while it was stopped under GDBserver's control, and the GDBserver tries to kill it, GDBserver asserts: (gdb) shell kill -9 23084 (gdb) kill ... Killing process(es): 23084 /home/pedro/gdb/mygit/src/gdb/gdbserver/linux-low.c:972: A problem internal to GDBserver has been detected. kill_wait_lwp: Assertion `res > 0' failed. ... gdb/gdbserver/ChangeLog: 2015-07-14 Pedro Alves <palves@redhat.com> * linux-low.c (kill_wait_lwp): Don't assert if waitpid fails. Instead, ignore ECHILD, and throw an error for other errnos.
2015-07-13Fix attach-pie-noexec.exp fail on native-extended-gdbserverYao Qi2-1/+6
When I examine the buildbot fails, I see this fail on native-extended-gdbserver, Attaching to process 13529^M "target:/scratch/yao/gdb/build-git/x86_64/gdb/testsuite/gdb.base/attach-pie-noexec (deleted)": could not open as an executable file: No such file or directory^M (gdb) FAIL: gdb.base/attach-pie-noexec.exp: attach if I run tests with board file unix, it doesn't exist, Attaching to process 13869^M /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/gdb.base/attach-pie-noexec (deleted): No such file or directory.^M (gdb) PASS: gdb.base/attach-pie-noexec.exp: attach the test expects to see the period at the end of the error message, gdb_test "attach $testpid" "Attaching to process $testpid\r\n.*: No such file or directory\\." "attach" however the period is missing when running with native-extended-gdbserver. in exec.c:exec_file_attach, GDB has two places may throw errors [1] and [2], if (load_via_target) { ... } else { ... if (scratch_chan < 0) perror_with_name (filename); <--- [1] } ... if (!exec_bfd) { error (_("\"%s\": could not open as an executable file: %s"), <-- [2] scratch_pathname, bfd_errmsg (bfd_get_error ())); } perror_with_name [1] append a period at the end of error message, but error [2] doesn't. This fix is to add a period at the end of the error message. Note that this fail is shown up on 7.9 release as well. gdb: 2015-07-13 Yao Qi <yao.qi@linaro.org> * exec.c (exec_file_attach): Add period at the end of error message.
2015-07-13gdb/tui: Add command completion to winheight command.Andrew Burgess2-12/+53
Share the window name completion code from the focus command with the winheight command, providing window name completion for the winheight command. gdb/ChangeLog: * tui/tui-win.c (window_name_completer): New function. (focus_completer): Call window_name_completer. All old content moved into window_name_completer. (winheight_completer): New function. (_initialize_tui_win): Rename variable. Add completer to winheight command. Update doc string on winheight.
2015-07-12Fix GDB breakage due to addition of new nios2 mach types in BFD.Sandra Loosemore2-2/+13
2015-07-12 Sandra Loosemore <sandra@codesourcery.com> gdb/ * nios2-linux-tdep.c (_initialize_nios2_linux_tdep): Register all nios2 mach variants.
2015-07-10rx-tdep.c: Use target_read_code instead of target_read_memory.Kevin Buettner2-1/+6
This change causes the prologue scanner and the frame type scanner in rx-tdep.c to use target_read_code() instead of target_read_memory(). This change allows these instruction scanners to operate much more quickly due to the fact that target_read_code() can potentially read from a cache maintained by GDB. gdb/ChangeLog: * rx-tdep.c (rx_get_opcode_byte): Use target_read_code instead of target_read_memory.
2015-07-10gdbserver/event-loop.c: type mismatchPedro Alves2-2/+8
Building with C++ catches a buglet here: ../../../src/gdb/gdbserver/event-loop.c:205:19: warning: invalid conversion from ‘gdb_client_data {aka void*}’ to ‘void**’ [-fpermissive] event_ptr->data = data; ^ This works in practice because gdb_client_data is a pointer already (hence in C we get an implicit conversion), and nothing deferences the pointer. It's passed from client at event registration/creation time, only to pass straight back to client callback. Well, that and nothing in gdbserver uses the event data anyway. gdb/gdbserver/ChangeLog: 2015-07-10 Pedro Alves <palves@redhat.com> * event-loop.c (struct callback_event) <data>: Change type to gdb_client_data instance instead of gdb_client_data pointer. (append_callback_event): Adjust.
2015-07-10Fix testsuite regression by: Do not skip prologue for asm (.S) filesJan Kratochvil3-1/+12
I have somehow missed gdb.asm/asm-source.exp PASS->FAIL even on x86_64. It has no longer valid assumption that "break" breaks after the prologue even in assembler. So I have changed this assumption of the testfile. gdb/testsuite/ChangeLog 2015-07-10 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.asm/asm-source.exp (f at main): Stop at gdbasm_enter. (n at main): New. * gdb.asm/asmsrc1.s: Add comment "mark: main enter".
2015-07-10[GDBserver][AArch64] Cleanup comments for each linux_target_ops methodPierre Langlois2-26/+44
This patch cleans up the comments for each linux_target_ops methods. We should mention which method each function implements but there is no need to duplicate information already mentionned in the base target_ops or linux_target_ops definitions. gdb/gdbserver/ChangeLog: * linux-aarch64-low.c: Add comments for each linux_target_ops method. Remove comments already covered in target_ops and linux_target_ops definitions. (the_low_target): Add comments for each unimplemented method.
2015-07-10gdb/tui: Use cleanups to free string copies.Andrew Burgess2-3/+12
In parse_scrolling_args it is possible for a string copy to leak if an error occurs. Switching to using a cleanup fixes this leak. In tui_set_win_height the string can't be leaked, but switching to using a cleanup guards against the possibility that a leak could be introduced in the future (by adding an error somewhere in the call stack). gdb/ChangeLog: * tui/tui-win.c (tui_set_win_height): Use a cleanup to free the string copy. (parse_scrolling_args): Likewise.
2015-07-10gdb/tui: Define tui window names once.Andrew Burgess2-22/+10
Don't duplicate the window names inside the completion function. Instead make use of the existing defines, and the tui_win_name function to obtain the window names. gdb/ChangeLog: * tui/tui-win.c (focus_completer): Don't duplicate the tui window names in this function.
2015-07-10gdb: Convert TUI windows names to lower case.Andrew Burgess3-9/+19
This commit converts the window names for the TUI windows to lower case. The windows names are already lower case in the documentation, and are shown as lower case in some of the command completion results. Given that all the commands that take a window name currently accept upper or lower case, this commit just changes the window names to lower case in the remaining places they are displayed by gdb. gdb/ChangeLog: * tui/tui-data.h (SRC_NAME): Convert to lower case. (CMD_NAME): Likewise. (DATA_NAME): Likewise. (DISASSEM_NAME): Likewise. * tui/tui-win.c (tui_set_focus): Window names are now lower case. (tui_set_win_height): Likewise. (parse_scrolling_args): Likewise.
2015-07-10gnu_vector.exp: Skip infcall tests on x86/x86_64Andreas Arnez2-6/+12
Since the new KFAILs/KPASSs for the infcall tests on x86 and x86_64 targets generated unnecessary noise, this change skips them with UNSUPPORTED instead. gdb/testsuite/ChangeLog: * gdb.base/gnu_vector.exp: On x86 and x86_64 targets, skip the infcall tests instead of setting up for KFAIL.
2015-07-10record: set stop_pc in "record goto" commandMarkus Metzger5-6/+63
When navigating in the recorded execution trace via "record goto", we do not set stop_pc. This may trigger an internal error in infrun.c when stepping from that location. Set it. (gdb) rec full (gdb) c Continuing. Breakpoint 1, foo (void) at foo.c:42 42 x = y (gdb) rn foo (void) at foo.c:41 41 y = x (gdb) rec go end Go forward to insn number 98724 at foo.c:42 42 x = y (gdb) n infrun.c:2382: internal-error: resume: Assertion `sig != GDB_SIGNAL_0' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) This happens because there's a breakpoint at PC when the "next" is issued, so that breapoint should be immediately stepped over. That should have been detected/done by proceed, here: if (addr == (CORE_ADDR) -1) { if (pc == stop_pc && breakpoint_here_p (aspace, pc) == ordinary_breakpoint_here && execution_direction != EXEC_REVERSE) /* There is a breakpoint at the address we will resume at, step one instruction before inserting breakpoints so that we do not stop right away (and report a second hit at this breakpoint). Note, we don't do this in reverse, because we won't actually be executing the breakpoint insn anyway. We'll be (un-)executing the previous instruction. */ tp->stepping_over_breakpoint = 1; But since stop_pc was stale, the pc == stop_pc check failed, and left the breakpont at PC inserted. gdb/ * record-btrace.c (record_btrace_goto_begin, record_btrace_goto_end) record_btrace_goto): Move call to print_stack_frame ... (record_btrace_set_replay): ... here. Set stop_pc. * record-full.c (record_full_goto_entry): Set stop_pc. testsuite/ * gdb.btrace/record_goto-step.exp: New.
2015-07-09Add NEWS entry for tracepoints support on aarch64-linuxPierre Langlois2-0/+6
gdb/ChangeLog: * NEWS: Mention support for tracepoints on aarch64-linux.
2015-07-09[GDBServer][AArch64] Enable support for tracepointsPierre Langlois2-0/+16
gdb/gdbserver/ChangeLog: * linux-aarch64-low.c (aarch64_supports_tracepoints): New function. Return 1. (the_low_target): Install it.
2015-07-09[testsuite][AArch64] Port gdb.tracePierre Langlois9-0/+34
This patch adds support for AArch64 to the gdb.trace testsuite. Note that it does not add support for testing fast tracepoint as it isn't supported. Therefore the test cases with inline assembly are not ported in this patch, as we do not know what the conditions for inserting a fast tracepoint on AArch64 would be. gdb/testsuite/ChangeLog: * gdb.trace/backtrace.exp: Set registers for aarch64 target. * gdb.trace/collection.exp: Likewise. * gdb.trace/mi-trace-frame-collected.exp: Likewise. * gdb.trace/mi-trace-unavailable.exp: Likewise. * gdb.trace/report.exp: Likewise. * gdb.trace/trace-break.exp: Likewise. * gdb.trace/unavailable.exp: Likewise. * gdb.trace/while-dyn.exp: Likewise.
2015-07-09[AArch64] Implement gdbarch_gen_return_address gdbarch methodPierre Langlois2-0/+22
This patch implements the 'collect $_ret' command to collect the return address of a function in a tracepoint. It marks the LR register for collection. gdb/ChangeLog: * aarch64-tdep.c: Add ax.h and ax-gdb.h includes. (aarch64_gen_return_address): New function. (aarch64_gdbarch_init): Hook it.
2015-07-09[AArch64] Teach stub unwinder to terminate gracefullyPierre Langlois2-5/+42
The stub unwinder is used on AArch64 if the target's memory is not readable at the current PC. For example, the user could try to call at an invalid address such as 0x0, as covered in the gdb.base/signull.exp test case. Many GDB ports use a similar unwinder to handle this case too. If we purposely kill the inferior before examining the trace then we get the following issue: ~~~ ... (gdb) trace f Tracepoint 3 at 0x7fb7fc28c0 (gdb) tstart (gdb) continue ... (gdb) tstop (gdb) tsave /tmp/trace (gdb) kill ... (gdb) target tfile /tmp/trace ... (gdb) tfind Register 31 is not available. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Found trace frame 0, tracepoint 3 #-1 0x0000007fb7fc28c0 in f () ... ^^^ ~~~ This patch teaches the stub unwinder to report to the core frame code with UNWIND_UNAVAILABLE when either the stack pointer of the return address are unavailable to read from the target. gdb/ChangeLog: * aarch64-tdep.c (aarch64_make_stub_cache): Set available_p and swallow NOT_AVAILABLE_ERROR. (aarch64_stub_this_id): Call frame_id_build_unavailable_stack if available_p is not set. (aarch64_stub_frame_unwind_stop_reason): New function. (aarch64_stub_unwind): Install it.
2015-07-09[AArch64] Teach prologue unwinder to terminate gracefullyPierre Langlois2-26/+87
Without debugging information, we have the following issue when examining a trace buffer: ~~~ ... (gdb) trace f Tracepoint 3 at 0x7fb7fc28c0 (gdb) tstart (gdb) continue ... (gdb) tstop (gdb) tfind start Register 31 is not available. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Found trace frame 0, tracepoint 3 #-1 0x0000007fb7fc28c0 in f () ... ^^^ ~~~ The reason for this is that the target's stack pointer is unavailable when examining the trace buffer. What we are seeing is due to the 'tfind' command creating a sentinel frame and unwinding it. If an exception is thrown, we are left with the sentinel frame being displayed at level #-1. The exception is thrown when the prologue unwinder tries to read the stack pointer to construct an ID for the frame. This patch fixes this by making the prologue unwinder catch NOT_AVAILABLE_ERROR exceptions when either registers or memory is unreadable and report back to the frame core code with UNWIND_UNAVAILABLE. gdb/ChangeLog: * aarch64-tdep.c (aarch64_prologue_cache) <available_p>: New field. (aarch64_make_prologue_cache_1): New function, factored out from aarch64_make_prologue_cache. Do not allocate cache. Set available_p. (aarch64_make_prologue_cache): Reimplement wrapping aarch64_make_prologue_cache_1, and swallowing NOT_AVAILABLE_ERROR. (aarch64_prologue_frame_unwind_stop_reason): New function. Return UNWIND_UNAVAILABLE if available_p is not set. (aarch64_prologue_unwind): Install it. (aarch64_prologue_this_id): Move prev_pc and prev_sp limit checks into aarch64_prologue_frame_unwind_stop_reason. Call frame_id_build_unavailable_stack if available_p is not set.
2015-07-09[AArch64] Only access inferior registers when creating a frame cachePierre Langlois2-8/+28
This patch moves the address of the start of a function (func) and the address from which it was called (prev_pc) into aarch64_prologue_cache. The idea is to keep accesses to the inferior's registers into aarch64_make_prologue_cache and aarch64_make_stub_cache. gdb/ChangeLog: * aarch64-tdep.c (aarch64_prologue_cache) <func, prev_pc>: New fields. (aarch64_scan_prologue): Set prev_pc. (aarch64_make_prologue_cache): Set func. (aarch64_make_stub_cache): Set prev_pc. (aarch64_prologue_this_id): Remove local variables id, pc and func. Read prev_pc and func from cache. (aarch64_stub_this_id): Read prev_pc from cache.
2015-07-09[AArch64] Refactor aarch64_make_stub_cachePierre Langlois2-10/+19
We would previously have to make sure the frame cache was not already created before calling aarch64_make_stub_cache. This patch makes this function check it so the caller does not need to do so. gdb/ChangeLog: * aarch64-tdep.c (aarch64_make_stub_cache): Update comment. New argument this_cache. Remove unused local variables reg and unwound_fp. Return early if this_cache is already set. Set this_cache. (aarch64_stub_this_id): Update call to aarch64_make_stub_cache.
2015-07-09[AArch64] Refactor aarch64_make_prologue_cachePierre Langlois2-18/+25
We would previously have to make sure the frame cache was not already created before calling aarch64_make_prologue_cache. This patch makes this function check it so that the caller does not need to do so. gdb/ChangeLog: * aarch64-tdep.c (aarch64_make_prologue_cache): Update comment. New argument this_cache. Return early if this_cache is already set. Set this_cache. (aarch64_prologue_this_id): Update call to aarch64_make_prologue_cache. (aarch64_prologue_prev_register): Likewise. (aarch64_normal_frame_base): Likewise.
2015-07-09Factor out memberptr printing code from c_val_printSimon Marchi2-6/+29
gdb/ChangeLog: * c-valprint.c (c_val_print): Factor out memberptr printing code from c_val_print to ... (c_val_print_memberptr): ... this new function.
2015-07-09Factor out int printing code from c_val_printSimon Marchi2-24/+41
gdb/ChangeLog: * c-valprint.c (c_val_print): Factor out int printing code to ... (c_val_print_int): ... this new function.
2015-07-09Factor out struct and union printing code from c_val_printSimon Marchi2-30/+65
gdb/ChangeLog: * c-valprint.c (c_val_print): Factor out struct and union printing code to ... (c_val_print_struct): ... this new function ... (c_val_print_union): ... and this new function.
2015-07-09Factor out pointer printing code from c_val_printSimon Marchi2-25/+44
gdb/ChangeLog: * c-valprint.c (c_val_print): Factor out pointer printing code to ... (c_val_print_ptr): ... this new function.
2015-07-09Factor out array printing code from c_val_printSimon Marchi2-94/+116
gdb/ChangeLog: * c-valprint.c (c_valprint): Factor our array printing code from c_val_print to ... (c_val_print_array): ... this new function.
2015-07-09Factor out print_unpacked_pointer from c_val_printSimon Marchi2-99/+112
Turn this code into a function, instead of a goto. gdb/ChangeLog: * c-valprint.c (c_val_print): Factor out pointer printing code to ... (print_unpacked_pointer): ... this new function.
2015-07-09Remove unneeded variable assignmentSimon Marchi2-4/+9
The assignment to i in the TYPE_CODE_PTR section is not useful. Removing it allows to move i in a narrower scope, which will help things somewhere in the next patches. gdb/ChangeLog: * c-valprint.c (c_val_print): Remove an assignment to i and move its declaration.
2015-07-09Pass ptid to aarch64_linux_get_debug_reg_capacityYao Qi2-4/+10
This patch is to pass ptid to aarch64_linux_get_debug_reg_capacity, and stop using global variable inferior_ptid. gdb: 2015-07-09 Yao Qi <yao.qi@linaro.org> * aarch64-linux-nat.c (aarch64_linux_get_debug_reg_capacity): Add argument ptid. Update comments. Caller update.
2015-07-09[gdbserver, aarch64] Set usrregs to NULL in regs_infoYao Qi2-29/+7
Hi, I happen to read the comments in regs_info below, struct regs_info { ... /* Info used when accessing registers with PTRACE_PEEKUSER / PTRACE_POKEUSER. This can be NULL if all registers are transferred with regsets .*/ struct usrregs_info *usrregs; that usrregs can be NULL if all registers are transferred with regsets, which is exactly what aarch64-linux does. This patch is to set usrregs to NULL in regs_info and remove aarch64_usrregs_info and aarch64_regmap. gdb/gdbserver: 2015-07-09 Yao Qi <yao.qi@linaro.org> * linux-aarch64-low.c (aarch64_regmap): Remove. (aarch64_usrregs_info): Remove. (regs_info): Set field usrregs to NULL.
2015-07-09btrace, pt: support new packetsMarkus Metzger2-1/+31
Add support for dumping new Intel(R) Processor Trace packets in the "maint btrace packet-history" command. gdb/ * btrace.c (pt_print_packet): Print stop, vmcs, tma, mtc, cyc, and mnt packets.
2015-07-09btrace: fix build fail with 32-bit BFDMarkus Metzger2-2/+6
When compiling GDB with 32-bit BFD, the build fails with: In file included from btrace.h:33:0, from btrace.c:23: /usr/include/intel-pt.h:1643:51: note: expected 'int (*)(uint8_t *, size_t, const struct pt_asid *, uint64_t, void *)' but argument is of type 'int (*)(gdb_byte *, size_t, const struct pt_asid *, CORE_ADDR, void *)' extern pt_export int pt_image_set_callback(struct pt_image *image, ^ gdb/ * btrace.c (btrace_pt_readmem_callback): Change type of PC argument.
2015-07-08Add missing spaces in previous patchSimon Marchi2-2/+6
gdb/ChangeLog: * progspace.c (delete_program_space): Add missing spaces.