aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2017-06-20Remove features/i386/amd64-*linux.c and features/i386/x32-*linux.cusers/qiyao/target-desc-2Yao Qi10-1998/+0
gdb: 2017-06-09 Yao Qi <yao.qi@linaro.org> * features/Makefile (XMLTOC): Remove i386/amd64XXX-linux.xml a * features/i386/amd64-avx-avx512-linux.c: Removed. * features/i386/amd64-avx-linux.c: Removed. * features/i386/amd64-avx-mpx-avx512-pku-linux.c: Removed. * features/i386/amd64-avx-mpx-linux.c: Removed. * features/i386/amd64-linux.c: Removed. * features/i386/amd64-mpx-linux.c: Removed. * features/i386/x32-avx-avx512-linux.c: Removed. * features/i386/x32-avx-linux.c: Removed. * features/i386/x32-linux.c: Removed.
2017-06-20[GDBserver] Use pre-generated amd64-linux tdesc as testYao Qi1-8/+3
Now, all these amd64-linux pre-generated tdesc can be used as test, so don't need to build them if $development is false. Note that this patch wants to remove ipa_x32_linux_regobj, but it was removed by mistake by 22049425ce40324139be82d9a6ec518c46b65815. gdb/gdbserver: 2017-06-09 Yao Qi <yao.qi@linaro.org> * configure.srv: Empty srv_amd64_linux_regobj if $development is false. (ipa_amd64_linux_regobj): Remove.
2017-06-20[GDBserver] Convert amd64-linux target descriptionsYao Qi5-139/+237
This patch changes amd64-linux target descriptions so that they can be dynamically generated. gdb/gdbserver: 2017-06-09 Yao Qi <yao.qi@linaro.org> * linux-amd64-ipa.c (get_ipa_tdesc): Remove. (initialize_low_tracepoint): Don't call init_registers_x32_XXX and init_registers_amd64_XXX. * linux-x86-low.c (x86_linux_read_description): Call amd64_get_ipa_tdesc. (x86_get_ipa_tdesc_idx): Likewise. (initialize_low_arch): Don't call init_registers_x32_XXX and init_registers_amd64_XXX. * linux-x86-tdesc-selftest.c: Declare init_registers_amd64_XXX and tdesc_amd64_XXX. [__x86_64__] (amd64_tdesc_test): New function. (initialize_low_tdesc) [__x86_64__]: Call init_registers_x32_XXX and init_registers_amd64_XXX. * linux-x86-tdesc.c: Include feature c files. (amd64_get_ipa_tdesc): New function. (get_ipa_tdesc): Call amd64_get_ipa_tdesc. (amd64_get_ipa_tdesc_idx): New function. * linux-x86-tdesc.h (amd64_get_ipa_tdesc_idx): Declare. (amd64_get_ipa_tdesc): Declare.
2017-06-20Regenerate two regformats/i386/.dat filesYao Qi2-3/+1
The self tests which compare pre-generated target descriptions and dynamically created target descriptions fail, and it turns out that two pre-generated target descriptions are wrong, so regenerate them. gdb: 2017-06-09 Yao Qi <yao.qi@linaro.org> * regformats/i386/amd64-avx-mpx-avx512-pku-linux.dat: Regenerated. * regformats/i386/amd64-avx-mpx-avx512-pku.dat: Regenerated.
2017-06-20Lazily and dynamically create amd64-linux target descriptionsYao Qi12-55/+646
This patch starts to use the generate c feature files to dynamically create amd64-linux target descriptions. gdb: 2017-06-08 Yao Qi <yao.qi@linaro.org> * amd64-linux-tdep.c: Don't include amd64-XXX-linux and x32-XXX-linux.c. Include 64bit-XX.c and x32-XX.c. (amd64_linux_read_description): Create target descriptions. (_initialize_amd64_linux_tdep): Don't call initialize_tdesc_XXX functions. Add unit tests. * features/Makefile (FEATURE_XMLFILES): Append 64bit-XXX.xml and x32-core.xml. Echo the right architecture for amd64 and x32. * features/i386/64bit-avx.c: Generated. * features/XXXX * target-descriptions.c (maint_print_c_tdesc_cmd): Print feature c files for amd64-linux and x32-linux.
2017-06-20Centralize amd64-linux target descriptionsYao Qi3-57/+35
This patch adds a new function amd64_linux_read_description, which creates amd64-linux target descriptions according to its two arguments, xcr0 and is_x32. gdb: 2017-06-07 Yao Qi <yao.qi@linaro.org> * amd64-linux-tdep.c (amd64_linux_read_description): New function. (amd64_linux_core_read_description): Call amd64_linux_read_description. (amd64_linux_init_abi): Likewise. (amd64_x32_linux_init_abi): Likewise. * amd64-linux-tdep.h (amd64_linux_read_description): Declare. * x86-linux-nat.c (x86_linux_read_description): Call amd64_linux_read_description.
2017-06-20GDBserver: remove srv_i386_linux_xmlfilesYao Qi1-3/+2
Now, GDBserver is able to create XML contents for target descriptions, so that the list of XML files about i386-linux are not needed. gdb/gdbserver: 2017-05-26 Yao Qi <yao.qi@linaro.org> * configure.srv: Remove srv_i386_linux_xmlfiles.
2017-06-20[GDBserver] Use pre-generated tdesc as testYao Qi5-94/+110
Now, these *-generate.c files are only used in GDBserver for unit test. If $development is false (in release), these *-generate.c files won't be used at all. gdb/gdbserver: 2017-05-26 Yao Qi <yao.qi@linaro.org> * configure.srv: Set srv_i386_linux_regobj empty if $development is false. * linux-x86-tdesc.c: TODO.
2017-06-20Remove features/i386/i386-*linux.cYao Qi8-1118/+0
Now, features/i386/i386-XXX-linux.c are not used, remove them. gdb: 2017-05-26 Yao Qi <yao.qi@linaro.org> * features/Makefile (XMLTOC): Remove i386/i386-XX-linux.xml. * features/i386/i386-avx-avx512-linux.c: Remove. * features/i386/i386-avx-linux.c: Remove. * features/i386/i386-avx-mpx-avx512-pku-linux.c: Remove. * features/i386/i386-avx-mpx-linux.c: Remove. * features/i386/i386-linux.c: Remove. * features/i386/i386-mmx-linux.c: Remove. * features/i386/i386-mpx-linux.c: Remove.
2017-06-20Dynamically composite xml in reply to GDBYao Qi13-49/+106
GDBserver still uses pre-generated target descriptions in order to reply to GDB's query on target description (see xml-builtin-generated.c in GDBserver build directory). This patch teaches GDBserver to create XML contents according to the target descriptions rather than using pre-generated ones. First, change target feature c files to pass the feature xml file name to tdesc_create_feature, so that target description in GDBserver can record them, and create XML contents from these features in buffer, like ... <xi:include href="$FEATURE1_XML_NAME"/> <xi:include href="$FEATURE2_XML_NAME"/> ... and send this buffer back to GDB. gdb/gdbserver: 2017-05-24 Yao Qi <yao.qi@linaro.org> * linux-x86-tdesc.c (i386_get_ipa_tdesc): Call set_tdesc_architecture and set_tdesc_osabi. Don't set xmltarget field. * server.c (get_features_xml): Call tdesc_get_features_xml. * tdesc.c (set_tdesc_architecture): New function. (set_tdesc_osabi): New function. (tdesc_get_features_xml): New function. (tdesc_create_feature): Add one argument. * tdesc.h (struct target_desc) <features>: New field. <arch>: New field. <osabi>: New field. (target_desc::~target_desc): xfree arch, osabi, and features. (set_tdesc_architecture): Declare. (set_tdesc_osabi): Declare. (tdesc_get_features_xml): Declare. * target-descriptions.c (tdesc_create_feature): Add one argument. * target-descriptions.h (tdesc_create_feature): Update the declaration.
2017-06-20[RFC] GDBserver unit test to i386_tdescYao Qi3-1/+98
This patch adds a unit test in GDBserver to test dynamically created target descriptions equal to these pre-generated ones. gdb/gdbserver: 2017-06-06 Yao Qi <yao.qi@linaro.org> * linux-x86-tdesc.c (i386_tdesc_test): New function. (initialize_low_tdesc): Call register_self_test. * tdesc.h: TODO.
2017-06-20[RFC] GDBserver self testYao Qi6-2/+89
This patch uses GDB self test in GDBserver. The self tests are run if GDBserver is started with option --self-test. gdb/gdbserver: 2017-05-26 Yao Qi <yao.qi@linaro.org> * configure.ac: AC_DEFINE GDB_SELF_TEST if $development. * configure, config.in: Re-generated. * server.c: Include sefltest.h and selftest.c. (captured_main): Handle option --self-test. gdb: 2017-05-26 Yao Qi <yao.qi@linaro.org> * selftest.c: Adjust it for GDBserver. gdb/testsuite: 2017-05-26 Yao Qi <yao.qi@linaro.org> * gdb.server/unittest.exp: New.
2017-06-20Dynamically create tdesc in GDBserverYao Qi12-21/+243
In this patch, GDBserver starts to use gdb/features/*.c feature files by including them, so that GDBserver can create target descriptions from features dynamically, like GDB does. Adjust these feature .c files for GDBserver. These feature .c files calls some target description APIs only defined GDB, so this patch also adds them in GDBserver. TODO: complete ChangeLog. gdb: 2017-06-06 Yao Qi <yao.qi@linaro.org> * features/i386/32bit-avx.c: Re-generated. * features/i386/32bit-avx512.c: Re-generated. * features/i386/32bit-core.c: Re-generated. * features/i386/32bit-linux.c: Re-generated. * features/i386/32bit-mpx.c: Re-generated. * features/i386/32bit-pkeys.c: Re-generated. * features/i386/32bit-sse.c: Re-generated. gdb/gdbserver: 2017-06-06 Yao Qi <yao.qi@linaro.org> * linux-x86-tdesc.c: Include ../features/i386/32bit-*.c. (initialize_low_tdesc): Don't use tdesc_i386_XXX_linux. (i386_get_ipa_tdesc): Create target descriptions. * tdesc.c (init_target_desc): (current_target_desc): (tdesc_create_feature): + (tdesc_create_flags): + (tdesc_add_flag): + (tdesc_named_type): + (tdesc_create_reg): + (tdesc_create_vector): + (tdesc_add_bitfield): + (tdesc_add_field): + (tdesc_set_struct_size): + * tdesc.h (target_desc::target_desc): New. (target_desc::~target_desc): New. * regformats/regdat.sh: Generate code to call tdesc_create_reg. * target-descriptions.c (print_c_feature::visit): Print code for GDB.
2017-06-20[GDBserver] Centralize tdesc for i386-linuxYao Qi5-93/+135
tdesc_i386_XXX_linux is spread in linux-x86-low.c and this patch adds a new function i386_get_ipa_tdesc to return the right tdesc according to tdesc index. Note that GDB has a similar function returning tdesc, but with different argument. Ultimately, GDB and GDBserver should share this function. gdb/gdbserver: 2017-06-07 Yao Qi <yao.qi@linaro.org> * configure.srv (srv_tgtobj): Append linux-x86-tdesc.o. (ipa_obj): Likewise. * linux-i386-ipa.c (get_ipa_tdesc): Move it to linux-x86-tdesc.c. (initialize_low_tracepoint): Don't call init_registers_XXX functions, call initialize_low_tdesc instead. * linux-x86-low.c (x86_linux_read_description): Call i386_get_ipa_tdesc. (initialize_low_arch): Don't call init_registers_i386_XXX functions, call initialize_low_tdesc. * linux-x86-tdesc.c: New file. * linux-x86-tdesc.h (x86_linux_tdesc): New X86_TDESC_LAST. (i386_get_ipa_tdesc_idx): Declare. (i386_get_ipa_tdesc): Declare. (initialize_low_tdesc): Declare.
2017-06-20Use VEC for target_desc.reg_defsYao Qi5-33/+37
Nowadays, target_desc.reg_defs is a pointer points to a pre-generated array, which is not flexible. This patch changes it from an array to a VEC so that GDBserver can create target descriptions dynamically later. Instead of using pre-generated array, the -generated.c calls VEC_safe_push to add each register to vector. Since target_desc.reg_defs is used in IPA, we need to build common/vec.c for IPA too. gdb/gdbserver: 2017-05-23 Yao Qi <yao.qi@linaro.org> * Makefile.in (IPA_OBJS): Add vec-ipa.o * regcache.c (get_thread_regcache): Use VEC_length. (init_register_cache): Likewise. (regcache_cpy): Likewise. (registers_to_string): Iterate reg_defs via VEC_iterate. (find_regno): Likewise. (find_register_by_number): Use VEC_index. (register_size): Call find_register_by_number. (register_data): Call find_register_by_number. (supply_regblock): Use VEC_length. (regcache_raw_read_unsigned): Likewise. * tdesc.c (init_target_desc): Iterate reg_defs via VEC_iterate. (default_description): Update initializer. (copy_target_description): Don't update field num_registers. * tdesc.h (struct target_desc) <reg_defs>: Change it to VEC. <num_registers>: Remove. gdb: 2017-05-23 Yao Qi <yao.qi@linaro.org> * regformats/regdat.sh: Update generated code.
2017-06-20Adjust code generated by regformats/regdat.shYao Qi1-8/+9
regformats/regdat.sh generate some *-generated.c files when GDBserver is built. Each .c file has some static variables, which are only used within function init_registers_XXX, like this, static struct reg regs_i386_linux[] = { { "eax", 0, 32 }, { "ecx", 32, 32 }, ... }; static const char *expedite_regs_i386_linux[] = { "ebp", "esp", "eip", 0 }; static const char *xmltarget_i386_linux = "i386-linux.xml"; void init_registers_i386_linux (void) { ... } This patch moves these static variables' definitions to function init_registers_XXX, so the generated files look like this, void init_registers_i386_linux (void) { static struct target_desc tdesc_i386_linux_s; struct target_desc *result = &tdesc_i386_linux_s; static struct reg regs_i386_linux[] = { ... }; static const char *expedite_regs_i386_linux[] = { "ebp", "esp", "eip", 0 }; static const char *xmltarget_i386_linux = "i386-linux.xml"; ... } gdb: 2017-06-06 Yao Qi <yao.qi@linaro.org> * regformats/regdat.sh: Adjust code order.
2017-06-20Use target_desc fields expedite_regs and xmltarget ifndef IN_PROCESS_AGENTYao Qi2-0/+5
struct target_desc is used by both GDBserver and IPA, but fields expedite_regs and xmltarget are only used in GDBserver, so this patch wraps these two fields by ifndef IN_PROCESS_AGENT. This patch also changes regformats/regdat.sh to generate .c files in this way too. gdb/gdbserver: 2017-06-06 Yao Qi <yao.qi@linaro.org> * tdesc.h (struct target_desc) [IN_PROCESS_AGENT] <expedite_regs>: Remove. [IN_PROCESS_AGENT] <xmltarget>: Likewise. gdb: 2017-06-06 Yao Qi <yao.qi@linaro.org> * regformats/regdat.sh: Generate code with "ifndef IN_PROCESS_AGENT".
2017-06-20Add "maint check xml-descriptions" to test builtin xml target descriptionsYao Qi8-0/+214
Now, GDB is able to dynamically create i386-linux target descriptions from features, instead of using pre-generated target descriptions. These pre-generated target descriptions are no longer used by GDB (note that they are still used by GDBserver). This patch add a new maint command "maint check xml-descriptions" to test dynamically generated tdesc are identical to these generated from xml files. gdb: 2017-06-06 Yao Qi <yao.qi@linaro.org> * cli/cli-cmds.c (maintenancechecklist): New variable. * gdbcmd.h (maintenancechecklist): Declare it. * i386-linux-tdep.c (_initialize_i386_linux_tdep) [GDB_SELF_TEST]: Call i386_linux_read_description with different masks. * maint.c (maintenance_check_command): New function. (_initialize_maint_cmds): Call add_prefix_cmd. * target-descriptions.c (tdesc_reg): override operator != and ==. (tdesc_type): Likewise. (tdesc_feature): Likewise. (target_desc): Likewise. [GDB_SELF_TEST] (selftests::record_xml_tdesc): New function. (maintenance_check_xml_descriptions): New function. (_initialize_target_descriptions) Add command "xml-descriptions". * target-descriptions.h (selftests::record_xml_tdesc): Declare. gdb/testsuite: 2017-06-06 Yao Qi <yao.qi@linaro.org> * gdb.gdb/unittest.exp: Invoke command "maintenance check xml-descriptions". gdb/doc: 2017-06-06 Yao Qi <yao.qi@linaro.org> * gdb.texinfo (Maintenance Commands): Document command "maint check xml-descriptions".
2017-06-20Lazily and dynamically create i386-linux target descriptionsYao Qi4-34/+62
Instead of using pre-generated target descriptions, this patch changes GDB to lazily and dynamically create target descriptions according to the target hardware capability (xcr0 in i386). This support any combination of target features. This patch also adds a unit test to make sure dynamically generated tdesc are identical to these generated from xml files. gdb: 2017-04-27 Yao Qi <yao.qi@linaro.org> * i386-linux-tdep.c (i386_linux_read_description): Generate target description if it doesn't exist. [GDB_SELF_TEST] (i386_linux_read_description_test): New unit test. (_initialize_i386_linux_tdep) [GDB_SELF_TEST]: Register unit test.
2017-06-20Generate c for feature instead of tdescYao Qi1-1/+3
gdb/doc: 2017-06-15 Yao Qi <yao.qi@linaro.org> : * gdb.texinfo (a C source file. By default, the target description is for the current):
2017-06-20Generate c for feature instead of tdescYao Qi2-4/+8
gdb: 2017-06-13 Yao Qi <yao.qi@linaro.org> : * NEWS gdb/doc: 2017-06-13 Yao Qi <yao.qi@linaro.org> : * gdb.texinfo (Print the entire architecture configuration. The optional argument):
2017-06-20Generate c for feature instead of tdescYao Qi10-17/+425
This patch changes Makefile and command "maint print c-files" so that GDB can print c files for features instead target description. Previously, we feed GDB a target description xml file, which generate c files including multiple features. With this patch, in Makefile, we wrap each feature xml file, and create a temp target description which include only one feature. Then, adjust the target description printer for them, and print a c function for each given feature, so that we can use these c functions later to create target description in a flexible way. Before GDB prints c-tdesc, we need to set tdesc. However, this involves some validations in each gdbarch on these target descriptions, and this make troubles to generate c file for each target feature when we feed GDB a target description only including an optional feature (without some mandatory feature), GDB just reject it, and don't print the c file. What we need here is to translate xml file to object target_desc, and translate the object target_desc to c file. We don't have to involve gdbarch validation in this process at all, so I modify command "maint print c-tdesc" to have an optional argument which is the filename of xml target description. If the file name is provided, parse the xml target description, create target_desc object, and print c file from it. gdb: 2017-05-22 Yao Qi <yao.qi@linaro.org> * features/Makefile (FEATURE_XMLFILES): New. (FEATURE_CFILES): New. New rules. * features/i386/32bit-avx.c: Generated. * features/i386/32bit-avx512.c: Generated. * features/i386/32bit-core.c: Generated. * features/i386/32bit-linux.c: Generated. * features/i386/32bit-mpx.c: Generated. * features/i386/32bit-pkeys.c: Generated. * features/i386/32bit-sse.c: Generated. * target-descriptions.c: Include algorithm. (tdesc_element_visitor): Add method visit_end. (print_c_tdesc): Implement visit_end. (print_c_tdesc:: m_filename_after_features): Move it to protected. (print_c_feature): New class. (maint_print_c_tdesc_cmd): Use print_c_feature if XML file name starts with "i386/32bit-". gdb/doc: 2017-06-08 Yao Qi <yao.qi@linaro.org> * gdb.texinfo (Maintenance Commands): Document optional argument of "maint print c-tdesc".
2017-06-20Use visitor pattern for "maint print c-tdesc"Yao Qi15-342/+427
Target description can be modeled as a tree, the target description is the root node, features are children nodes, registers and types are grand-children nodes. So command "maint print c-tdesc" in effect traverse/visit each node, and print them in c. This can be implemented by visitor pattern, this is the first reason. Secondly, I want to this command prints c files in a different way for some specific xml files, but still print c files the same way for the rest of xml files. Third, I even want to print xml files from target descriptions, so that GDBserver can use it to reply GDB's query qXfer:features:read:target.xml. After this change, all features/*.c should be re-generated, but this patch only includes part changes features/*.c files. gdb: 2017-05-25 Yao Qi <yao.qi@linaro.org> * target-descriptions.c (tdesc_element_visitor): New class. (tdesc_element): New class. (tdesc_reg): Inherit from tdesc_element. (tdesc_reg::accept): New function. (tdesc_type): Inherit from tdesc_element. (tdesc_type::accept): New function. (tdesc_feature): Inherit from tdesc_element. (tdesc_feature::accept): New function. (target_desc): Inherit from tdesc_element. (target_desc::target_desc): New. (target_desc::~target_desc): New. (target_desc::accept): New. (allocate_target_description): Use new. (free_target_description): Use delete. (print_c_tdesc): New class. (maint_print_c_tdesc_cmd): Adjust. * features/i386/i386-avx-avx512-linux.c: Re-generated. * features/i386/i386-avx-linux.c: Re-generated. * features/i386/i386-avx-mpx-avx512-pku-linux.c: Re-generated. * features/i386/i386-avx-mpx-linux.c: Re-generated. * features/i386/i386-linux.c: Re-generated. * features/i386/i386-mmx-linux.c: Re-generated.
2017-06-20Centralize i386 linux target descriptionsYao Qi3-36/+32
This patch moves all the tdesc_i386*_linux target descriptions to a function i386_linux_read_description, which returns the right target description according to xcr0. This also remove the duplication in getting target descriptions in corefile and native target. gdb: 2017-04-27 Yao Qi <yao.qi@linaro.org> * i386-linux-tdep.c (i386_linux_read_description): New function. (i386_linux_core_read_description): Call i386_linux_read_description. * i386-linux-tdep.h (i386_linux_read_description): Declare. (tdesc_i386_linux, tdesc_i386_mmx_linux): Remove declarations. (tdesc_i386_avx_linux, tdesc_i386_mpx_linux): Likewise (tdesc_i386_avx_mpx_linux, tdesc_i386_avx_avx512_linux): Likewise. (tdesc_i386_avx_mpx_avx512_pku_linux): Likewise. * x86-linux-nat.c (x86_linux_read_description): Call i386_linux_read_description.
2017-06-20Adjust the order of 32bit-linux.xml and 32bit-sse.xml in i386/i386-linux.xmlYao Qi2-4/+4
Exchange the order of 32bit-linux.xml and 32bit-sse.xml in i386/i386-linux.xml, to align with other i386 linux .xml files. gdb: 2017-04-27 Yao Qi <yao.qi@linaro.org> * features/i386/i386-linux.xml: Exchange the order of including 32bit-linux.xml and 32bit-sse.xml. * features/i386/i386-linux.c: Regenerated.
2017-06-20Class-fy tdesc_reg tdesc_type and tdesc_featureYao Qi2-100/+113
This patch class-fies them, adding ctor, dtor, and deleting copy ctor and assignment operator. gdb: 2017-06-20 Yao Qi <yao.qi@linaro.org> * target-descriptions.c (tdesc_reg): Add ctor, dtor. Delete copy ctor and assignment operator. (tdesc_type): Likewise. (tdesc_feature): Likewise. (tdesc_free_reg): Remove. (tdesc_create_reg): Use new. (tdesc_free_type): Remove. (tdesc_create_vector): Use new. (tdesc_create_union): Likewise. (tdesc_create_flags): Likewise. (tdesc_create_enum): Likewise. (tdesc_free_feature): Delete. (free_target_description): Use delete.
2017-06-20[GOLD] Avoid duplicate PLT stub symbols on ppc32James Clarke2-6/+17
If two objects are compiled with -fPIC or -fPIE and call the same function, two different PLT entries are created, one for each object, but the same stub symbol name is used for both. * powerpc.cc (Stub_table::define_stub_syms): Always include object's uniq_ value.
2017-06-19Check the DYNAMIC bit for input shared objectsH.J. Lu5-2/+50
Since the BFD section count may not be cleared for shared objects during linking, we should check the DYNAMIC bit for input shared objects. bfd/ PR ld/21626 * elf-properties.c (_bfd_elf_link_setup_gnu_properties): Check the DYNAMIC bit instead of bfd_count_sections. ld/ PR ld/21626 * testsuite/ld-i386/i386.exp: Run ld/21626 tests. * testsuite/ld-x86-64/x86-64.exp: Likewise.
2017-06-20Automatic date update in version.inGDB Administrator1-1/+1
2017-06-19Don't throw an error in 'info registers' for unavailable MIPS registers.John Baldwin2-2/+13
'info registers' for MIPS throws an error and when it first encounters an unavailable register. This does not match other architectures which annotate unavailable registers and continue to print out the values of subsequent registers. Replace the error by displaying an aligned "<unavailable>". This string is truncated to "<unavl>" when displaying a 32-bit register. gdb/ChangeLog: * mips-tdep.c (print_gp_register_row): Don't error for unavailable registers.
2017-06-19Update GDB test case for new lnia extended mnemonic.Peter Bergner3-3/+9
When I added the new lnia extended mnemonic for addpcis, I updated the assembler/disassembler test cases, but overlooked the GDB test cases. This patch fixes that oversight and associated test case failure. * gdb.arch/powerpc-power9.exp: Update test case for new lnia extended mnemonic. * gdb.arch/powerpc-power9.s: Likewise.
2017-06-19Fix address violation when attempting to display disassembled data.Nick Clifton2-12/+21
PR binutils/21619 * objdump.c (disassemble_bytes): Check that there is sufficient data available before attempting to display it.
2017-06-19Fix address violations when reading corrupt VMS records.Nick Clifton2-0/+36
PR binutils/21618 * vms-alpha.c (evax_bfd_print_emh): Check for insufficient record length. (evax_bfd_print_eeom): Likewise. (evax_bfd_print_egsd): Check for an overlarge record length. (evax_bfd_print_etir): Likewise.
2017-06-19Prevent address violation when attempting to disassemble a corrupt score binary.Nick Clifton2-0/+6
PR binutils/21614 * score-dis.c (score_opcodes): Add sentinel.
2017-06-19Fix access violation when parsing a corrupt IEEE binary.Nick Clifton3-3/+33
PR binutils/21612 * libieee.h (struct common_header_type): Add end_p field. * ieee.c (this_byte_and_next): Do not advance input_p beyond end_p. (read_id): Check for a length that exceeds the remaining bytes in the input buffer. (ieee_seek): Initialise end_p. (ieee_archive_p): Likewise. (ieee_object_p): Likewise.
2017-06-19Fix access violation disassembling a corrupt VMS binary.Nick Clifton2-7/+28
PR binutils/21611 * vms-alpha.c (_bfd_vms_slurp_eihs): Check for invalid offset before reading the EIHS structure entries.
2017-06-19.gdb_index writer: close the file before unlinking itPedro Alves2-1/+10
We should close the file before unlinking because on MS-Windows one cannot delete a file that is still open. I considered making 'gdb::unlinker::unlinker(const char *)' 'noexcept(true)' and then adding static_assert (noexcept (gdb::unlinker (filename.c_str ())), ""); but that doesn't really work because gdb::unlinker has a gdb_assert, which can throw a QUIT if/when the assertion fails. 'noexcept(true)' would cause GDB to abruptly terminate if/when the assertion fails. gdb/ChangeLog: 2017-06-19 Pedro Alves <palves@redhat.com> * dwarf2read.c (write_psymtabs_to_index): Construct file_closer after gdb::unlinker.
2017-06-19Fix access violation when disassembling a corrupt VMS binary.Nick Clifton2-2/+20
PR 21615 * vms-alpha.c (_bfd_vms_slurp_egsd): Use unsigned int for gsd_size. Check that there are enough bytes remaining to read the type and size of the next egsd. Check that the size of the egsd does not exceed the size of the record.
2017-06-19Correct target_underscore for crisAlan Modra2-7/+9
* config.bfd: Correct targ_underscore for cris.
2017-06-19Use getenv instead of gdb_environ on mi-cmd-env.cSergio Durigan Junior2-8/+9
This is a spinoff of <https://sourceware.org/ml/gdb-patches/2017-06/msg00437.html>. mi-cmd-env.c is using the whole gdb_environ machinery in order to access just one variable, which can be easily replaced by a simple call to getenv. This patch does that, and doesn't cause regressions. gdb/ChangeLog: 2017-06-18 Sergio Durigan Junior <sergiodj@redhat.com> * mi/mi-cm-env.c (_initialize_mi_cmd_env): Use getenv instead of gdb_environ to access an environment variable.
2017-06-19Automatic date update in version.inGDB Administrator1-1/+1
2017-06-18nat/linux-ptrace.c: add missing gdb_byte* castThomas Petazzoni2-1/+6
On noMMU platforms, the following code gets compiled: child_stack = xmalloc (STACK_SIZE * 4); Where child_stack is a gdb_byte*, and xmalloc() returns a void*. While the lack of cast is valid in C, it is not in C++, causing the following build failure: ../nat/linux-ptrace.c: In function 'int linux_fork_to_function(gdb_byte*, int (*)(void*))': ../nat/linux-ptrace.c:273:29: error: invalid conversion from 'void*' to 'gdb_byte* {aka unsigned char*}' [-fpermissive] child_stack = xmalloc (STACK_SIZE * 4); Therefore, this commit adds the appropriate cast. gdb/ChangeLog: * nat/linux-ptrace.c (linux_fork_to_function): Add cast to gdb_byte*. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2017-06-18is_underscore_target for ld-elf testsAlan Modra30-98/+112
and correct targ_underscore in config.bfd bfd/ * config.bfd: Correct targ_underscore for epiphany, ip2k, m32c, mn10200, pru, rl78, rx, crisv32 and v850. ld/ * testsuite/lib/ld-lib.exp (is_underscore_target): New. * testsuite/ld-elf/elf.exp (ASFLAGS): Define UNDERSCORE. * testsuite/ld-elf/pr21562a.s: If UNDERSCORE defined, reference sym with prefix. * testsuite/ld-elf/pr21562b.s: Likewise. * testsuite/ld-elf/sizeof.s: Likewise. * testsuite/ld-elf/startof.s: Likewise. * testsuite/ld-elf/pr14156a.d: Adjust for extra symbols. * testsuite/ld-elf/pr21562a.d: Remove underscore target from xfails, and match prefixed symbol. * testsuite/ld-elf/pr21562b.d: Likewise. * testsuite/ld-elf/pr21562c.d: Likewise. * testsuite/ld-elf/pr21562d.d: Likewise. * testsuite/ld-elf/pr21562e.d: Likewise. * testsuite/ld-elf/pr21562f.d: Likewise. * testsuite/ld-elf/pr21562g.d: Likewise. * testsuite/ld-elf/pr21562h.d: Likewise. * testsuite/ld-elf/pr21562i.d: Likewise. * testsuite/ld-elf/pr21562j.d: Likewise. * testsuite/ld-elf/pr21562k.d: Likewise. * testsuite/ld-elf/pr21562l.d: Likewise. * testsuite/ld-elf/pr21562m.d: Likewise. * testsuite/ld-elf/pr21562n.d: Likewise. * testsuite/ld-elf/sizeofa.d: Likewise. * testsuite/ld-elf/sizeofb.d: Likewise. * testsuite/ld-elf/sizeofc.d: Likewise. * testsuite/ld-elf/startofa.d: Likewise. * testsuite/ld-elf/startofb.d: Likewise. * testsuite/ld-elf/startofc.d: Likewise.
2017-06-18Automatic date update in version.inGDB Administrator1-1/+1
2017-06-17Add ATTRIBUTE_PRINTF to trace_start_errorSimon Marchi2-1/+5
clang complains that the fmt passed to vwarning in trace_start_error is not a literal. This looks like a fair warning, which can be removed by adding ATTRIBUTE_PRINTF to the declaration of trace_start_error. gdb/ChangeLog: * nat/fork-inferior.h (trace_start_error): Add ATTRIBUTE_PRINTF.
2017-06-17linux-low: Remove usage of "register" keywordSimon Marchi2-8/+13
AFAIK, the register keyword is not relevant today, and clang complains about it: /home/emaisin/src/binutils-gdb/gdb/gdbserver/linux-low.c:5873:3: error: 'register' storage class specifier is deprecated and incompatible with C++1z [-Werror,-Wdeprecated-register] register PTRACE_XFER_TYPE *buffer; ^~~~~~~~~ I think we can safely remove it. gdb/gdbserver/ChangeLog: * linux-low.c (linux_read_memory, linux_write_memory): Remove usage of "register" keyword.
2017-06-17gdb: Add -Wno-mismatched-tagsSimon Marchi5-3/+15
clang complains that for some types, we use both the class and struct keywords in different places. It's not really a problem, so I think we can safely turn this warning off. gdb/ChangeLog: * configure: Re-generate. * warning.m4 (build_warnings): Add -Wno-mismatched-tags. gdb/gdbserver/ChangeLog: * configure: Re-generate.
2017-06-17gdb: Use -Werror when checking for (un)supported warning flagsSimon Marchi5-9/+19
In warning.m4, we pass all the warning flags one by one to the compiler to test if they are supported by this particular compiler. If the compiler exits with an error, we conclude that this warning flag is not supported and exclude it. This allows us to use warning flags without having to worry about which versions of which compilers support each flag. clang, by default, only emits a warning if an unknown flag is passed: warning: unknown warning option '-Wfoo' [-Wunknown-warning-option] The result is that we think that all the warning flags we use are supported by clang (they are not), and the compilation fails later when building with -Werror, since the aforementioned warning becomes an error. The fix is to also pass -Werror when probing for supported flags, then we'll correctly get an error when using an unknown warning, and we'll exclude it: error: unknown warning option '-Wfoo' [-Werror,-Wunknown-warning-option] I am not sure why there is a change in a random comment in gdbserver/configure, but I suppose it's a leftfover from a previous patch, so I included it. gdb/ChangeLog: * configure: Re-generate. * warning.m4: Pass -Werror to compiler when checking for supported warning flags. gdb/gdbserver/ChangeLog: * configure: Re-generate.
2017-06-17gdb: Pass -x c++ to the compilerSimon Marchi4-2/+10
Because we are compiling .c files containing C++ code, clang++ complains with: clang: error: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated If renaming all the source files to .cpp is out of the question, an alternative is to pass "-x c++" to convince the compiler that we are really compiling C++. It works fine with GCC too. gdb/ChangeLog: * Makefile.in (COMPILE.pre): Add "-x c++". gdb/gdbserver/ChangeLog: * Makefile.in (COMPILE.pre): Add "-x c++".
2017-06-17Automatic date update in version.inGDB Administrator1-1/+1