aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2017-11-02Remove code wrapped by "#if 0"Yao Qi2-15/+4
These code wrapped by "#if 0" was added by af030b9a, which added the new command to dump registers in 2002. The email didn't mention this either https://sourceware.org/ml/gdb-patches/2002-08/msg00227.html It was there for 15 years, and nobody needs it, so we can remove it. gdb: 2017-11-02 Yao Qi <yao.qi@linaro.org> * regcache.c (regcache::dump): Remove code.
2017-11-02Remove regcache_descr fields sizeof_raw_register_status and ↵Yao Qi2-9/+14
sizeof_cooked_register_status struct regcache_descr has two fields sizeof_raw_register_status and sizeof_cooked_register_status, but they equal to nr_cooked_registers and nr_raw_registers respectively, so this patch removes them. gdb: 2017-11-02 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache_descr) <sizeof_raw_register_status>: Remove. <sizeof_cooked_register_status>: Remove. (init_regcache_descr): Update. (regcache::regcache): Use nr_cooked_registers and nr_raw_registers. (regcache::save): Likewise. (regcache::dump): Likewise.
2017-11-02[ARM] Help wince objdump on coproc testsThomas Preud'homme3-2/+8
Object files other than ELF do not have mapping symbols to indicate the type of data for objdump to work reliably. This is why the following tests FAIL on arm-wince-pe targets: ARMv6T2 Thumb CoProcessor Instructions (1) ARMv6T2 Thumb CoProcessor Instructions (2) This patch adds the force-thumb disassembler option to objdump for this test to PASS on these targets as well. 2017-11-02 Thomas Preud'homme <thomas.preudhomme@arm.com> gas/ * testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v6t2-1.d: Add --disassembler-options=force-thumb to objdump options. * testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v6t2-2.d: Likewise.
2017-11-01FT32: support for FT32B processor - part 2/2James Bowman4-13/+48
FT32B is a new FT32 family member. This patch adds support for the compressed instructions to gdb and sim. gdb/ChangeLog: * ft32-tdep.c (ft32_fetch_instruction): New function. (ft32_analyze_prologue): Use ft32_fetch_instruction(). sim/ChangeLog: * ft32/interp.c (step_once): Add ft32 shortcode decoder.
2017-11-02Automatic date update in version.inGDB Administrator1-1/+1
2017-11-01FT32B is a new FT32 family member. It has a code compression scheme, which ↵James Bowman32-392/+3875
requires the use of linker relaxations. The change is quite large, so submission is in several parts. Part 2 adds a relaxation pass, which actually implements the code compression scheme. bfd * archures.c: Add bfd_mach_ft32b. * cpu-ft32.c: Add arch_info_struct. * elf32-ft32.c: Add R_FT32_RELAX, SC0, SC1, DIFF32. (ft32_elf_relocate_section): Add clauses for R_FT32_SC0, SC1, DIFF32. (ft32_reloc_shortable, elf32_ft32_is_diff_reloc, elf32_ft32_adjust_diff_reloc_value, elf32_ft32_adjust_reloc_if_spans_insn, elf32_ft32_relax_delete_bytes, elf32_ft32_relax_is_branch_target, ft32_elf_relax_section): New function. * reloc.c: Add BFD_RELOC_FT32_RELAX, SC0, SC1, DIFF32. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. gas * config/tc-ft32.c (md_assemble): add relaxation reloc BFD_RELOC_FT32_RELAX. (md_longopts): Add "norelax" and "no-relax". (md_apply_fix): Add reloc BFD_RELOC_FT32_DIFF32. (relaxable_section, ft32_validate_fix_sub, ft32_force_relocation, ft32_allow_local_subtract): New function. * config/tc-ft32.h: remove unused MD_PCREL_FROM_SECTION. * testsuite/gas/ft32/insnsc.s: New test exercising all FT32B shortcodes. include * elf/ft32.h: Add R_FT32_RELAX, SC0, SC1, DIFF32.
2017-11-01Prevent illegal memory accesses when attempting to read excessively large ↵Nick Clifton2-0/+14
COFF line number tables. PR 22376 * coffcode.h (coff_slurp_line_table): Check for an excessively large line number count.
2017-11-01Update check for invalid values in pe_bfd_read_buildid function.Nick Clifton2-3/+8
PR 22373 * peicode.h (pe_bfd_read_buildid): Revise check for invalid size and offset in light of further possible bogus values.
2017-11-01Fix an invalid free called when attempting to link a COFF object against an ↵Nick Clifton4-3/+27
ELF archive with --no-keep-memory enabled. PR 22369 * coffgen.c (_bfd_coff_free_symbols): Fail if called on a non-COFF file. * cofflink.c (coff_link_check_archive_element): Skip non-COFF members of an archive.
2017-11-01[ARM] Fix Coprocessor instructions availabilityThomas Preud'homme26-35/+328
A few coprocessor instructions introduced in ARMv2 are currently accepted by GAS when targeting ARMv1 due to a typo in the code. This patch fixes the issue and introduce a more fine grained testing for coprocessor instructions availability. Coprocessor instructions are grouped as follows: * ARM coprocessor instructions introduced in ARMv2 Includes: ldc, stc, mcr, mrc, cdp, ldcl, stcl Guarded by: ARM_EXT_V2 Tests: copro-arm_v2plus-arm_v*.d * ARM coprocessor instructions introduced in ARMv5 Includes: ldc2, ldc2l, stc2, stc2l, cdp2, mcr2, mrc2 Guarded by: ARM_EXT_V5 Tests: copro-arm_v5plus-arm_v*.d * ARM coprocessor instructions introduced in ARMv5TE Includes: mcrr, mrrc Guarded by: ARM_EXT_V5E Tests: copro-arm_v5teplus-arm_v*.d * ARM coprocessor instructions introduced in ARMv6 Includes: mcrr2, mrrc2 Guarded by: ARM_EXT_V6 Tests: copro-arm_v6plus-arm_v*.d * Thumb coprocessor instructions introduced in ARMv6T2 Includes: ldc, ldcl, stc, stcl, mcr, mrc, mcrr, mrrc, cdp, ldc2, ldc2l, stc2, stc2l, cdp2, mcr2, mrc2, mcrr2, mrrc2 Guarded by: ARM_EXT_V6T2 Tests: copro-thumb_v6t2plus-thumb_v*.d For each of these groups, at least 2 tests are performed: * instructions are not available in earlier architecture * instructions are available in architecture where they were introduced More tests need to be performed when instructions in a group span several assembly files. Note that an instruction in the original coprocessor testcase is changed to unified syntax to allow the testcase to be assembled for ARM and Thumb state. Correct processing of legacy syntax is covered in other testcases. 2017-11-01 Thomas Preud'homme <thomas.preudhomme@arm.com> gas/ * config/tc-arm.c (arm_ext_v2): Define to ARM_EXT_V2 feature bit. * testsuite/gas/arm/copro.s: Split into ... * testsuite/gas/arm/copro-arm_v2plus-thumb_v6t2plus.s: This while changing it to unified syntax and ... * testsuite/gas/arm/copro-arm_v5plus-thumb_v6t2plus.s: this and ... * testsuite/gas/arm/copro-arm_v5teplus-thumb_v6t2plus.s: This and ... * testsuite/gas/arm/copro-arm_v6plus-thumb_v6t2plus.s: This. * testsuite/gas/arm/copro.d: Split into ... * testsuite/gas/arm/copro-arm_v2plus-arm_v2.d: This but target ARMv2 and ... * testsuite/gas/arm/copro-arm_v5plus-arm_v5.d: this but target ARMv5 and ... * testsuite/gas/arm/copro-arm_v5teplus-arm_v5te.d: This but target ARMv5TE and ... * testsuite/gas/arm/copro-arm_v6plus-arm_v6.d: This but target ARMv6. * testsuite/gas/arm/copro-arm_v2plus-arm_v1.d: New testcase. * testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v4t-1.d: New testcase. * testsuite/gas/arm/copro-arm_v2plus-thumb_v6t2plus-unavail.l: Expected errors for the above two testcases. * testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v6t2-1.d: New testcase. * testsuite/gas/arm/copro-arm_v5plus-arm_v4.d: New testcase. * testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v4t-2.d: New testcase. * testsuite/gas/arm/copro-arm_v5plus-thumb_v6t2plus-unavail.l: Expected errors for the above two testcases. * testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v6t2-2.d: New testcase. * testsuite/gas/arm/copro-arm_v5teplus-arm_v5.d: New testcase. * testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v4t-3.d: New testcase. * testsuite/gas/arm/copro-arm_v5teplus-thumb_v6t2plus-unavail.l: Expected errors for the above two testcases. * testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v6t2-3.d: New testcase. * testsuite/gas/arm/copro-arm_v6plus-arm_v5te.d: New testcase. * testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v4t-4.d: New testcase. * testsuite/gas/arm/copro-arm_v6plus-thumb_v6t2plus-unavail.l: Expected errors for the above two testcases. * testsuite/gas/arm/copro-thumb_v6t2plus-thumb_v6t2-4.d: New testcase.
2017-11-01PR22374, PowerPC unnecessary PLT entriesAlan Modra5-13/+58
We don't need a PLT entry when function pointer initialization in a read/write section is the only reference to a given function symbol. This patch prevents the unnecessary PLT entry, and ensures no dynamic relocs are emitted when UNDEFWEAK_NO_DYNAMIC_RELOC says so. bfd/ PR 22374 * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Don't create a plt entry when just a dynamic reloc can serve. Ensure no dynamic relocations when UNDEFWEAK_NO_DYNAMIC_RELOC by setting non_got_ref. Expand and move the non_got_ref comment. * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise. ld/ * testsuite/ld-powerpc/ambiguousv2.d: Remove FIXME.
2017-11-01PR22374 testcase, function pointer references in .dataAlan Modra6-0/+39
Function pointer references in .data ought to use a dynamic reloc. There shouldn't be any need for a PLT entry and definitely no copy reloc. This test fails on quite a few targets, but isn't something that anyone should worry about too much. It's really just a missed optimization. PR 22374 * testsuite/ld-elf/pr22374a.s, * testsuite/ld-elf/pr22374b.s, * testsuite/ld-elf/pr22374-1.r, * testsuite/ld-elf/pr22374-2.r: New test. * testsuite/ld-elf/elf.exp: Run it.
2017-11-01Tidy elf.expAlan Modra2-36/+29
* testsuite/ld-elf/elf.exp: Merge some conditionals, a better name than "shared library for next test", and use xfail arg of run_ld_link_tests in a few places.
2017-10-31Use console uiout when executing breakpoint commandsSimon Marchi4-6/+31
As reported here https://sourceware.org/ml/gdb/2017-10/msg00020.html the output of certain commands, like backtrace, doesn't appear anywhere when it is run as a breakpoint command and when using MI. The reason is that the current_uiout is set to the mi_ui_out while these commands run, whereas we want the output as CLI output. Some commands like "print" work, because they use printf_filtered (gdb_stdout, ...) directly, bypassing the current ui_out. The fix I did is to force setting the cli_uiout as the current_uiout when calling execute_control_command. I am not sure if this is the right way to fix the problem, comments about the approach would be appreciated. I enhanced gdb.mi/mi-break.exp to test the backtrace command. Regtested on the buildbot. gdb/ChangeLog: * cli/cli-script.c (execute_control_command): Rename to ... (execute_control_command_1): ... this. (execute_control_command): New function. gdb/testsuite/ChangeLog: * gdb.mi/mi-break.exp (test_breakpoint_commands): Test backtrace as a breakpoint command.
2017-11-01Automatic date update in version.inGDB Administrator1-1/+1
2017-10-31tracepoint: Remove unnecessary const_castSimon Marchi2-1/+5
We are passing a const char * to a const char * parameter, the const_cast is not necessary. gdb/ChangeLog: * tracepoint.c (tfind_command): Remove const_cast.
2017-10-31Fix illegal memory access triggered when parsing a PE binary with a corrupt ↵Nick Clifton2-3/+12
data dictionary. PR 22373 * peicode.h (pe_bfd_read_buildid): Check for invalid size and data offset values.
2017-10-31Remind users to use the --use-dynamic command line option to dump dynamic ↵Nick Clifton2-1/+21
relocations. * readelf.c (process_relocs): Tell users if no static relocs were found, but if they had added --use-dynamic to the command line then relocs would have been displayed.
2017-10-30gdb/Makefile.in: fix 'make tags' failureMike Gulick2-1/+4
'make tags' fails with the following error: make[2]: Entering directory '/local-ssd/mgulick/gdb/git/binutils-gdb/gdb' make[2]: *** No rule to make target 'gdb.h', needed by 'TAGS'. Stop. make[2]: Leaving directory '/local-ssd/mgulick/gdb/git/binutils-gdb/gdb' The file gdb/gdb.h was removed in commit 65630365f7d073430e62b4fe65f34dcdc0a4b05e. gdb/ChangeLog: 2017-10-30 Mike Gulick <mgulick@mathworks.com> * Makefile.in (HFILES_NO_SRCDIR): Remove reference to gdb.h.
2017-10-31Automatic date update in version.inGDB Administrator1-1/+1
2017-10-30Introduce in_inclusive_range, fix -Wtautological-compare warningsSimon Marchi4-9/+27
When compiling with clang or gcc 8, we see warnings like this: /home/emaisin/src/binutils-gdb/gdb/arm-tdep.c:10013:13: error: comparison of 0 <= unsigned expression is always true [-Werror,-Wtautological-compare] if (0 <= insn_op1 && 3 >= insn_op1) ~ ^ ~~~~~~~~ /home/emaisin/src/binutils-gdb/gdb/arm-tdep.c:11722:20: error: comparison of unsigned expression >= 0 is always true [-Werror,-Wtautological-compare] else if (opB >= 0 && opB <= 2) ~~~ ^ ~ This is because an unsigned integer (opB in this case) will always be >= 0. It is still useful to keep both bounds of the range in the expression, even if one is at the edge of the data type range. This patch introduces a utility function in_inclusive_range that gets rid of the warning while conveying that we are checking for a range. Tested by rebuilding. gdb/ChangeLog: * common/common-utils.h (in_inclusive_range): New function. * arm-tdep.c (arm_record_extension_space): Use in_inclusive_range. (thumb_record_ld_st_reg_offset): Use in_inclusive_range. * cris-tdep.c (cris_spec_reg_applicable): Use in_inclusive_range.
2017-10-30remote.c, QCatchSyscalls: Build std::string instead of unique_xmalloc_ptrPedro Alves2-15/+13
Simplify the code a little bit using std::string + string_appendf. gdb/ChangeLog: 2017-10-30 Pedro Alves <palves@redhat.com> Simon Marchi <simon.marchi@ericsson.com> * remote.c (remote_set_syscall_catchpoint): Build a std::string instead of a gdb::unique_xmalloc_ptr, using string_appendf.
2017-10-30Introduce string_appendf/string_vappendfPedro Alves4-0/+104
string_appendf is like string_printf, but instead of allocating a new string, it appends to an existing string. This allows reusing a std::string's memory buffer across several calls, for example. gdb/ChangeLog: 2017-10-30 Pedro Alves <palves@redhat.com> * common/common-utils.c (string_appendf, string_vappendf): New functions. * common/common-utils.h (string_appendf, string_vappendf): New declarations. * unittests/common-utils-selftests.c (string_appendf_func) (test_appendf_func, string_vappendf_wrapper, string_appendf_tests) (string_vappendf_tests): New functions. (_initialize_common_utils_selftests): Register "string_appendf" and "string_vappendf tests".
2017-10-30Merge/shared string_printf and string_vprintf unit testsPedro Alves2-15/+38
Merge the string_printf and string_vprintf tests, running them all against both functions. gdb/ChangeLog: 2017-10-30 Pedro Alves <palves@redhat.com> * unittests/common-utils-selftests.c (format_func): New typedef. (string_printf_tests, string_vprintf_tests): Tests factored out and merged to ... (test_format_func): ... this new function. (string_printf_tests, string_vprintf_tests): Reimplement on top of test_format_func.
2017-10-29darwin-nat: Remove gdb.h includeSimon Marchi2-1/+4
gdb.h has been removed in Eliminate catch_exceptions/catch_exceptions_with_msg 65630365f7d073430e62b4fe65f34dcdc0a4b05e Remove the include in darwin-nat.c. Tested by rebuilding. gdb/ChangeLog: * darwin-nat.c: Remove include of gdb.h.
2017-10-30frv-elf --gc-sections failuresAlan Modra2-1/+5
git commit 81742b83e9 exposed an frv-elf bug, with the object id not matching the hash table id. * elf32-frv.c (ELF_TARGET_ID): Don't define for generic elf target.
2017-10-30relocs_compatible test for gc-sectionsAlan Modra2-0/+8
I noticed when looking at pr22300 that before calling check_relocs we have an elf_object_id test (added for pr11933) as well as the relocs_compatible test. I believe backend gc_mark_hook and gc_sweep_hook ought to be protected similarly from being confused by unexpected relocations (for example, both elf64-ppc.c and elf32-ppc.c use _bfd_elf_relocs_compatible, so I think it would be possible for the ppc64 gc_mark_hook to be presented with a ppc32 relocatable object). * elflink.c (elf_gc_sweep): Test elf_object_id in addition to relocs_compatible. (bfd_elf_gc_sections): Likewise.
2017-10-30Fix hppa-linux pr22269-1 failAlan Modra2-81/+92
Adds UNDEFWEAK_NO_DYNAMIC_RELOC in the rest of places needed in this file, reduces dynamic relocations in a number of cases, and removes some bogus code that was attempting to handle dynamic common symbols specially. PR 22269 * elf32-hppa.c (elf32_hppa_check_relocs): Move SEC_ALLOC test to ensure non_got_ref is not set due to debug references. (elf32_hppa_adjust_dynamic_symbol): Tidy plabel handling. Use SYMBOL_CALLS_LOCAL and UNDEFWEAK_NO_DYNAMIC_RELOC when determining need for a plt entry. (allocate_dynrelocs): Similarly for got entries. Tidy code discarding dynamic relocs when pic. Remove bogus code attempting to handle commons. (elf32_hppa_relocate_section): Similarly. Delete resolved_to_zero and simplify. (elf32_hppa_finish_dynamic_symbol): Use UNDEFWEAK_NO_DYNAMIC_RELOC and SYMBOL_REFERENCES_LOCAL in GOT handling.
2017-10-30Automatic date update in version.inGDB Administrator1-1/+1
2017-10-29xtensa-xtregs: Fix formatting issuesSimon Marchi2-15/+20
Fix a few formatting issues in that file. gdb/ChangeLog: * xtensa-xtregs.c: Fix formatting issues.
2017-10-29xtensa-xtregs: Constify fieldSimon Marchi2-1/+5
Fix: In file included from /home/emaisin/src/binutils-gdb/gdb/xtensa-linux-nat.c:46:0: /home/emaisin/src/binutils-gdb/gdb/xtensa-xtregs.c:37:1: error: ISO C++ forbids converting a string constant to 'char*' [-Werror=write-strings] }; ^ gdb/ChangeLog: * xtensa-xtregs.c (xtensa_regtable_t) <name>: Constify.
2017-10-29Automatic date update in version.inGDB Administrator1-1/+1
2017-10-28Make gdb.selected_thread().inferior return a new referenceMaksim Dzabraev4-0/+22
thpy_get_inferior function should return a new reference to the existing inferior object, and therefore should increment its refcount. Fixed bug looks like this. If multiple time call gdb.selected_thread ().inferior, gdb throws exception: (gdb) pi gdb.selected_thread().inferior <gdb.Inferior object at 0x7f1952bea698> (gdb) pi gdb.selected_thread().inferior Python Exception <type 'exceptions.AttributeError'> 'NoneType' object has no attribute 'inferior': Error while executing Python code. (gdb) info threads Id Target Id Frame * 1 Thread 0x7f54f0474740 (LWP 584) "mc" 0x00007f54ef055c33 in
2017-10-28PR22361 readelf buffer overflow on fuzzed archive headerAlan Modra2-0/+18
PR 22361 * readelf.c (process_archive_index_and_symbols): Ensure ar_size field is zero terminated for strtoul. (setup_archive, get_archive_member_name): Likewise.
2017-10-28PR22300, Abort in elf32_hppa_relocate_section building polymlAlan Modra5-5/+11
polyml produces object files with the wrong OS/ABI for hppa-linux. This, along with the fact that elf32-hppa.c is using the strictest backend relocs_compatible, results in wrong merging of ELF symbols. So, remove the relocs_compatible check in _bfd_elf_merge_symbol. _bfd_elf_merge_symbol is only called nowadays from within blocks protected by is_elf_hash_table, so "we are doing an ELF link" as the removed comment says, is true. Also relax relocs_compatible for hppa and powerpc. relocs_compatible is used for more than just merging symbols, as the name suggests. This allows objects that are in fact reasonably compatible to be linked. PR 22300 * elflink.c (_bfd_elf_merge_symbol): Remove relocs_compatible check. * elf32-hppa.c (elf_backend_relocs_compatible): Define. * elf32-ppc.c (elf_backend_relocs_compatible): Define. * elf64-ppc.c (elf_backend_relocs_compatible): Define.
2017-10-27Remove find_inferior usage for thread_searchSimon Marchi2-56/+39
Replace it with for_each_thread. While at it, we can inline the callback code. One little change is that I am using the prev_general_thread variable instead of current_gen_ptid, since they should have the same value. gdb/gdbserver/ChangeLog: * target.c (struct thread_search): Remove. (thread_search_callback): Remove. (prepare_to_access_memory): Use for_each_thread instead of find_inferior. Inline code from thread_search_callback.
2017-10-27Remove usage of find_inferior in resumeSimon Marchi2-27/+23
Change find_inferior with find_thread. Since we can now pass arguments directly instead of through a void pointer, we don't need the visit_actioned_threads_data structure anymore. gdb/gdbserver/ChangeLog: * server.c (struct visit_actioned_threads_data): Remove. (visit_actioned_threads): Change prototype to take arguments directly. (resume): Use find_thread instead of find_inferior.
2017-10-27Remove usages of find_inferior in handle_statusSimon Marchi2-16/+15
Replace one with find_thread, the other with for_each_thread. gdb/gdbserver/ChangeLog: * server.c (queue_stop_reply_callback): Change prototype, return void. (find_status_pending_thread_callback): Remove. (handle_status): Replace find_inferior with find_thread and for_each_thread.
2017-10-27common-utils-selftests.c: Add ATTRIBUTE_PRINTFSimon Marchi2-1/+6
Fix this, when building with clang: /home/emaisin/src/binutils-gdb/gdb/unittests/common-utils-selftests.c:50:40: error: format string is not a string literal [-Werror,-Wformat-nonliteral] std::string result = string_vprintf (fmt, vp); ^~~ gdb/ChangeLog: * unittests/common-utils-selftests.c (format): Add ATTRIBUTE_PRINTF.
2017-10-27C++ify xml-syscall.cSimon Marchi2-149/+108
This patch C++ifies the structures in xml-syscall.c, by using std::vector instead of VEC, and std::string instead of char*. Using a unique_ptr in syscall_parse_xml allows to remove a cleanup. Something that seems strange with the existing code, if you look at syscalls_info_free_syscalls_desc and syscalls_info_free_syscall_group_desc, they free the structure elements (the strings and vectors), but they don't free the syscall_desc and syscall_group_desc structure themselves. I don't see anything freeing those currently. Any idea why? According to the comment above syscalls_info_free_syscall_group_desc, it kinda looks like it's on purpose. With this patch, those structures are deleted when the vector that contains them gets deleted. The only time I'm aware a syscalls_info structure gets deleted is in the case the data directory changes during runtime, in init_syscalls_info. If tried that use case (including under valgrind): (gdb) catch syscall (gdb) set data-directory another-data-directory (gdb) catch syscall I confirmed that the syscalls_info structure got deleted and recreated, and everything seemed fine. Regtested on the buildbot. gdb/ChangeLog: * xml-syscall.c (struct syscall_desc): Add constructor. <name>: Change type to std::string. (syscall_desc_up): New typedef. (syscall_desc_p): Remove typeder. (DEF_VEC_P(syscall_desc_p)): Remove. (struct syscall_group_desc): Add constructor. <name>: Change type to std::string. <syscalls>: Change type to std::vector. (syscall_group_desc_up): New typedef. (syscall_group_desc_p): Remove typedef. (DEF_VEC_P(syscall_group_desc_p)): Remove. (struct syscalls_info) <syscalls>: Change type to std::vector of unique_ptr. <groups>: Likewise. <my_gdb_datadir>: Change type to std::string. (syscalls_info_up): New typedef. (allocate_syscalls_info): Remove. (syscalls_info_free_syscalls_desc): Remove. (syscalls_info_free_syscall_group_desc): Remove. (free_syscalls_info): Remove. (make_cleanup_free_syscalls_info): Remove. (syscall_group_create_syscall_group_desc): Adjust. (syscall_group_add_syscall): Adjust. (syscall_create_syscall_desc): Adjust. (syscall_parse_xml): Adjust, use unique_ptr instead of cleanup. (init_syscalls_info): Adjust. (syscall_group_get_group_by_name): Adjust. (xml_get_syscall_number): Adjust. (xml_get_syscall_name): Adjust. (xml_list_of_syscalls): Adjust. (xml_list_syscalls_by_group): Adjust. (xml_list_of_groups): Adjust.
2017-10-27Get rid of VEC(probe_p)Simon Marchi5-77/+56
Replace the remaining usages of VEC(probe_p) with std::vector. Regtested on the buildbot. gdb/ChangeLog: * probe.h: Don't include gdb_vecs.h. (DEF_VEC_P (probe_p)): Remove. (find_probes_in_objfile): Return an std::vector. * probe.c (find_probes_in_objfile): Likewise. * breakpoint.c (breakpoint_objfile_data) <longjmp_probes>: Change type to std::vector. <exception_probes>: Likewise. (free_breakpoint_probes): Don't manually free vectors. (create_longjmp_master_breakpoint): Adjust. (create_exception_master_breakpoint): Adjust. * solib-svr4.c (svr4_create_probe_breakpoints): Change parameter type, adjust. (svr4_create_solib_event_breakpoints): Adjust.
2017-10-27Allocate breakpoint_objfile_data with newSimon Marchi2-14/+22
Allocate with new and free with delete. This allows using an std::vector in the following patch. I renamed free_breakpoint_probes to free_breakpoint_objfile_data, because it now doesn't only free the probes vector, but also the breakpoint_objfile_data structure itself. gdb/ChangeLog: * breakpoint.c (breakpoint_objfile_data): Initialize fields. (get_breakpoint_objfile_data): Allocate breakpoint_objfile_data with new. (free_breakpoint_probes): Rename to ... (free_breakpoint_objfile_data): ... this, and call delete on bp_objfile_data..
2017-10-27Get rid of VEC(loaded_script_ptr)Simon Marchi2-33/+34
Direct replacement with std::vector. This allows removing a cleanup as well. Regtested on the buildbot. gdb/ChangeLog: * auto-load.c: Don't include gdb_vecs.h, include algorithm. (loaded_script_ptr): Remove typedef. (DEF_VEC_P (loaded_script_ptr)): Remove. (struct collect_matching_scripts_data): Add constructor. <scripts_p>: Change type to (pointer to) std::vector. (collect_matching_scripts_data): Adjust. (sort_scripts_by_name): Make suitable for std::sort. (print_scripts): Don't sort vector, adjust to std::vector. (auto_load_info_scripts): Sort vectors, adjust to std::vector.
2017-10-27Get rid of VEC(filename_language)Simon Marchi2-62/+40
This patch removes VEC(filename_language), replacing its usage with std::vector. filename_language::ext is changed to an std::string at the same time. Regtested on the buildbot. gdb/ChangeLog: * symfile.c (filename_language): Make struct, not typedef. Add constructor. <ext>: Change type to std::string. (DEF_VEC_O (filename_language)): Remove. (filename_language_table): Change type to std::vector. (add_filename_language): Adjust. (set_ext_lang_command): Adjust. (info_ext_lang_command): Adjust. (deduce_language_from_filename): Adjust. (class scoped_restore_filename_language_table): Remove. (test_filename_language): Use scoped_restore. (test_set_ext_lang_command): Use scoped_restore, adjust to std::vector change.
2017-10-27Add tests for filename_languageSimon Marchi2-0/+97
The next patch touches the filename_language area, but I noticed there is no test exercising that. This patch adds some selftests for add_filename_language, deduce_language_from_filename and set_ext_lang_command. Because these tests add entries to the global filename_language_table vector, it is not possible to run them successfully multiple times in a same GDB instance. They can potentially interfere with each other for the same reason. I therefore added the scoped_restore_filename_language_table class that is used to make sure tests leave that global vector in the same state they found it (it is replaced in the following patch by a simple scoped_restore). gdb/ChangeLog: * symfile.c: Include selftest.h. (class scoped_restore_filename_language_table): New. (test_filename_language): New test. (test_set_ext_lang_command): New test. (_initialize_symfile): Register tests.
2017-10-28Automatic date update in version.inGDB Administrator1-1/+1
2017-10-27Use SaL symbol name when reporting breakpoint locationsKeith Seitz5-2/+101
Currently, "info break" can show some (perhaps) unexpected results when setting a breakpoint on an inlined function: (gdb) list 1 #include <stdio.h> 2 3 static inline void foo() 4 { 5 printf("Hello world\n"); 6 } 7 8 int main() 9 { 10 foo(); 11 return 0; 12 } 13 (gdb) b foo Breakpoint 1 at 0x400434: file foo.c, line 5. (gdb) i b Num Type Disp Enb Address What 1 breakpoint keep y 0x0000000000400434 in main at foo.c:5 GDB reported that we understood what "foo" was, but we then report that the breakpoint is actually set in main. While that is literally true, we can do a little better. This is accomplished by copying the symbol for which the breakpoint was set into the bp_location. From there, print_breakpoint_location can use this information to print out symbol information (if available) instead of calling find_pc_sect_function. With the patch installed, (gdb) i b Num Type Disp Enb Address What 1 breakpoint keep y 0x0000000000400434 in foo at foo.c:5 gdb/ChangeLog: * breakpoint.c (print_breakpoint_location): Use the symbol saved in the bp_location, falling back to find_pc_sect_function when needed. (add_location_to_breakpoint): Save sal->symbol. * breakpoint.h (struct bp_location) <symbol>: New field. * symtab.c (find_function_start_sal): Save the symbol into the SaL. * symtab.h (struct symtab_and_line) <symbol>: New field. gdb/testsuite/ChangeLog: * gdb.opt/inline-break.exp (break_info_1): New procedure. Test "info break" for every inlined function breakpoint.
2017-10-27[AArch64] Mark LR clobbered by BL in inline asmYao Qi2-1/+6
LR is a caller-save register, so, if inline asm does BL (which touches LR), we should mark LR clobbered. gdb/testsuite: 2017-10-27 Yao Qi <yao.qi@linaro.org> * gdb.arch/insn-reloc.c (can_relocate_bl): Mark "x30" clobbered.
2017-10-27dwarf: Read register number as unsigned in DW_CFA_def_cfa*Simon Marchi2-4/+10
When displaying the .debug_frame section, the register numbers in the DW_CFA_def_cfa* statements are read as signed numbers. I have come across a target that has register 121, encoded as 0x79 in unsigned LEB128. Interpreting this as signed results in -7, which makes readelf display "r-7". The DWARF5 standard (6.4.2.2) states that the register numbers should be treated as unsigned LEB128. Simply replacing READ_SLEB with READ_ULEB resulted in warnings like these: /home/emaisin/src/binutils-gdb/binutils/dwarf.c: In function ‘display_debug_frames’: /home/emaisin/src/binutils-gdb/binutils/dwarf.c:355:17: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare] if ((var) != _val) \ ^ /home/emaisin/src/binutils-gdb/binutils/dwarf.c:7866:8: note: in expansion of macro ‘READ_ULEB’ READ_ULEB (fc->cfa_reg); ^ ... so I also changed Frame_Chunk::cfa_reg to an unsigned int. binutils/ChangeLog: * dwarf.c (struct Frame_Chunk) <cfa_reg>: Change type to unsigned int. (display_debug_frames): Read CFA reg as an unsigned number.
2017-10-27Add PR mention to previous commitSimon Marchi1-0/+1