aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2019-04-04Move expression_context_* globals to parser_stateTom Tromey11-81/+136
This moves the expression_context_block and expression_context_pc globals to be members of parser_state and updates the parsers. gdb/ChangeLog 2019-04-04 Tom Tromey <tom@tromey.com> * rust-exp.y (rust_parser::crate_name, rust_parser::super_name) (rust_parser::convert_ast_to_type) (rust_parser::convert_ast_to_expression, rust_lex_tests): Update. * parser-defs.h (struct parser_state) <parser_state>: Add parameters. Initialize new members. <expression_context_block, expression_context_pc>: New members. * parse.c (expression_context_block, expression_context_pc): Remove globals. (parse_exp_in_context): Update. * p-exp.y: Update all rules. (yylex): Update. * m2-exp.y: Update all rules. (yylex): Update. * go-exp.y (yylex): Update. * f-exp.y (yylex): Update. * d-exp.y: Update all rules. (yylex): Update. * c-exp.y: Update all rules. (lex_one_token, classify_name, yylex, c_parse): Update. * ada-exp.y (write_var_or_type, write_name_assoc): Update.
2019-04-04Make base class for parser_stateTom Tromey9-73/+115
This makes a new base class, expr_builder, for parser_state. This separates the state needed to construct an expression from the state needed by the parsers. gdb/ChangeLog 2019-04-04 Tom Tromey <tom@tromey.com> * gdbarch.h, gdbarch.c: Rebuild. * gdbarch.sh (dtrace_parse_probe_argument): Change type. * stap-probe.h: (struct stap_parse_info): Replace "parser_state" with "expr_builder". * parser-defs.h (struct expr_builder): Rename from "parser_state". (parser_state): New class. * parse.c (expr_builder): Rename. (expr_builder::release): Rename. (write_exp_elt, write_exp_elt_opcode, write_exp_elt_sym) (write_exp_elt_msym, write_exp_elt_block, write_exp_elt_objfile) (write_exp_elt_longcst, write_exp_elt_floatcst) (write_exp_elt_type, write_exp_elt_intern, write_exp_string) (write_exp_string_vector, write_exp_bitstring) (write_exp_msymbol, mark_struct_expression) (write_dollar_variable) (insert_type_address_space, increase_expout_size): Replace "parser_state" with "expr_builder". * dtrace-probe.c: Replace "parser_state" with "expr_builder". * amd64-linux-tdep.c (amd64_dtrace_parse_probe_argument): Replace "parser_state" with "expr_builder".
2019-04-04Turn parse_language into a methodTom Tromey10-62/+85
This changes parse_language into a method of parser_state. This patch was written by a script. gdb/ChangeLog 2019-04-04 Tom Tromey <tom@tromey.com> * rust-exp.y: Replace "parse_language" with method call. * p-exp.y: (yylex): Replace "parse_language" with method call. * m2-exp.y: (yylex): Replace "parse_language" with method call. * go-exp.y (classify_name): Replace "parse_language" with method call. * f-exp.y (yylex): Replace "parse_language" with method call. * d-exp.y (lex_one_token): Replace "parse_language" with method call. * c-exp.y: (lex_one_token, classify_name, yylex): Replace "parse_language" with method call. * ada-exp.y (find_primitive_type, type_char) (type_system_address): Replace "parse_language" with method call.
2019-04-04Turn parse_gdbarch into a methodTom Tromey13-95/+124
This changes parse_gdbarch into a method of parser_state. This patch was written by a script. gdb/ChangeLog 2019-04-04 Tom Tromey <tom@tromey.com> * rust-exp.y: Replace "parse_gdbarch" with method call. * parse.c (write_dollar_variable, insert_type_address_space): Replace "parse_gdbarch" with method call. * p-exp.y (parse_type, yylex): Replace "parse_gdbarch" with method call. * objc-lang.c (end_msglist): Replace "parse_gdbarch" with method call. * m2-exp.y (parse_type, parse_m2_type, yylex): Replace "parse_gdbarch" with method call. * go-exp.y (parse_type, classify_name): Replace "parse_gdbarch" with method call. * f-exp.y (parse_type, parse_f_type, yylex): Replace "parse_gdbarch" with method call. * d-exp.y (parse_type, parse_d_type, lex_one_token): Replace "parse_gdbarch" with method call. * c-exp.y (parse_type, parse_number, classify_name): Replace "parse_gdbarch" with method call. * ada-lex.l: Replace "parse_gdbarch" with method call. * ada-exp.y (parse_type, find_primitive_type, type_char) (type_system_address): Replace "parse_gdbarch" with method call.
2019-04-04Remove parser_state "initial_size" parameterTom Tromey7-13/+23
All the real (not test) uses of parser_state pass 10 as the "initial_size" parameter, and it seems to me that there's no real reason to require callers to set this. This patch removes this parameter. gdb/ChangeLog 2019-04-04 Tom Tromey <tom@tromey.com> * dtrace-probe.c (dtrace_probe::build_arg_exprs): Update. * stap-probe.c (stap_parse_argument): Update. * stap-probe.h (struct stap_parse_info) <stap_parse_info>: Remove initial_size parameter. * rust-exp.y (rust_lex_tests): Update. * parse.c (parser_state): Update. (parse_exp_in_context): Update. * parser-defs.h (struct parser_state) <parser_state>: Remove "initial_size" parameter.
2019-04-04Make increase_expout_size staticTom Tromey3-8/+12
increase_expout_size is only called from parse.c, and probably only should be. This makes it "static". Tested by rebuilding. gdb/ChangeLog 2019-04-04 Tom Tromey <tom@tromey.com> * parser-defs.h (increase_expout_size): Don't declare. * parse.c (increase_expout_size): Now static.
2019-04-05PowerPC conditional branch testAlan Modra9-0/+421
Adds a new test checking conditional branch BO values. * testsuite/gas/ppc/bc.s, * testsuite/gas/ppc/bcat.d, * testsuite/gas/ppc/bcaterr.d, * testsuite/gas/ppc/bcaterr.l, * testsuite/gas/ppc/bcy.d, * testsuite/gas/ppc/bcyerr.d, * testsuite/gas/ppc/bcyerr.l: New tests. * testsuite/gas/ppc/ppc.exp: Run them.
2019-04-05PowerPC bc extended branch mnemonics and "y" hintsAlan Modra2-141/+148
This patch fixes a problem with disassembly of branch instructions for processors complying with PowerPC ISA versions prior to version 2.0, ie. those that use "y" bit branch taken hints. Many of the extended bcctr and bclr mnemonics that should have disassembled with a "-" suffix, ie. not taken, did not display the "-" due to the ordering in powerpc_opcodes. I believe it's been that way from the original 85dcf36d72b commit of ppc-opc.c. I've also added a BH field (optional) to a few opcodes. This gives better disassembly in raw mode, showing the branch taken hint in the mnemonic as is done for bc. It would be reasonable to add a BH field to all bcctr, bclr, and bctar extended mnemonics but that runs into a small difficulty: Currently we print all or none of the optional operands. That means for example that "bgectr cr2" would display as "bgectr cr2,0" if a BH field is added to bgectr. * ppc-opc.c (XLBH_MASK): Subtract off BH field from BB_MASK. (powerpc_opcodes): Reorder bcctr and bclr extended mnemonics to favour printing of "-" branch hint when using the "y" bit. Allow BH field on bc{ctr,lr,tar}{,l}{-,+}.
2019-04-05PowerPC disassembler: Don't emit trailing spacesAlan Modra19-63/+96
When an instruction has operands, the PowerPC disassembler prints spaces after the opcode so as to line up operands. If the operands are all optional and all default value, then no operands are printed, leaving trailing spaces. This patch fixes that. opcodes/ * ppc-dis.c (print_insn_powerpc): Delay printing spaces after opcode until first operand is output. gas/ * testsuite/gas/ppc/476.d: Remove trailing spaces. * testsuite/gas/ppc/a2.d: Likewise. * testsuite/gas/ppc/booke.d: Likewise. * testsuite/gas/ppc/booke_xcoff.d: Likewise. * testsuite/gas/ppc/e500.d: Likewise. * testsuite/gas/ppc/e500mc.d: Likewise. * testsuite/gas/ppc/e6500.d: Likewise. * testsuite/gas/ppc/htm.d: Likewise. * testsuite/gas/ppc/power6.d: Likewise. * testsuite/gas/ppc/power8.d: Likewise. * testsuite/gas/ppc/power9.d: Likewise. * testsuite/gas/ppc/vle.d: Likewise. ld/ * testsuite/ld-powerpc/tlsexe32.d: Remove trailing spaces. * testsuite/ld-powerpc/tlsopt5.d: Likewise. * testsuite/ld-powerpc/tlsopt5_32.d: Likewise.
2019-04-05Automatic date update in version.inGDB Administrator1-1/+1
2019-04-04Add extended mnemonics for bctar. Fix setting of 'at' branch hints.Peter Bergner7-73/+584
opcodes/ PR gas/24349 * ppc-opc.c (valid_bo_pre_v2): Add comments. (valid_bo_post_v2): Add support for 'at' branch hints. (insert_bo): Only error on branch on ctr. (get_bo_hint_mask): New function. (insert_boe): Add new 'branch_taken' formal argument. Add support for inserting 'at' branch hints. (extract_boe): Add new 'branch_taken' formal argument. Add support for extracting 'at' branch hints. (insert_bom, extract_bom, insert_bop, extract_bop): New functions. (BOE): Delete operand. (BOM, BOP): New operands. (RM): Update value. (XLYLK, XLYLK_MASK, XLYBB_MASK): Delete. (powerpc_opcodes) <bc-, bcl-, bca-, bcla-, bclr-, bclrl-, bcctr-, bcctrl-, bctar-, bctarl->: Replace BOE with BOM. (powerpc_opcodes) <bc+, bcl+, bca+, bcla+, bclr+, bclrl+, bcctr+, bcctrl+, bctar+, bctarl+>: Replace BOE with BOP. <bdnztar, bdnztarl, bdztar, bdztarl, btar, btarl, bdnztar-, bdnztarl-, bdnztar+, bdnztarl+, bdztar-, bdztarl-, bdztar+, bdztarl+, bgetar, bnltar, bgetarl, bnltarl, bletar, bngtar, bletarl, bngtarl, bnetar, bnetarl, bnstar, bnutar, bnstarl, bnutarl, bgetar-, bnltar-, bgetarl-, bnltarl-, bletar-, bngtar-, bletarl-, bngtarl-, bnetar-, bnetarl-, bnstar-, bnutar-, bnstarl-, bnutarl-, bgetar+, bnltar+, bgetarl+, bnltarl+, bletar+, bngtar+, bletarl+, bngtarl+, bnetar+, bnetarl+, bnstar+, bnutar+, bnstarl+, bnutarl+, blttar, blttarl, bgttar, bgttarl, beqtar, beqtarl, bsotar, buntar, bsotarl, buntarl, blttar-, blttarl-, bgttar-, bgttarl-, beqtar-, beqtarl-, bsotar-, buntar-, bsotarl-, buntarl-, blttar+, blttarl+, bgttar+, bgttarl+, beqtar+, beqtarl+, bsotar+, buntar+, bsotarl+, buntarl+, bdnzftar, bdnzftarl, bdzftar, bdzftarl, bftar, bftarl, bftar-, bftarl-, bftar+, bftarl+, bdnzttar, bdnzttarl, bdzttar, bdzttarl, bttar, bttarl, bttar-, bttarl-, bttar+, bttarl+>: New extended mnemonics. gas/ PR gas/24349 * testsuite/gas/ppc/power8.s: (bdnztar, bdnztarl, bdztar, bdztarl, btar, btarl, bdnztar-, bdnztarl-, bdnztar+, bdnztarl+, bdztar-, bdztarl-, bdztar+, bdztarl+, bgetar, bnltar, bgetarl, bnltarl, bletar, bngtar, bletarl, bngtarl, bnetar, bnetarl, bnstar, bnutar, bnstarl, bnutarl, bgetar-, bnltar-, bgetarl-, bnltarl-, bletar-, bngtar-, bletarl-, bngtarl-, bnetar-, bnetarl-, bnstar-, bnutar-, bnstarl-, bnutarl-, bgetar+, bnltar+, bgetarl+, bnltarl+, bletar+, bngtar+, bletarl+, bngtarl+, bnetar+, bnetarl+, bnstar+, bnutar+, bnstarl+, bnutarl+, blttar, blttarl, bgttar, bgttarl, beqtar, beqtarl, bsotar, buntar, bsotarl, buntarl, blttar-, blttarl-, bgttar-, bgttarl-, beqtar-, beqtarl-, bsotar-, buntar-, bsotarl-, buntarl-, blttar+, blttarl+, bgttar+, bgttarl+, beqtar+, beqtarl+, bsotar+, buntar+, bsotarl+, buntarl+, bdnzftar, bdnzftarl, bdzftar, bdzftarl, bftar, bftarl, bftar-, bftarl-, bftar+, bftarl+, bdnzttar, bdnzttarl, bdzttar, bdzttarl, bttar, bttarl, bttar-, bttarl-, bttar+, bttarl+): Add tests of extended mnemonics. * testsuite/gas/ppc/power8.d: Likewise. Update previous bctar tests to expect new extended mnemonics. * testsuite/gas/ppc/a2.s: <bc, bc-, bc+, bcl, bcl-, bcl+>: Update test to not use illegal BO value. Use a more convenient BI value. * testsuite/gas/ppc/a2.d: Update tests for new expect output.
2019-04-04[GDB, Hurd] Fix build; 'target_waitstatus_to_string' callThomas Schwinge2-1/+6
Recent commit c29705b71a8ec966478c0dc4712194a95291c6de removed an incomplete local implementation in favor of 'target_waitstatus_to_string' (thanks!), but introduced a small typing error: In file included from [...]/gdb/gnu-nat.c:24:0: [...]/gdb/gnu-nat.c: In member function 'virtual ptid_t gnu_nat_target::wait(ptid_t, target_waitstatus*, int)': [...]/gdb/gnu-nat.c:1652:43: error: cannot convert 'target_waitstatus**' to 'const target_waitstatus*' for argument '1' to 'std::__cxx11::string target_waitstatus_to_string(const target_waitstatus*)' target_waitstatus_to_string (&status).c_str ()); ^ [...]/gdb/gnu-nat.h:119:32: note: in definition of macro 'debug' __FILE__ , __LINE__ , ##args); } while (0) ^~~~ [...]/gdb/gnu-nat.c:1650:3: note: in expansion of macro 'inf_debug' inf_debug (inf, "returning ptid = %s, %s", ^~~~~~~~~ gdb/ * gnu-nat.c (gnu_nat_target::wait): Fix target_waitstatus_to_string call.
2019-04-04Automatic date update in version.inGDB Administrator1-1/+1
2019-04-03gas: use literals/const16 for xtensa loop relaxationMax Filippov3-142/+65
Loop opcode relaxation that uses addi/addmi doesn't work well with other relaxations that may cause code movement. Instead of encoding fixed loop end offset in the relaxed sequence use l32r or a pair of const16 to load loop end address. This way the address of the loop end gets a relocation record and it gets updated appropriately. gas/ 2019-04-03 Max Filippov <jcmvbkbc@gmail.com> * config/tc-xtensa.c (convert_frag_immed): Drop convert_frag_immed_finish_loop invocation. (convert_frag_immed_finish_loop): Drop declaration and definition. * config/xtensa-relax.c (widen_spec_list): Replace loop widening that uses addi/addmi with widening that uses l32r and const16.
2019-04-03PR24411, Division is not accepted in MEMORY length expressionAlan Modra2-1/+11
Let's hope no one has section names starting with '/' in scripts. If they do, this change to fix parsing of '/' in expressiongs will break their project. PR 24411 ldlex.l (SYMBOLNAMECHAR1): Don't match '/'. (<EXPRESSION>"/DISCARD/"): New.
2019-04-03ldlex.l tidyAlan Modra2-20/+22
Underscore was specified twice in all these patterns, and backslash twice in some. Flex warned about the $SYSROOT rule, which is covered by earlier rules: "ldlex.l:386: warning, rule cannot be matched". * ldlex.l: Formatting. (CMDFILENAMECHAR, CMDFILENAMECHAR1): Delete. (FILENAMECHAR1, SYMBOLNAMECHAR1, FILENAMECHAR, WILDCHAR), (NOCFILENAMECHAR): Remove duplicate chars. Reorder. (SYMBOLCHARN): Likewise. Rename to SYMBOLNAMECHAR. (<INPUTLIST>"$SYSROOT"..): Delete rule.
2019-04-03BFD whitespace fixesAlan Modra24-188/+197
* coff-i386.c, * coff-x86_64.c, * coffgen.c, * dwarf2.c, * elf-m10200.c, * elf.c, * elf32-arm.c, * elf32-bfin.c, * elf32-csky.c, * elf32-m32r.c, * elf32-microblaze.c, * elf32-pru.c, * elf32-rx.c, * elf32-xgate.c, * elf64-sparc.c, * elfnn-ia64.c, * elfxx-riscv.c, * elfxx-sparc.c, * linker.c, * mach-o.c, * pe-x86_64.c, * pei-x86_64.c, * plugin.c: Whitespace fixes.
2019-04-03Automatic date update in version.inGDB Administrator1-1/+1
2019-04-02RISC-V: Don't check ABI flags if no code section.Jim Wilson2-2/+39
This fixes a glib build failure reported in PR 24389. Using ld -b binary creates an object file with no elf header flags set which has the wrong ABI info for riscv64-linux. But the file also has no code sections, so I added code borrowed from the arm port that only checks the ELF header ABI flags if there is a code section. bfd/ PR 24389 * elfnn-riscv.c (_bfd_riscv_elf_merge_private_bfd_data): Move read of ELF header flags to after check for ELF object file. Loop through sections looking for code sections, if none, then skip ABI checks.
2019-04-02Automatic date update in version.inGDB Administrator1-1/+1
2019-04-01gdb/fortran: Handle internal function callsAndrew Burgess5-5/+34
If an convenience function is defined in python (or guile), then currently this will not work in Fortran, instead the user is given this message: (gdb) set language fortran (gdb) p $myfunc (3) Cannot perform substring on this type Compare this to C: (gdb) set language c (gdb) p $myfunc (3) $1 = 1 After this patch we see the same behaviour in both C and Fortran. I've extended the test to check that all languages can call the convenience functions - only Fortran was broken. When calling convenience functions in Fortran we don't need to perform the same value preparation (passing by pointer) that we would for calling a native function - passing the real value is fine. gdb/ChangeLog: * eval.c (evaluate_subexp_standard): Handle internal functions during Fortran function call handling. gdb/testsuite/ChangeLog: * gdb.python/py-function.exp: Check calling helper function from all languages. * lib/gdb.exp (gdb_supported_languages): New proc.
2019-04-01gdb: Add $_cimag and $_creal internal functionsAndrew Burgess10-2/+234
Add two new internal functions $_cimag and $_creal that extract the imaginary and real parts of a complex value. These internal functions can take a complex value of any type 'float complex', 'double complex', or 'long double complex' and return a suitable floating point value 'float', 'double', or 'long double'. So we can now do this: (gdb) p z1 $1 = 1.5 + 4.5 * I (gdb) p $_cimag (z1) $4 = 4.5 (gdb) p $_creal (z1) $4 = 1.5 The components of a complex value are not strictly named types in DWARF, as the complex type is itself the base type. However, once we are able to extract the components it makes sense to be able to ask what the type of these components is and get a sensible answer back, rather than the error we would currently get. Currently GDB says: (gdb) ptype z1 type = complex double (gdb) p $_cimag (z1) $4 = 4.5 (gdb) ptype $ type = <invalid type code 9> With the changes in dwarf2read.c, GDB now says: (gdb) ptype z1 type = complex double (gdb) p $_cimag (z1) $4 = 4.5 (gdb) ptype $ type = double Which seems to make more sense. gdb/ChangeLog: * NEWS: Mention new internal functions. * dwarf2read.c (dwarf2_init_complex_target_type): New function. (read_base_type): Use dwarf2_init_complex_target_type. * value.c (creal_internal_fn): New function. (cimag_internal_fn): New function. (_initialize_values): Register new internal functions. gdb/doc/ChangeLog: * gdb.texinfo (Convenience Funs): Document '$_creal' and '$_cimag'. gdb/testsuite/ChangeLog: * gdb.base/complex-parts.c: New file. * gdb.base/complex-parts.exp: New file.
2019-04-01Fix internal error and improve 'set debug infrun 1'/target wait kind tracePhilippe Waroquiers4-72/+31
The test gdb.threads/watchthreads-reorder.exp verifies that the 'set debug infrun 1' debug output does not crash GDB. Under high load, the test can still cause a GDB internal error (see details below). This patch fixes this crash, and improves/factorises some wait kind traces. Tested on debian/amd64 + run one test with 'set debug infrun 1'. Changes compared to the first version: * Handles the suggestions of Kevin to trace the relevant elements of the wait status (this is done by calling target_waitstatus_to_string). * Some other changes to factorise wait status tracing. Note that using target_waitstatus_to_string instead of the 'locally printed' status kind strings means that debug trace that was using strings such as: "EXITED" or "TARGET_WAITKIND_EXITED" will now use what is printed by target_waitstatus_to_string e.g. "exited". gdb/ChangeLog 2019-04-01 Philippe Waroquiers <philippe.waroquiers@skynet.be> * infrun.c (stop_all_threads): If debug_infrun, always trace the wait status after wait_one, using target_waitstatus_to_string and target_pid_to_str. (handle_inferior_event): Replace various trace of wait status kind by a single trace. * gdb/gnu-nat.c (gnu_nat_target::wait): Replace local wait status kind image by target_waitstatus_to_string. * target/waitstatus.c (target_waitstatus_to_string): Fix obsolete comment. (top-gdb) bt #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51 #1 0x00007f3d54a0642a in __GI_abort () at abort.c:89 #2 0x0000555c24c60e66 in dump_core () at ../../fixleaks/gdb/utils.c:201 #3 0x0000555c24c63d49 in internal_vproblem(internal_problem *, const char *, int, const char *, typedef __va_list_tag __va_list_tag *) (problem=problem@entry=0x555c25338d40 <internal_error_problem>, file=<optimized out>, line=287, fmt=<optimized out>, ap=<optimized out>) at ../../fixleaks/gdb/utils.c:411 #4 0x0000555c24c63eab in internal_verror (file=<optimized out>, line=<optimized out>, fmt=<optimized out>, ap=<optimized out>) at ../../fixleaks/gdb/utils.c:436 #5 0x0000555c249e8c22 in internal_error (file=file@entry=0x555c24e0f2ad "../../fixleaks/gdb/inferior.c", line=line@entry=287, fmt=<optimized out>) at ../../fixleaks/gdb/common/errors.c:55 #6 0x0000555c247d3f5c in find_inferior_pid (pid=<optimized out>) at ../../fixleaks/gdb/inferior.c:287 #7 0x0000555c24ad2248 in find_inferior_pid (pid=<optimized out>) at ../../fixleaks/gdb/inferior.c:302 #8 find_inferior_ptid (ptid=...) at ../../fixleaks/gdb/inferior.c:301 #9 0x0000555c24c35f25 in find_thread_ptid (ptid=...) at ../../fixleaks/gdb/thread.c:522 #10 0x0000555c24b0ab4d in thread_db_target::pid_to_str[abi:cxx11](ptid_t) ( this=0x555c2532e3e0 <the_thread_db_target>, ptid=...) at ../../fixleaks/gdb/linux-thread-db.c:1637 #11 0x0000555c24c2f420 in target_pid_to_str[abi:cxx11](ptid_t) (ptid=...) at ../../fixleaks/gdb/target.c:2083 #12 0x0000555c24ad9cab in stop_all_threads () at ../../fixleaks/gdb/infrun.c:4373 #13 0x0000555c24ada00f in stop_waiting (ecs=<optimized out>) at ../../fixleaks/gdb/infrun.c:7464 #14 0x0000555c24adc401 in process_event_stop_test (ecs=ecs@entry=0x7ffc9402d9d0) at ../../fixleaks/gdb/infrun.c:6181 ... (top-gdb) fr 12 #12 0x0000555c24ad9cab in stop_all_threads () at ../../fixleaks/gdb/infrun.c:4373 (top-gdb) p event_ptid $5 = {m_pid = 25419, m_lwp = 25427, m_tid = 0} (top-gdb) p ptid $6 = {m_pid = 0, m_lwp = 0, m_tid = 0} (top-gdb) p ws $7 = {kind = TARGET_WAITKIND_THREAD_EXITED, value = {integer = 0, sig = GDB_SIGNAL_0, related_pid = {m_pid = 0, m_lwp = 0, m_tid = 0}, execd_pathname = 0x0, syscall_number = 0}} (top-gdb) The gdb.log corresponding to the above crash is: (gdb) PASS: gdb.threads/watchthreads-reorder.exp: reorder1: set debug infrun 1 continue Continuing. infrun: clear_proceed_status_thread (Thread 0x7ffff7fcfb40 (LWP 25419)) infrun: clear_proceed_status_thread (Thread 0x7ffff7310700 (LWP 25427)) infrun: clear_proceed_status_thread (Thread 0x7ffff6b0f700 (LWP 25428)) infrun: proceed (addr=0xffffffffffffffff, signal=GDB_SIGNAL_DEFAULT) infrun: proceed: resuming Thread 0x7ffff7fcfb40 (LWP 25419) infrun: resume (step=0, signal=GDB_SIGNAL_0), trap_expected=0, current thread [Thread 0x7ffff7fcfb40 (LWP 25419)] at 0x7ffff7344317 infrun: infrun_async(1) infrun: prepare_to_wait infrun: proceed: resuming Thread 0x7ffff7310700 (LWP 25427) infrun: resume (step=0, signal=GDB_SIGNAL_0), trap_expected=0, current thread [Thread 0x7ffff7310700 (LWP 25427)] at 0x5555555553d7 infrun: prepare_to_wait infrun: proceed: resuming Thread 0x7ffff6b0f700 (LWP 25428) infrun: resume (step=0, signal=GDB_SIGNAL_0), trap_expected=0, current thread [Thread 0x7ffff6b0f700 (LWP 25428)] at 0x5555555554c8 infrun: prepare_to_wait infrun: target_wait (-1.0.0, status) = infrun: -1.0.0 [process -1], infrun: status->kind = ignore infrun: TARGET_WAITKIND_IGNORE infrun: prepare_to_wait Joining the threads. [Thread 0x7ffff6b0f700 (LWP 25428) exited] infrun: target_wait (-1.0.0, status) = infrun: -1.0.0 [process -1], infrun: status->kind = ignore infrun: TARGET_WAITKIND_IGNORE infrun: prepare_to_wait infrun: target_wait (-1.0.0, status) = infrun: 25419.25419.0 [Thread 0x7ffff7fcfb40 (LWP 25419)], infrun: status->kind = stopped, signal = GDB_SIGNAL_TRAP infrun: TARGET_WAITKIND_STOPPED infrun: stop_pc = 0x555555555e50 infrun: context switch infrun: Switching context from Thread 0x7ffff6b0f700 (LWP 25428) to Thread 0x7ffff7fcfb40 (LWP 25419) infrun: BPSTAT_WHAT_STOP_NOISY infrun: stop_waiting infrun: stop_all_threads infrun: stop_all_threads, pass=0, iterations=0 infrun: Thread 0x7ffff7fcfb40 (LWP 25419) not executing infrun: Thread 0x7ffff7310700 (LWP 25427) executing, need stop [Thread 0x7ffff7310700 (LWP 25427) exited] infrun: target_wait (-1.0.0, status) = infrun: 25419.25427.0 [LWP 25427], infrun: status->kind = thread exited, status = 0 infrun: infrun_async(0) ../../fixleaks/gdb/inferior.c:287: internal-error: inferior* find_inferior_pid(int): Assertion `pid != 0' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) FAIL: gdb.threads/watchthreads-reorder.exp: reorder1: continue to breakpoint: break-at-exit (GDB internal error) Resyncing due to internal error. n infrun: infrun_async(1) This is a bug, please report it. For instructions, see: <http://www.gnu.org/software/gdb/bugs/>. infrun: infrun_async(0) ../../fixleaks/gdb/inferior.c:287: internal-error: inferior* find_inferior_pid(int): Assertion `pid != 0' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Create a core file of GDB? (y or n) y
2019-04-01Handle DW_AT_ranges when reading partial symtabsTom Tromey6-0/+234
add_partial_subprogram does not handle DW_AT_ranges, while the full symtab reader does. This can lead to discrepancies where a function is not put into a partial symtab, and so is not available to "break" and the like -- but is available if the full symtab has somehow been read. This patch fixes the bug by arranging to read DW_AT_ranges when reading partial DIEs. This is PR symtab/23331. The new test case is derived from dw2-ranges-func.exp, which is why I kept the copyright dates. gdb/ChangeLog 2019-04-01 Tom Tromey <tromey@adacore.com> PR symtab/23331: * dwarf2read.c (partial_die_info::read): Handle DW_AT_ranges. gdb/testsuite/ChangeLog 2019-04-01 Tom Tromey <tromey@adacore.com> PR symtab/23331: * gdb.dwarf2/dw2-ranges-main.c: New file. * gdb.dwarf2/dw2-ranges-psym.c: New file. * gdb.dwarf2/dw2-ranges-psym.exp: New file.
2019-04-01Destroy allocated values when exiting GDBSergio Durigan Junior4-0/+25
When the user exits GDB, we might still have some allocated values in the chain, which, in specific scenarios, can cause problems when GDB attempts to destroy them in "quit_force". For example, see the bug reported at: https://bugzilla.redhat.com/show_bug.cgi?id=1690120 And the thread starting at: https://sourceware.org/ml/gdb-patches/2019-03/msg00475.html Message-ID: <87r2azkhmq.fsf@redhat.com> In order to avoid that, and to be more aware of our allocated resources, this commit implements a new function "finalize_values" and calls it from inside "quit_force". Tested by the BuildBot. 2019-04-01 Sergio Durigan Junior <sergiodj@redhat.com> Pedro Alves <palves@redhat.com> * top.c (quit_force): Call 'finalize_values'. * value.c (finalize_values): New function. * value.h (finalize_values): Declare.
2019-04-01[GAS, Arm] CLI with architecture sensitive extensionsAndre Vieira43-53/+2878
This patch adds a new framework to add architecture sensitive extensions, like GCC does. This patch also implements all architecture extensions currently available in GCC. This framework works as follows. To enable architecture sensitive extensions for a particular architecture, that architecture must contain an ARM_ARCH_OPT2 entry in the 'arm_archs' table. All fields here are the same as previous, with the addition of a new extra field at the end to <name> it's extension table. This <name>, corresponds to a <name>_ext_table of type 'struct arm_ext_table'. This struct can be filled with three types of entries: ARM_ADD (string <ext>, arm_feature_set <enable_bits>), which means +<ext> will enable <enable_bits> ARM_REMOVE (string <ext>, arm_feature_set <disable_bits>), which means +no<ext> will disable <disable_bits> ARM_EXT (string <ext>, arm_feature_set <enable_bits>, arm_feature_set <disable_bits>), which means +<ext> will enable <enable_bits> and +no<ext> will disable <disable_bits> (this is to be used instead of adding an ARM_ADD and ARM_REMOVE for the same <ext>) This patch does not disable the use of the old extensions, even if some of them are duplicated in the new tables. This is a "in-between-step" as we may want to deprecate the old table of extensions in later patches. For now, GAS will first look for the +<ext> or +no<ext> in the new table and if no entry is found it will continue searching in the old table, following old behaviour. If only an ARM_ADD or an ARM_REMOVE is defined for <ext> and +no<ext> or +<ext> resp. is used then it also continues to search the old table for it. A couple of caveats: - This patch does not enable the use of these architecture extensions with the '.arch_extension' directive. This is future work that I will tend to later. - This patch does not enable the use of these architecture extensions with the -mcpu option. This is future work that I will tend to later. - This patch does not change the current behaviour when combining an architecture extension and using -mfpu on the command-line. The current behaviour of GAS is to stage the union of feature bits enabled by both -march and -mfpu. GCC behaves differently here, so this is something we may want to revisit on a later date.
2019-04-01Add gdb.Value.format_string ()Marco Barisione6-0/+1377
The str () function, called on a gdb.Value instance, produces a string representation similar to what can be achieved with the print command, but it doesn't allow to specify additional formatting settings, for instance disabling pretty printers. This patch introduces a new format_string () method to gdb.Value which allows specifying more formatting options, thus giving access to more features provided by the internal C function common_val_print (). gdb/ChangeLog: 2019-04-01 Marco Barisione <mbarisione@undo.io> Add gdb.Value.format_string (). * python/py-value.c (copy_py_bool_obj): (valpy_format_string): Add gdb.Value.format_string (). * NEWS: Document the addition of gdb.Value.format_string (). gdb/doc/ChangeLog: 2019-04-01 Marco Barisione <mbarisione@undo.io> * python.texi (Values From Inferior): Document gdb.Value.format_string (). gdb/testsuite/ChangeLog: 2019-04-01 Marco Barisione <mbarisione@undo.io> Test gdb.Value.format_string (). * gdb.python/py-format-string.exp: New test. * gdb.python/py-format-string.c: New file. * gdb.python/py-format-string.py: New file.
2019-04-01Add myself to gdb/MAINTAINERSMarco Barisione1-0/+1
gdb/ChangeLog: 2019-04-01 Marco Barisione <mbarisione@undo.io> * MAINTAINERS (Write After Approval): Add Marco Barisione.
2019-04-01PR24402, global buffer overflow in symtab_finalizeAlan Modra2-2/+9
PR 24402 * symtab.c (symtab_finalize): Init prev_addr to one less than first symbol address, not one more. Correct test for symbols with leading underscores.
2019-04-01Automatic date update in version.inGDB Administrator1-1/+1
2019-03-31Automatic date update in version.inGDB Administrator1-1/+1
2019-03-30RISC-V: Relax tail/j to c.j for RV64.Jim Wilson2-2/+10
2019-03-30 Andrew Waterman <andrew@sifive.com> bfd/ * elfnn-riscv.c (_bfd_riscv_relax_call): Only check ARCH_SIZE for rd == X_RA case.
2019-03-30Introduce new convenience variables $_gdb_major and $_gdb_minorEli Zaretskii7-13/+64
gdb/ChangeLog: 2019-03-30 Eli Zaretskii <eliz@gnu.org> * NEWS: Announce $_gdb_major and $_gdb_minor. * top.c (init_gdb_version_vars): New function. (gdb_init): Call init_gdb_version_vars. gdb/testsuite/ChangeLog: 2019-03-30 Simon Marchi <simark@simark.ca> * gdb.base/default.exp: Add values for $_gdb_major and $_gdb_minor. gdb/doc/ChangeLog: 2019-03-30 Eli Zaretskii <eliz@gnu.org> * gdb.texinfo (Convenience Vars): Document $_gdb_major and $_gdb_minor.
2019-03-30Automatic date update in version.inGDB Administrator1-1/+1
2019-03-29Add usage for commands in printcmd.cTom Tromey4-24/+47
I noticed that the help for "info addr" did not include a "usage" line; and when adding it I went through and fixed a few minor issues in printcmd.c: * Added usage lines to all commands * Updated the help text for some commands * Changed some help to use upper case metasyntactic variables * Removed some dead code Regression tested on x86-64 Fedora 29. gdb/ChangeLog 2019-03-29 Tom Tromey <tromey@adacore.com> * printcmd.c (_initialize_printcmd): Add usage lines. Update some help text. Remove dead code. gdb/testsuite/ChangeLog 2019-03-29 Tom Tromey <tromey@adacore.com> * gdb.base/help.exp: Tighten apropos regexp.
2019-03-29Allow really large fortran array bounds: fortran type/value printersKeith Seitz7-13/+110
This is the fortran part of the patch, including tests, which are essentially unchanged from Siddhesh's original 2012 submission: https://sourceware.org/ml/gdb-patches/2012-08/msg00562.html There is, however, one large departure. In the above thread, Jan pointed out problems with GCC debuginfo for -m32 builds (filed usptream as gcc/54934). After investigating the issue, I am dropping the hand-tweaked assembler source file to workaround this case. While I would normally do something to accommodate this, in this case, given the ubiquity of 64-bit systems today (where the tests pass) and the apparent lack of urgency on the compiler side (by users), I don't think the additional complexity and maintenance costs are worth it. It will be very routinely tested on 64-bit systems. [For example, at Red Hat, we always test -m64 and -m32 configurations for all GDB releases.] gdb/ChangeLog: From Siddhesh Poyarekar: * f-lang.h (f77_get_upperbound): Return LONGEST. (f77_get_lowerbound): Likewise. * f-typeprint.c (f_type_print_varspec_suffix): Expand UPPER_BOUND and LOWER_BOUND to LONGEST. Use plongest to format print them. (f_type_print_base): Expand UPPER_BOUND to LONGEST. Use plongest to format print it. * f-valprint.c (f77_get_lowerbound): Return LONGEST. (f77_get_upperbound): Likewise. (f77_get_dynamic_length_of_aggregate): Expand UPPER_BOUND, LOWER_BOUND to LONGEST. (f77_create_arrayprint_offset_tbl): Likewise. gdb/testsuite/ChangeLog: * gdb.fortran/array-bounds.exp: New file. * gdb.fortran/array-bounds.f90: New file.
2019-03-29Allow really large fortran array bounds: TYPE_LENGTH to ULONGESTKeith Seitz13-27/+54
This series is revisit of Siddhesh Poyarekar's patch from back in 2012. The last status on the patch is in the following gdb-patches thread: https://sourceware.org/ml/gdb-patches/2012-08/msg00562.html It appears that Tom approved the patch, but Jan had some issues with a compiler error that made the test fail on -m32 test runs. He wrote up a hand-tweaked .S file to deal with it. Siddesh said he would update tests. Then nothing. Siddesh and Jan have both moved on since. The patch originally required a large precursor patch to work. I have whittled this down to/rewritten the bare minimum, and this first patch is the result, changing the type of TYPE_LENGTH to ULONGEST from unsigned int. The majority of the changes involve changing printf format strings to use %s and pulongest instead of %d. gdb/ChangeLog: * ada-lang.c (ada_template_to_fixed_record_type_1): Use %s/pulongest for TYPE_LENGTH instead of %d in format strings. * ada-typerint.c (ada_print_type): Likewise. * amd64-windows-tdep.c (amd64_windows_store_arg_in_reg): Likewise. * compile/compile-c-support.c (generate_register_struct): Likewise. * gdbtypes.c (recursive_dump_type): Likewise. * gdbtypes.h (struct type) <length>: Change type to ULONGEST. * m2-typeprint.c (m2_array): Use %s/pulongest for TYPE_LENGTH instead of %d in format strings. * riscv-tdep.c (riscv_type_alignment): Cast second argument to std::min to ULONGEST. * symmisc.c (print_symbol): Use %s/pulongest for TYPE_LENGTH instead of %d in format strings. * tracepoint.c (info_scope_command): Likewise. * typeprint.c (print_offset_data::update) (print_offset_data::finish): Likewise. * xtensa-tdep.c (xtensa_store_return_value) (xtensa_push_dummy_call): Likewise.
2019-03-29bfd: xtensa: fix shrink_dynamic_reloc_sections for export-dynamicMax Filippov5-1/+29
shrink_dynamic_reloc_sections must remove PLT entry that was created for an undefined weak symbol in the presence of --export-dynamic option when relaxation coalesces literals pointing to that symbol. This fixes the following assertion: ld: BFD (GNU Binutils) 2.31.1 internal error, aborting at elf32-xtensa.c:3292 in elf_xtensa_finish_dynamic_sections 2019-03-29 Max Filippov <jcmvbkbc@gmail.com> bfd/ * elf32-xtensa.c (shrink_dynamic_reloc_sections): Add info->export_dynamic to the conditional. ld/ * testsuite/ld-xtensa/relax-undef-weak-pie-export-dynamic.d: New test definition. * testsuite/ld-xtensa/xtensa.exp (relax-undef-weak-pie-export-dynamic): Add new test.
2019-03-29Automatic date update in version.inGDB Administrator1-1/+1
2019-03-28sim: fix all sim buildsAndrew Burgess3-0/+8
This commit: commit ef9866970ce6683d40465fb7c3168f87a1dcd1b7 Date: Thu Mar 28 06:40:30 2019 +0900 sim/common: convert sim-arange to use sim-inline broke many simulator targets. I fixed aarch64 in a previous commit without realising how many other target were also broken. This commit adds the missing includes (sim-assert.h and libiberty.h), which seem to be needed by many simulator targets, in a central location, this should fix most builds. sim/common/ChangeLog: * sim-base.h: Add 'sim-assert.h' include. * sim-basics.h: Add 'libiberty.h' include.
2019-03-28Fix format specification in display_selector() (again)Jon Turney2-2/+9
DWORD type is not a long on 64-bit Cygwin, because that it is LP64. Explicitly cast DWORD values to unsigned long and use an appropriate format. gdb/ChangeLog: 2019-03-28 Jon Turney <jon.turney@dronecode.org.uk> * windows-nat.c (display_selector): Fixed format specifications for 64-bit Cygwin.
2019-03-28Fix gdb.multi/multi-term-settings.exp blocking under high load/slow gdbPhilippe Waroquiers2-1/+5
Similarly to multi-arch-exec.exp, increase the alarm timer to avoid test blocking under high load or with a slow gdb. 2019-03-28 Philippe Waroquiers <philippe.waroquiers@skynet.be> * gdb.multi/multi-term-settings.c (main): Increase alarm timer.
2019-03-28Fix gdb.multi/multi-arch-exec.exp blocking under high load/slow gdbPhilippe Waroquiers2-1/+5
When running multi-arch-exec.exp under valgrind, the test succeeds when the machine is not loaded, but blocks when the machine is highly loaded (e.g. when running the testsuite with valgrind with -j X where X is one more than the nr of available cores). The problem is that the hello program dies too early due to the alarm (30). So, increase the alarm timer. Note that this does not make the test take longer (it takes about 3.5 seconds on my system). As I understand, the alarm is just there to avoid hello staying there forever in case of another problem. 2019-03-28 Philippe Waroquiers <philippe.waroquiers@skynet.be> * gdb.multi/hello.c (main): Increase alarm timer.
2019-03-28Fix GDB being suspended SIGTTOU when running gdb.multi/multi-arch-exec.expPhilippe Waroquiers2-0/+8
When running under valgrind, multi-arch-exec.exp blocks forever. Some (painful) investigation shows this is due to valgrind slowing down GDB, and GDB has to output some messages at a different time, when GDB does not have the terminal for output. To reproduce the problem, you need to slow down GDB. It can be reproduced by: cd gdb/testsuite/outputs/gdb.multi/multi-arch-exec/ ../../../../gdb -ex 'set debug lin-lwp 1' -ex 'break all_started' -ex 'run' ./2-multi-arch-exec The above stops at a breakpoint. Do continue. GDB is then suspended because of SIGTTOU. The stacktrace that leads to the hanging GDB is: (top-gdb) bt at ../../binutils-gdb/gdb/exceptions.c:130 .... Alternatively, the same happens when doing strace -o s.out ../../../../gdb -ex 'break all_started' -ex 'run' ./2-multi-arch-exec And of course, valgrind is also sufficiently slowing down GDB to reproduce this :). Fix this by calling target_terminal::ours_for_output (); at the beginning of follow_exec. Note that all this terminal handling is not very clear to me: * Some code takes the terminal, and then takes care to give it back to the inferior if the terminal was belonging to the inferior. (e.g. annotate_breakpoints_invalid). * some code takes the terminal, but does not give it back (e.g. update_inserted_breakpoint_locations). * some code takes it, and unconditionally gives it back (e.g. handle_jit_event) * here and there, we also find gdb::optional<target_terminal::scoped_restore_terminal_state> term_state; before a (sometimes optional) call to ours_for_output. And such calls to ours_for_output is sometimes protected by: if (target_supports_terminal_ours ()) (e.g. exceptions.c: print_flush). but most of the code calls it without checking if the target supports it. * some code is outputting some errors, but only takes the terminal after. E.g. infcmd.c: prepare_one_step gdb/ChangeLog 2019-03-28 Philippe Waroquiers <philippe.waroquiers@skynet.be> * infrun.c (follow_exec): Call target_terminal::ours_for_output.
2019-03-28Fix stepping past unwritable kernel helper on nios2-linux-gnu.Sandra Loosemore6-17/+71
This patch fixes a problem on nios2-linux-gnu with stepping past the kernel helper __kuser_cmpxchg, which was exposed by the testcase gdb.threads/watchpoint-fork.exp. The kernel maps this function into user space on an unwritable page. In this testcase, the cmpxchg helper is invoked indirectly from the setbuf call in the test program. Since this target lacks hardware breakpoint/watchpoint support, GDB tries to single-step through the program by setting software breakpoints, and was just giving an error when it reached the function on the unwritable page. The solution here is to always step over the call instead of stepping into it; cmpxchg is supposed to be an atomic operation so this behavior seems reasonable. The hook in nios2_get_next_pc is somewhat generic, but at present cmpxchg is the only helper provided by the Linux kernel that is invoked by an ordinary function call. (Signal return trampolines also go through the unwritable page but not by a function call.) Fixing this issue also revealed that the testcase needs a much larger timeout factor when software single-stepping is used. That has also been fixed in this patch. gdb/ChangeLog 2019-03-28 Sandra Loosemore <sandra@codesourcery.com> * nios2-tdep.h (struct gdbarch_tdep): Add is_kernel_helper. * nios2-tdep.c (nios2_get_next_pc): Skip over kernel helpers. * nios2-linux-tdep.c (nios2_linux_is_kernel_helper): New. (nios2_linux_init_abi): Install it. gdb/testsuite/ChangeLog 2019-03-28 Sandra Loosemore <sandra@codesourcery.com> * gdb.threads/watchpoint-fork.exp (test): Use large timeout factor when no hardware watchpoint support.
2019-03-28Testsuite: set sysroot when using gdbserverAlan Hayward2-0/+8
When testing using native-gdbserver and native-extended-gdbserver, the sysroot is not set. This results in a warning from GDB and files are sent via the remote protocol, which can be slow. On Ubuntu 18.04 (unlike most distros) the debug versions of the standard libraries are included by default in /usr/lib/debug/. These file reads are causing a complete native-gdbserver run on the AArch64 buildbot slave to timeout after 2.5 hours. This is also causing the builds to back up on the slave. The solution is to ensure the sysroot is set to / for all local boards. This drastically reduces the time of a test. For example, gdb.base/sigall.exp drops from 23 seconds to 4 seconds. A full native-gdbserver run on the AArch64 slave now takes 8 minutes. gdb/testsuite/ChangeLog: * boards/local-board.exp: set sysroot to /.
2019-03-28sim: fix aarch64 sim buildAndrew Burgess3-0/+7
This commit: commit ef9866970ce6683d40465fb7c3168f87a1dcd1b7 Date: Thu Mar 28 06:40:30 2019 +0900 sim/common: convert sim-arange to use sim-inline Broke the simulator build for aarch64 - some required macros are no longer included where needed, fixed in this commit. sim/aarch64/ChangeLog: * cpustate.c: Add 'libiberty.h' include. * interp.c: Add 'sim-assert.h' include.
2019-03-28AArch64: View the pseudo V registers as vectorsAlan Hayward2-5/+52
When SVE is enabled, the V registers become pseudo registers based on the Z registers. They should look the same as they do when there is no SVE. The existing code viewed them as single value registers. Switch this to a vector. gdb/ChangeLog: * aarch64-tdep.c (aarch64_vnv_type): Use vector types.
2019-03-28AArch64: 128bit views for SVE registersAlan Hayward2-0/+18
SVE can view Z registers as 128bit values using .q prefix. Add this view to the SVE feature. gdb/ChangeLog: * features/aarch64-sve.c (create_feature_aarch64_sve): Add q view.
2019-03-28gdbserver: Ensure AT_HWCAP2 is definedAlan Hayward2-0/+8
When using older compilers, AT_HWCAP2 may not be be defined. It is defined in elf/common.h, however including this in gdbserver/linux-low.c causes conflicts. Manually add the define if it does not exist. gdb/gdbserver/ChangeLog: * linux-low.c (AT_HWCAP2): Add define if not already included.