aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.guile
AgeCommit message (Collapse)AuthorFilesLines
2023-01-13Rename to allow_cplus_tests and allow_stl_testsTom Tromey2-2/+2
This changes skip_cplus_tests to invert the sense, and renames it to allow_cplus_tests. This one also converts skip_stl_tests to allow_stl_tests, as that was convenient to do at the same time.
2023-01-13Use require !skip_cplus_testsTom Tromey1-1/+1
This changes some tests to use "require !skip_cplus_tests".
2023-01-01Update copyright year range in header of all files managed by GDBJoel Brobecker59-59/+59
This commit is the result of running the gdb/copyright.py script, which automated the update of the copyright year range for all source files managed by the GDB project to be updated to include year 2023.
2022-12-09[gdb/testsuite] Fix gdb.guile/scm-symtab.exp for ppc64leTom de Vries1-1/+1
On powerpc64le-linux, I run into: ... (gdb) PASS: gdb.guile/scm-symtab.exp: step out of func2 guile (print (> (sal-line (find-pc-line (frame-pc (selected-frame)))) line))^M = #f^M (gdb) FAIL: gdb.guile/scm-symtab.exp: test find-pc-line with resume address ... The problem is as follows: the instructions for the call to func2 are: ... 1000070c: 39 00 00 48 bl 10000744 <func1> 10000710: 00 00 00 60 nop 10000714: 59 00 00 48 bl 1000076c <func2> 10000718: 00 00 00 60 nop 1000071c: 00 00 20 39 li r9,0 ... and the corresponding line number info is: ... scm-symtab.c: File name Line number Starting address View Stmt scm-symtab.c 42 0x1000070c x scm-symtab.c 43 0x10000714 x scm-symtab.c 44 0x1000071c x ... The test-case looks at the line numbers for two insns: - the insn of the call to func2 (0x10000714), and - the insn after that (0x10000718), and expects the line number of the latter to be greater than the line number of the former. However, both insns have the same line number: 43. Fix this by replacing ">" with ">=". Tested on x86_64-linux and powerpc64le-linux.
2022-11-28gdb/testsuite: remove use of then keyword from gdb.*/*.exp scriptsAndrew Burgess1-1/+1
The canonical form of 'if' in modern TCL is 'if {} {}'. But there's still a bunch of places in the testsuite where we make use of the 'then' keyword, and sometimes these get copies into new tests, which just spreads poor practice. This commit removes all use of the 'then' keyword from the remaining gdb.*/*.exp scripts. Previous commits have done the bulk of this removal, this commit just handles the remaining directories that each contain a low number of instances. There should be no changes in what is tested after this commit.
2022-10-29gdb/testsuite: Wrap `param_integer_error' in gdb.guile/scm-parameter.expMaciej W. Rozycki1-1/+3
Wrap an overlong line in the definition of `param_integer_error' in gdb.guile/scm-parameter.exp. No functional change.
2022-10-26gdb/testsuite: fix gdb.guile/scm-parameter.exp "wrong type argument" test ↵Simon Marchi1-4/+4
pattern for Guile >= 2.2 Since commit 90319cefe3 ("GDB/Guile: Don't assert that an integer value is boolean"), I see: FAIL: gdb.guile/scm-parameter.exp: kind=PARAM_ZINTEGER: test-PARAM_ZINTEGER-param: guile (set-parameter-value! test-PARAM_ZINTEGER-param #:unlimited) FAIL: gdb.guile/scm-parameter.exp: kind=PARAM_ZUINTEGER: test-PARAM_ZUINTEGER-param: guile (set-parameter-value! test-PARAM_ZUINTEGER-param #:unlimited) This comes from the fact that GDB outputs this: ERROR: In procedure set-parameter-value!: In procedure gdbscm_set_parameter_value_x: Wrong type argument in position 2 (expecting integer): #:unlimited Error while executing Scheme code. while the test expects an additional "ERROR:" on the second line, something like this: ERROR: In procedure set-parameter-value!: ERROR: In procedure gdbscm_set_parameter_value_x: Wrong type argument in position 2 (expecting integer): #:unlimited Error while executing Scheme code. Guile 2.0 outputs the `ERROR:` on the second line, while later versions do not. Change the pattern to accept both outputs. This is similar to commit 6bbe1a929c6 ("[gdb/testsuite] Fix gdb.guile/scm-breakpoint.exp with guile 3.0"). Change-Id: I9dc45e7492a4f08340cad974610242ed689de959
2022-10-21GDB/Guile: Don't assert that an integer value is booleanMaciej W. Rozycki1-0/+176
Do not assert that a value intended for an integer parameter, of either the PARAM_UINTEGER or the PARAM_ZUINTEGER_UNLIMITED type, is boolean, causing error messages such as: ERROR: In procedure make-parameter: ERROR: In procedure gdbscm_make_parameter: Wrong type argument in position 15 (expecting integer or #:unlimited): 3 Error while executing Scheme code. when initialization with a number is attempted. Instead assert that it is integer. Keep matching `#:unlimited' keyword as an alternative. Add suitable test cases. Approved-By: Simon Marchi <simon.marchi@polymtl.ca>
2022-06-24gdb/testsuite: remove unneeded calls to get_compiler_infoAndrew Burgess1-4/+0
It is not necessary to call get_compiler_info before calling test_compiler_info, and, after recent commits that removed setting up the gcc_compiled, true, and false globals from get_compiler_info, there is now no longer any need for any test script to call get_compiler_info directly. As a result every call to get_compiler_info outside of lib/gdb.exp is redundant, and this commit removes them all. There should be no change in what is tested after this commit.
2022-01-01Automatic Copyright Year update after running gdb/copyright.pyJoel Brobecker59-59/+59
This commit brings all the changes made by running gdb/copyright.py as per GDB's Start of New Year Procedure. For the avoidance of doubt, all changes in this commits were performed by the script.
2021-10-07[gdb/testsuite] Fix gdb.guile/scm-type.exp with gcc 4.8Tom de Vries1-1/+1
With gcc 7.5.0, I get: ... (gdb) guile (print (type-range (field-type (type-field (value-type \ (value-dereference f)) "items"))))^M = (0 0)^M (gdb) PASS: gdb.guile/scm-type.exp: lang_cpp: test_range: \ on flexible array member: $cmd ... but with gcc 4.8.5, I get instead: ... (gdb) guile (print (type-range (field-type (type-field (value-type \ (value-dereference f)) "items"))))^M = (0 -1)^M (gdb) FAIL: gdb.guile/scm-type.exp: lang_cpp: test_range: \ on flexible array member: $cmd ... There's a difference in debug info. With gcc 4.8.5, we have: ... <2><224>: Abbrev Number: 15 (DW_TAG_member) <225> DW_AT_name : items <22b> DW_AT_type : <0x231> <1><231>: Abbrev Number: 4 (DW_TAG_array_type) <232> DW_AT_type : <0x105> <2><23a>: Abbrev Number: 16 (DW_TAG_subrange_type) <23b> DW_AT_type : <0x11a> <23f> DW_AT_upper_bound : 0xffffffffffffffff ... and with gcc 7.5.0, we have instead: ... <2><89f>: Abbrev Number: 12 (DW_TAG_member) <8a0> DW_AT_name : items <8a6> DW_AT_type : <0x8ac> <1><8ac>: Abbrev Number: 17 (DW_TAG_array_type) <8ad> DW_AT_type : <0x29d> <2><8b5>: Abbrev Number: 41 (DW_TAG_subrange_type) <2><8b6>: Abbrev Number: 0 ... As mentioned in commit 858c8f2c1b9 "gdb/testsuite: adjust gdb.python/flexible-array-member.exp expected pattern": ... Ideally, GDB would present a consistent and documented value for an array member declared with size 0, regardless of how the debug info looks like. ... As in gdb.python/flexible-array-member.exp, change the test to accept the two values. Tested on x86_64-linux.
2021-09-30gdb/testsuite: make runto_main not pass no-message to runtoSimon Marchi6-7/+0
As follow-up to this discussion: https://sourceware.org/pipermail/gdb-patches/2020-August/171385.html ... make runto_main not pass no-message to runto. This means that if we fail to run to main, for some reason, we'll emit a FAIL. This is the behavior we want the majority of (if not all) the time. Without this, we rely on tests logging a failure if runto_main fails, otherwise. They do so in a very inconsisteny mannet, sometimes using "fail", "unsupported" or "untested". The messages also vary widly. This patch removes all these messages as well. Also, remove a few "fail" where we call runto (and not runto_main). by default (without an explicit no-message argument), runto prints a failure already. In two places, gdb.multi/multi-re-run.exp and gdb.python/py-pp-registration.exp, remove "message" passed to runto. This removes a few PASSes that we don't care about (but FAILs will still be printed if we fail to run to where we want to). This aligns their behavior with the rest of the testsuite. Change-Id: Ib763c98c5f4fb6898886b635210d7c34bd4b9023
2021-08-09guile: fix smob exportsGeorge Barrett1-0/+28
Before Guile v2.1 [1], calls to `scm_make_smob_type' implicitly added the created class to the exports list of (oop goops); v2.1+ does not implicitly create bindings in any modules. This means that the GDB manual subsection documenting exported types is not quite right when GDB is linked against Guile <v2.1 (types are exported from (oop goops)) instead of (gdb)) and incorrect when linked against Guile v2.1+ (types are not bound to any variables at all!). There is a range of cases in which it's necessary or convenient to be able to refer to a GDB smob type, for instance: - Pattern matching based on the type of a value. - Defining GOOPS methods handling values from GDB (GOOPS methods typically use dynamic dispatch based on the types of the arguments). - Type-checking assertions when applying some defensive programming on an interface. - Generally any other situation one might encounter in a dynamically typed language that might need some introspection. If you're more familiar with Python, it would be quite similar to being unable to refer to the classes exported from the GDB module (which is to say: not crippling for the most part, but makes certain tasks more difficult than necessary). This commit makes a small change to GDB's smob registration machinery to make sure registered smobs get exported from the current module. This will likely cause warnings to the user about conflicting exports if they load both (gdb) and (oop goops) from a GDB linked against Guile v2.0, but it shouldn't impact functionality (and seemed preferable to trying to un-export bindings from (oop goops) if v2.0 was detected). [1]: This changed with Guile commit 28d0871b553a3959a6c59e2e4caec1c1509f8595 gdb/ChangeLog: 2021-06-07 George Barrett <bob@bob131.so> * guile/scm-gsmob.c (gdbscm_make_smob_type): Export registered smob type from the current module. gdb/testsuite/ChangeLog: 2021-06-07 George Barrett <bob@bob131.so> * gdb.guile/scm-gsmob.exp (test exports): Add tests to make sure the smob types currently listed in the GDB manual get exported from the (gdb) module. Change-Id: I7dcd791276b48dfc9edb64fc71170bbb42a6f6e7
2021-07-29guile: fix make-value with pointer typeGeorge Barrett1-0/+40
Calling the `make-value' procedure with an integer value and a pointer type for the #:type argument triggers a failed assertion in `get_unsigned_type_max', as that function doesn't consider pointers to be an unsigned type. This commit fixes the issue by adding a separate code path for pointers. As previously suggested, range checking is done using a new helper function in gdbtypes. gdb/ChangeLog: 2021-07-30 George Barrett <bob@bob131.so> * gdbtypes.h (get_pointer_type_max): Add declaration. * gdbtypes.c (get_pointer_type_max): Add definition for new helper function. * guile/scm-math.c (vlscm_convert_typed_number): Add code path for handling conversions to pointer types without failing an assert. gdb/testsuite/ChangeLog: 2021-07-30 George Barrett <bob@bob131.so> * gdb.guile/scm-math.exp (test_value_numeric_ops): Add test for creating pointers with make-value. (test_make_pointer_value, test_pointer_numeric_range): Add test procedures containing checks for integer-to-pointer validation. Change-Id: I9994dd1c848840a3d995f745e6d72867732049f0
2021-07-28Guile: temporary breakpointsGeorge Barrett1-0/+33
Adds API to the Guile bindings for creating temporary breakpoints and querying whether an existing breakpoint object is temporary. This is effectively a transliteration of the Python implementation. It's worth noting that the added `is_temporary' flag is ignored in the watchpoint registration path. This replicates the behaviour of the Python implementation, but might be a bit surprising for users. gdb/ChangeLog: 2021-06-09 George Barrett <bob@bob131.so> * guile/scm-breakpoint.c (gdbscm_breakpoint_object::spec): Add is_temporary field. (temporary_keyword): Add keyword object for make-breakpoint argument parsing. (gdbscm_make_breakpoint): Accept #:temporary keyword argument and store the value in the allocated object's spec.is_temporary. (gdbscm_register_breakpoint_x): Pass the breakpoint's spec.is_temporary value to create_breakpoint. (gdbscm_breakpoint_temporary): Add breakpoint-temporary? procedure implementation. (breakpoint_functions::make-breakpoint): Update documentation string and fix a typo. (breakpoint_functions::breakpoint-temporary?): Add breakpoint-temporary? procedure. (gdbscm_initialize_breakpoints): Initialise temporary_keyword variable. NEWS (Guile API): Mention new temporary breakpoints API. gdb/doc/ChangeLog: 2021-06-09 George Barrett <bob@bob131.so> * guile.texi (Breakpoints In Guile): Update make-breakpoint documentation to reflect new #:temporary argument. Add documentation for new breakpoint-temporary? procedure. gdb/testsuite/ChangeLog: 2021-06-09 George Barrett <bob@bob131.so> * gdb.guile/scm-breakpoint.exp: Add additional tests for temporary breakpoints. Change-Id: I2de332ee7c256f5591d7141ab3ad50d31b871d17
2021-07-23gdb/testsuite: test get/set value of unregistered Guile parameterSimon Marchi1-0/+8
When creating a parameter in Guile, you have to create it using make-parameter and then register it with GDB with register-parameter!. In between, it's still possible (though not documented) to set the parameter's value. I broke this use case by mistake while writing this series, so thought it would be good to have a test for it. I suppose that people could use this "feature" to give their parameter an initial value, even though make-parameter has an initial-value parameter for this. Nevertheless, changing this behavior could break some scripts, which is why I think it's important for it to be tested. Change-Id: I5b2103e3cec0cfdcccf7ffb00eb05fed8626e66d
2021-07-08[gdb/testsuite] Fix gdb.guile/scm-breakpoint.exp with guile 3.0Tom de Vries1-3/+3
When running test-case gdb.guile/scm-breakpoint.exp on openSUSE Tumbleweed with guile 3.0, I run into: ... (gdb) guile (define cp (make-breakpoint "syscall" #:type BP_CATCHPOINT))^M ERROR: In procedure make-breakpoint:^M In procedure gdbscm_make_breakpoint: unsupported breakpoint type in \ position 3: "BP_CATCHPOINT"^M Error while executing Scheme code.^M (gdb) FAIL: gdb.guile/scm-breakpoint.exp: test_catchpoints: \ create a catchpoint via the api ... The same test passes on openSUSE Leap 15.2 with guile 2.0, where the second line of the error message starts with the same prefix as the first: ... ERROR: In procedure gdbscm_make_breakpoint: unsupported breakpoint type in \ position 3: "BP_CATCHPOINT"^M ... I observe the same difference in many other tests, f.i.: ... (gdb) gu (print (value-add i '()))^M ERROR: In procedure value-add:^M In procedure gdbscm_value_add: Wrong type argument in position 2: ()^M Error while executing Scheme code.^M (gdb) PASS: gdb.guile/scm-math.exp: catch error in guile type conversion ... but it doesn't cause FAILs anywhere else. Fix this by updating the regexp to make the "ERROR: " prefix optional. Tested on x86_64-linux, with both guile 2.0 and 3.0. gdb/testsuite/ChangeLog: 2021-07-07 Tom de Vries <tdevries@suse.de> * gdb.guile/scm-breakpoint.exp: Make additional "ERROR: " prefix in exception printing optional.
2021-06-25gdb/guile: allow for catchpoint type breakpoints in guileAndrew Burgess1-0/+37
This commit adds initial support for catchpoints to the guile breakpoint API. This commit adds a BP_CATCHPOINT constant which corresponds to GDB's internal bp_catchpoint. The new constant is documented in the manual. The user can't create breakpoints with type BP_CATCHPOINT after this commit, but breakpoints that already exist, obtained with the (breakpoints) function, can now have this type. gdb/ChangeLog: * guile/scm-breakpoint.c (bpscm_type_to_string): Handle bp_catchpoint. (bpscm_want_scm_wrapper_p): Likewise. (gdbscm_make_breakpoint): Likewise. (breakpoint_integer_constants): Likewise. gdb/doc/ChangeLog: * guile.texinfo (Breakpoints In Guile): Add BP_CATCHPOINT description. gdb/testsuite/ChangeLog: * gdb.guile/scm-breakpoint.exp (test_catchpoints): New proc.
2021-06-25gdb/guile: improve the errors when creating breakpointsAndrew Burgess1-0/+7
When creating a breakpoint using the guile API, if an invalid breakpoint type number was used then the error would report the wrong argument position, like this: (gdb) guile (define wp2 (make-breakpoint "result" #:wp-class WP_WRITE #:type 999)) ERROR: In procedure make-breakpoint: ERROR: In procedure gdbscm_make_breakpoint: Out of range: invalid breakpoint type in position 3: 999 Error while executing Scheme code. (gdb) The 'position 3' here is actually pointing at WP_WRITE, when it should say 'position 5' and point to the 999. This commit fixes this. However, you also get errors like this: (gdb) guile (define wp2 (make-breakpoint "result" #:wp-class WP_WRITE #:type BP_NONE)) ERROR: In procedure make-breakpoint: ERROR: In procedure gdbscm_make_breakpoint: Out of range: invalid breakpoint type in position 3: 0 Error while executing Scheme code. The BP_NONE is a valid breakpoint type, it's just not valid for creating breakpoints through the 'make-breakpoint' API. The use of '0' in the error message (which is the value of BP_NONE) is not great. This commit changes the error in this case to: (gdb) guile (define wp2 (make-breakpoint "result" #:wp-class WP_WRITE #:type BP_NONE)) ERROR: In procedure make-breakpoint: ERROR: In procedure gdbscm_make_breakpoint: unsupported breakpoint type in position 5: "BP_NONE" Error while executing Scheme code. Which seems better; we now use the name of the type, and report that this type is unsupported. gdb/ChangeLog: * guile/scm-breakpoint.c (gdbscm_make_breakpoint): Split the error for invalid breakpoint numbers, and unsupported breakpoint numbers. gdb/testsuite/ChangeLog: * gdb.guile/scm-breakpoint.exp (test_watchpoints): Add new tests.
2021-05-19gdb/testsuite: resolve duplicate test names in gdb.guile/*.expAndrew Burgess1-3/+4
This commit: commit ecf25064e87a3d2d59871b3ea7126fa0dee0001d Date: Thu May 13 15:42:20 2021 +0100 gdb: fix pretty printing max depth behaviour Introduced a couple of duplicate tests, this commit resolves them by providing unique test names. gdb/testsuite/ChangeLog: * gdb.guile/scm-pretty-print.exp: Add test names to resolve duplicate test names.
2021-05-14gdb: fix pretty printing max depth behaviourKent Cheung1-0/+4
The 'print max-depth' feature incorrectly causes GDB to skip printing the string representation of pretty printed variables if the variable is stored at a nested depth corresponding to the set max-depth value. This change ensures that it is always printed before checking whether the maximum print depth has been reached. Regression tested with GCC 7.3.0 on x86_64, ppc64le, aarch64. gdb/ChangeLog: * cp-valprint.c (cp_print_value): Replaced duplicate code. * guile/scm-pretty-print.c (ppscm_print_children): Check max_depth just before printing child values. (gdbscm_apply_val_pretty_printer): Don't check max_depth before printing string representation. * python/py-prettyprint.c (print_children): Check max_depth just before printing child values. (gdbpy_apply_val_pretty_printer): Don't check max_depth before printing string representation. gdb/testsuite/ChangeLog: * gdb.python/py-format-string.c: Added a variable to test. * gdb.python/py-format-string.exp: Check string representation is printed at appropriate max_depth settings. * gdb.python/py-nested-maps.exp: Likewise. * gdb.guile/scm-pretty-print.exp: Add additional tests.
2021-05-13gdb/testsuite: resolve remaining duplicate tests in gdb.guile/Andrew Burgess1-76/+81
The remaining duplicates are resolved by adding a with_test_prefix and reindenting a proc. I also added a couple of additional test names to some of the tests. gdb/testsuite/ChangeLog: * gdb.guile/scm-pretty-print.exp (run_lang_tests): Give some tests unique names, also wrap proc body in with_test_prefix.
2021-05-13gdb/testsuite: resolve duplicate test names in gdb.guile/*.expAndrew Burgess5-45/+53
This commit resolves almost all of the remaining duplicate test names in gdb.guile/*.exp. This is done by either: - Making use of with_test_prefix, - Giving tests a unique name, - Extending the existing name to make it unique, - Not printing PASS lines for simple setup commands (e.g. loading support modules, or adjusting GDB internal settings not relating to guile). gdb/testsuite/ChangeLog: * gdb.guile/scm-frame-args.exp: Add with_test_prefix to resolve duplicate test names. * gdb.guile/scm-parameter.exp: Provide test names to avoid duplicate names based on the command being run. * gdb.guile/scm-symbol.exp: Extend test name to make it unique. * gdb.guile/scm-type.exp (restart_gdb): Don't print PASS line when loading a support module. (test_equality): Update test name to match the actual test, making the name unique in the process. * gdb.guile/scm-value.exp (test_value_in_inferior): Add test names to resolve duplicate tests. (test_inferior_function_call): Likewise. (test_subscript_regression): Likewise.
2021-05-12Guile: add value-const-valueGeorge Barrett1-0/+3
The Guile API doesn't currently have an equivalent to the Python API's gdb.Value.const_value(). This commit adds a procedure with equivalent semantics to the Guile API. gdb/ChangeLog: * NEWS (Guile API): Note the addition of the new procedure. * guile/scm-value.c (gdbscm_value_const_value): Add implementation of value-const-value procedure. (value_functions): Add value-const-value procedure. gdb/doc/ChangeLog: * guile.texi (Values From Inferior In Guile): Add documentation for value-const-value. gdb/testsuite/ChangeLog: * gdb.guile/scm-value.exp (test_value_in_inferior): Add test for value-const-value.
2021-05-12Guile: add value-{rvalue-,}reference-valueGeorge Barrett1-0/+10
The Guile API doesn't currently have an equivalent to the Python API's Value.reference_value() or Value.rvalue_reference_value(). This commit adds a procedure with equivalent semantics to the Guile API. gdb/ChangeLog: * NEWS (Guile API): Note the addition of new procedures. * guile/scm-value.c (gdbscm_reference_value): Add helper function for reference value creation. (gdbscm_value_reference_value): Add implementation of value-reference-value procedure. (gdbscm_value_rvalue_reference_value): Add implementation of value-rvalue-reference-value procedure. (value_functions): Add value-reference-value procedure. Add value-rvalue-reference-value procedure. gdb/doc/ChangeLog: * guile.texi (Values From Inferior In Guile): Add documentation for value-reference-value. Add documentation for value-rvalue-reference-value. gdb/testsuite/ChangeLog: * gdb.guile/scm-value.exp (test_value_in_inferior): Add test for value-reference-value. Add test for value-rvalue-reference-value.
2021-05-10gdb/testsuite: don't use source tree as temporary HOME directoryAndrew Burgess1-1/+12
In this commit: commit 1845e254645efbc02248345ccdb557d265dd8ae1 Date: Wed May 5 16:50:17 2021 +0100 gdb/guile: perform tilde expansion when sourcing guile scripts A test was added that tries to source a guile script from the users HOME directory. In order to achieve this the test (temporarily) modifies $HOME to point into the binutils-gdb source tree. The problem with this is that sourcing a guile script can cause the guile script to be byte compiled and written into a .cache/ directory, which is stored .... in the $HOME directory. The result was that the test added in the above commit would cause a .cache/ directory to be added into the binutils-gdb source tree. In this commit the test is updated to create a new directory in the build tree, the file we want to source is copied over, and $HOME is set to point at the location in the build tree. Now when the test is run the .cache/ directory is created in the build tree, leaving the source tree untouched. gdb/testsuite/ChangeLog: * gdb.guile/guile.exp: Don't use the source directory as a temporary HOME directory.
2021-05-07gdb/guile: perform tilde expansion when sourcing guile scriptsAndrew Burgess1-0/+7
Before this patch: (gdb) source ~/script.scm ERROR: In procedure apply-smob/1: ERROR: In procedure primitive-load-path: Unable to find file "~/script.scm" in load path Error while executing Scheme code. (gdb) This is because the path is not tilde expanded. In contrast, when sourcing a .py or .gdb script the path is tilde expanded. This commit fixes this oversight, and allows the above source command to work as expected. The tilde expansion is done in the generic GDB code before we call the sourcer function for any particular extension language. gdb/ChangeLog: * cli/cli-cmds.c: Add 'gdbsupport/gdb_tilde_expand.h' include. (source_script_with_search): Perform tilde expansion. gdb/testsuite/ChangeLog: * gdb.guile/guile.exp: Add an extra test.
2021-05-06gdb/guile: don't try to print location for watchpointsAndrew Burgess1-0/+5
Currently, using the guile API, if a user tries to print a breakpoint object that represents a watchpoint, then GDB will crash. For example: (gdb) guile (use-modules (gdb)) (gdb) guile (define wp1 (make-breakpoint "some_variable" #:type BP_WATCHPOINT #:wp-class WP_WRITE)) (gdb) guile (register-breakpoint! wp1) (gdb) guile (display wp1) (newline) Aborted (core dumped) This turns out to be because GDB calls event_location_to_string on the breakpoints location, and watchpoint breakpoints don't have a location. This commit resolves the crash by just skipping the printing of the location if the breakpoint doesn't have one. Potentially, we could improve on this by printing details about what the watchpoint is watching, however, I'm considering this a possible future enhancement, this commit focuses just on having GDB not crash. gdb/ChangeLog: * guile/scm-breakpoint.c (bpscm_print_breakpoint_smob): Only print breakpoint locations when the breakpoint actually has a location. gdb/testsuite/ChangeLog: * gdb.guile/scm-breakpoint.exp (test_watchpoints): Print the watchpoint object before and after registering it with GDB.
2021-05-06gdb/testsuite: use proc_with_prefix in gdb.guile/scm-breakpoint.expAndrew Burgess1-424/+408
Convert gdb.guile/scm-breakpoint.exp to use proc_with_prefix instead of using nested with_test_prefix calls. Allows a level of indentation to be removed from most of the test procs. There were two procs that didn't use with_test_prefix, but I converted them to be proc_with_prefix anyway, for consistency. gdb/testsuite/ChangeLog: * gdb.guile/scm-breakpoint.exp (test_bkpt_basic): Convert to 'proc_with_prefix', remove use of 'with_test_prefix', and reindent. (test_bkpt_deletion): Likewise. (test_bkpt_cond_and_cmds): Likewise. (test_bkpt_invisible): Likewise. (test_watchpoints): Likewise. (test_bkpt_internal): Likewise. (test_bkpt_eval_funcs): Likewise. (test_bkpt_registration): Likewise. (test_bkpt_address): Convert to 'proc_with_prefix'. (test_bkpt_probe): Likewise.
2021-05-06gdb/testsuite: resolve duplicate test names in gdb.guile/scm-breakpoint.expAndrew Burgess1-10/+12
Extend some test names to avoid duplicates. gdb/testsuite/ChangeLog: * gdb.guile/scm-breakpoint.exp (test_bkpt_basic): Extend test names to avoid duplicates. (test_bkpt_cond_and_cmds): Likewise. (test_bkpt_eval_funcs): Likewise.
2021-04-22gdb: fix getting range of flexible array member in PythonSimon Marchi2-0/+24
As reported in bug 27757, we get an internal error when doing: $ cat test.c struct foo { int len; int items[]; }; struct foo *p; int main() { return 0; } $ gcc test.c -g -O0 -o test $ ./gdb -q -nx --data-directory=data-directory ./test -ex 'python gdb.parse_and_eval("p").type.target()["items"].type.range()' Reading symbols from ./test... /home/simark/src/binutils-gdb/gdb/gdbtypes.h:435: internal-error: LONGEST dynamic_prop::const_val() const: Assertion `m_kind == PROP_CONST' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) This is because the Python code (typy_range) blindly reads the high bound of the type of `items` as a constant value. Since it is a flexible array member, it has no high bound, the property is undefined. Since commit 8c2e4e0689 ("gdb: add accessors to struct dynamic_prop"), the getters check that you are not getting a property value of the wrong kind, so this causes a failed assertion. Fix it by checking if the property is indeed a constant value before accessing it as such. Otherwise, use 0. This restores the previous GDB behavior: because the structure was zero-initialized, this is what was returned before. But now this behavior is explicit and not accidental. Add a test, gdb.python/flexible-array-member.exp, that is derived from gdb.base/flexible-array-member.exp. It tests the same things, but through the Python API. It also specifically tests getting the range from the various kinds of flexible array member types (AFAIK it wasn't possible to do the equivalent through the CLI). gdb/ChangeLog: PR gdb/27757 * python/py-type.c (typy_range): Check that bounds are constant before accessing them as such. * guile/scm-type.c (gdbscm_type_range): Likewise. gdb/testsuite/ChangeLog: PR gdb/27757 * gdb.python/flexible-array-member.c: New test. * gdb.python/flexible-array-member.exp: New test. * gdb.guile/scm-type.exp (test_range): Add test for flexible array member. * gdb.guile/scm-type.c (struct flex_member): New. (main): Use it. Change-Id: Ibef92ee5fd871ecb7c791db2a788f203dff2b841
2021-02-11gdb: Remove arm-symbianelf supportAlan Modra1-1/+0
Since it has gone from bfd/. * arm-symbian-tdep.c: Delete. * NEWS: Mention arm-symbian removal. * Makefile.in: Remove arm-symbian-tdep entries. * configure.tgt: Remove arm*-*-symbianelf*. * doc/gdb.texinfo: Remove mention of SymbianOS. * osabi.c (gdb_osabi_names): Remove "Symbian". * osabi.h (enum gdb_osabi): Remove GDB_OSABI_SYMBIAN. * testsuite/gdb.base/ending-run.exp: Remove E32Main handling. * testsuite/gdb.ada/catch_ex_std.exp: Remove arm*-*-symbianelf* handling. * testsuite/gdb.base/dup-sect.exp: Likewise. * testsuite/gdb.base/long_long.exp: Likewise. * testsuite/gdb.base/solib-weak.exp: Likewise. * testsuite/gdb.guile/scm-section-script.exp: Likewise. * testsuite/gdb.python/py-section-script.exp: Likewise. * testsuite/lib/dwarf.exp: Likewise. * testsuite/lib/gdb.exp: Likewise.
2021-01-01Update copyright year range in all GDB filesJoel Brobecker59-59/+59
This commits the result of running gdb/copyright.py as per our Start of New Year procedure... gdb/ChangeLog Update copyright year range in copyright header of all GDB files.
2020-10-13gdb/testsuite/: Use -qualified in runto_main / mi_runto_mainPedro Alves1-1/+1
In some runtimes, there may be a "main" function in some class or namespace. The breakpoint created by runto_main may therefore have unexpected locations on some other functions than the actual main. These breakpoint locations can unexpectedly get hit during tests and lead to failures. I saw this while playing with AMD's ROCm toolchain -- I wrote a board file to run the testsuite against device kernels. There, the runtime calls a "main" function before the device kernel code is reached: Thread 4 "bit_extract" hit Breakpoint 1, 0x00007ffeea140960 in lld::elf::LinkerDriver::main(llvm::ArrayRef<char const*>) () from /opt/rocm/lib/libamd_comgr.so.1 (gdb) bt #0 0x00007ffeea140960 in lld::elf::LinkerDriver::main(llvm::ArrayRef<char const*>) () from /opt/rocm/lib/libamd_comgr.so.1 #1 0x00007ffeea2257a5 in lld::elf::link(llvm::ArrayRef<char const*>, bool, llvm::raw_ostream&, llvm::raw_ostream&) () from /opt/rocm/lib/libamd_comgr.so.1 #2 0x00007ffeea1bc374 in COMGR::linkWithLLD(llvm::ArrayRef<char const*>, llvm::raw_ostream&, llvm::raw_ostream&) () from /opt/rocm/lib/libamd_comgr.so.1 #3 0x00007ffeea1bfb09 in COMGR::InProcessDriver::execute(llvm::ArrayRef<char const*>) () from /opt/rocm/lib/libamd_comgr.so.1 #4 0x00007ffeea1c4da9 in COMGR::AMDGPUCompiler::linkToExecutable() () from /opt/rocm/lib/libamd_comgr.so.1 #5 0x00007ffeea1fde20 in dispatchCompilerAction(amd_comgr_action_kind_s, COMGR::DataAction*, COMGR::DataSet*, COMGR::DataSet*, llvm::raw_ostream&) () from /opt/rocm/lib/libamd_comgr.so.1 #6 0x00007ffeea203a87 in amd_comgr_do_action () from /opt/rocm/lib/libamd_comgr.so.1 ... To avoid that, pass "qualified" to runto, in runto_main, so that gdb_breakpoint ends up creating a breakpoint with -qualified. This avoids creating breakpoints locations for other unrelated "main" functions. Note: I first tried making runto itself use "-qualified", but that caused regressions in the gdb.ada/ tests, which use runto without specifying the whole fully-qualified function name (i.e., without the package). So I end up restricting the -qualified to runto_main/mi_runto_main. The gdb.base/ui-redirect.exp change is necessary because that testcase is looking at what "save breakpoint" generates. gdb/testsuite/ChangeLog: * gdb.base/ui-redirect.exp: Expect "break -qualified main" in saved breakpoints file. * gdb.guile/scm-breakpoint.exp: Expect "-qualified main" when inspecting breakpoint list. * lib/gdb.exp (runto_main): Add "qualified" to options. * lib/mi-support.exp (mi_runto_helper): Add 'qualified' parameter, and handle it. (mi_runto_main): Pass 1 as qualified argument. Change-Id: I51468359ab0a518f05f7c0394c97f7e33b45fe69
2020-10-13'runto main' -> 'runto_main' throughoutPedro Alves1-1/+1
This commit does 's/runto main/runto_main/g' throughout. gdb/testsuite/ChangeLog: * gdb.ada/fun_in_declare.exp: Use "runto_main" instead of "runto main". * gdb.ada/small_reg_param.exp: Likewise. * gdb.arch/powerpc-d128-regs.exp: Likewise. * gdb.base/annota1.exp: Likewise. * gdb.base/anon.exp: Likewise. * gdb.base/breakpoint-in-ro-region.exp: Likewise. * gdb.base/dprintf-non-stop.exp: Likewise. * gdb.base/dprintf.exp: Likewise. * gdb.base/gdb11530.exp: Likewise. * gdb.base/gdb11531.exp: Likewise. * gdb.base/gnu_vector.exp: Likewise. * gdb.base/interrupt-noterm.exp: Likewise. * gdb.base/memattr.exp: Likewise. * gdb.base/step-over-syscall.exp: Likewise. * gdb.base/watch-cond-infcall.exp: Likewise. * gdb.base/watch-read.exp: Likewise. * gdb.base/watch-vfork.exp: Likewise. * gdb.base/watch_thread_num.exp: Likewise. * gdb.base/watchpoint-stops-at-right-insn.exp: Likewise. * gdb.guile/scm-frame-inline.exp: Likewise. * gdb.linespec/explicit.exp: Likewise. * gdb.opt/inline-break.exp: Likewise. * gdb.python/py-frame-inline.exp: Likewise. * gdb.reverse/break-precsave.exp: Likewise. * gdb.reverse/break-reverse.exp: Likewise. * gdb.reverse/consecutive-precsave.exp: Likewise. * gdb.reverse/consecutive-reverse.exp: Likewise. * gdb.reverse/finish-precsave.exp: Likewise. * gdb.reverse/finish-reverse.exp: Likewise. * gdb.reverse/fstatat-reverse.exp: Likewise. * gdb.reverse/getresuid-reverse.exp: Likewise. * gdb.reverse/i386-precsave.exp: Likewise. * gdb.reverse/i386-reverse.exp: Likewise. * gdb.reverse/i386-sse-reverse.exp: Likewise. * gdb.reverse/i387-env-reverse.exp: Likewise. * gdb.reverse/i387-stack-reverse.exp: Likewise. * gdb.reverse/insn-reverse.exp: Likewise. * gdb.reverse/machinestate-precsave.exp: Likewise. * gdb.reverse/machinestate.exp: Likewise. * gdb.reverse/pipe-reverse.exp: Likewise. * gdb.reverse/readv-reverse.exp: Likewise. * gdb.reverse/recvmsg-reverse.exp: Likewise. * gdb.reverse/rerun-prec.exp: Likewise. * gdb.reverse/s390-mvcle.exp: Likewise. * gdb.reverse/solib-precsave.exp: Likewise. * gdb.reverse/solib-reverse.exp: Likewise. * gdb.reverse/step-precsave.exp: Likewise. * gdb.reverse/step-reverse.exp: Likewise. * gdb.reverse/time-reverse.exp: Likewise. * gdb.reverse/until-precsave.exp: Likewise. * gdb.reverse/until-reverse.exp: Likewise. * gdb.reverse/waitpid-reverse.exp: Likewise. * gdb.reverse/watch-precsave.exp: Likewise. * gdb.reverse/watch-reverse.exp: Likewise. * gdb.threads/kill.exp: Likewise. * gdb.threads/tid-reuse.exp: Likewise. Change-Id: I70f457253836019880b4d7fb981936afa56724c2
2020-10-12Fix testcases with required but unreferenced functions and variablesGary Benson1-1/+1
A number of testcases define variables and/or functions which are referenced by GDB during the test, but which are not referenced from within the test executable. Clang correctly recognizes that these variables and functions are unused, and optimizes them out, causing the testcases in question to fail. This commit adds __attribute__ ((used)) in various places to prevent this. gdb/testsuite/ChangeLog: * gdb.base/msym-bp.c (foo): Add __attribute__ ((used)). * gdb.base/msym-bp-2.c (foo): Likewise. * gdb.base/msym-lang.c (foo): Likewise. * gdb.base/msym-lang-main.c (foo): Likewise. * gdb.base/symtab-search-order-1.c (static_global): Likewise. * gdb.guile/scm-pretty-print.c (eval_func): Likewise. * gdb.mi/mi-sym-info-1.c (global_f1): Likewise. * gdb.mi/mi-sym-info-2.c (global_f1, var1, var2): Likewise. * gdb.multi/watchpoint-multi-exit.c (globalvar): Likewise. * gdb.python/py-as-string.c (enum_valid, enum_invalid): Likewise. * gdb.python/py-objfile.c (static_var): Likewise. * gdb.python/py-symbol.c (rr): Likewise. * gdb.python/py-symbol-2.c (anon, rr): Likewise. * gdb.mi/mi-sym-info.exp (lineno1, lineno2): Updated.
2020-07-20guile: Add support for Guile 3.0.Ludovic Courtès2-4/+4
gdb/ChangeLog 2020-06-28 Ludovic Courtès <ludo@gnu.org> * guile/scm-math.c (vlscm_integer_fits_p): Use 'uintmax_t' and 'intmax_t' instead of 'scm_t_uintmax' and 'scm_t_intmax', which are deprecated in Guile 3.0. * configure.ac (try_guile_versions): Add "guile-3.0". * configure (try_guile_versions): Regenerate. * NEWS: Update entry. gdb/testsuite/ChangeLog 2020-06-28 Ludovic Courtès <ludo@gnu.org> * gdb.guile/source2.scm: Add #f first argument to 'format'. * gdb.guile/types-module.exp: Remove "ERROR:" from regexps since Guile 3.0 no longer prints that. gdb/doc/ChangeLog 2020-06-28 Ludovic Courtès <ludo@gnu.org> * doc/guile.texi (Guile Introduction): Mention Guile 3.0. Change-Id: Iff116c2e40f334e4e0ca4e759a097bfd23634679
2020-07-20guile: Add support for Guile 2.2.Ludovic Courtès1-1/+1
This primarily updates code that uses the I/O port API of Guile. gdb/ChangeLog 2020-06-28 Ludovic Courtès <ludo@gnu.org> Doug Evans <dje@google.com> PR gdb/21104 * guile/scm-ports.c (USING_GUILE_BEFORE_2_2): New macro. (ioscm_memory_port)[read_buf_size, write_buf_size]: Wrap in #if USING_GUILE_BEFORE_2_2. (stdio_port_desc, memory_port_desc) [!USING_GUILE_BEFORE_2_2]: Change type to 'scm_t_port_type *'. (natural_buffer_size) [!USING_GUILE_BEFORE_2_2]: New variable. (ioscm_open_port) [USING_GUILE_BEFORE_2_2]: Add 'stream' parameter and honor it. Update callers. (ioscm_open_port) [!USING_GUILE_BEFORE_2_2]: New function. (ioscm_read_from_port, ioscm_write) [!USING_GUILE_BEFORE_2_2]: New functions. (ioscm_fill_input, ioscm_input_waiting, ioscm_flush): Wrap in #if USING_GUILE_BEFORE_2_2. (ioscm_init_gdb_stdio_port) [!USING_GUILE_BEFORE_2_2]: Use 'ioscm_read_from_port'. Call 'scm_set_port_read_wait_fd'. (ioscm_init_stdio_buffers) [!USING_GUILE_BEFORE_2_2]: New function. (gdbscm_stdio_port_p) [!USING_GUILE_BEFORE_2_2]: Use 'SCM_PORTP' and 'SCM_PORT_TYPE'. (gdbscm_memory_port_end_input, gdbscm_memory_port_seek) (ioscm_reinit_memory_port): Wrap in #if USING_GUILE_BEFORE_2_2. (gdbscm_memory_port_read, gdbscm_memory_port_write) (gdbscm_memory_port_seek, gdbscm_memory_port_close) [!USING_GUILE_BEFORE_2_2]: New functions. (gdbscm_memory_port_print): Remove use of 'SCM_PTOB_NAME'. (ioscm_init_memory_port_type) [!USING_GUILE_BEFORE_2_2]: Use 'gdbscm_memory_port_read'. Wrap 'scm_set_port_end_input', 'scm_set_port_flush', and 'scm_set_port_free' calls in #if USING_GUILE_BEFORE_2_2. (gdbscm_get_natural_buffer_sizes) [!USING_GUILE_BEFORE_2_2]: New function. (ioscm_init_memory_port): Remove. (ioscm_init_memory_port_stream): New function (ioscm_init_memory_port_buffers) [USING_GUILE_BEFORE_2_2]: New function. (gdbscm_memory_port_read_buffer_size) [!USING_GUILE_BEFORE_2_2]: Return scm_from_uint (0). (gdbscm_set_memory_port_read_buffer_size_x) [!USING_GUILE_BEFORE_2_2]: Call 'scm_setvbuf'. (gdbscm_memory_port_write_buffer_size) [!USING_GUILE_BEFORE_2_2]: Return scm_from_uint (0). (gdbscm_set_memory_port_write_buffer_size_x) [!USING_GUILE_BEFORE_2_2]: Call 'scm_setvbuf'. * configure.ac (try_guile_versions): Add "guile-2.2". * configure: Regenerate. * NEWS: Add entry. gdb/testsuite/ChangeLog 2020-06-28 Ludovic Courtès <ludo@gnu.org> * gdb.guile/scm-error.exp ("source $remote_guile_file_1"): Relax error regexp to match on Guile 2.2. gdb/doc/ChangeLog 2020-06-28 Ludovic Courtès <ludo@gnu.org> * guile.texi (Memory Ports in Guile): Mark 'memory-port-read-buffer-size', 'set-memory-port-read-buffer-size!', 'memory-port-write-buffer-size', 'set-memory-port-read-buffer-size!' as deprecated. * doc/guile.texi (Guile Introduction): Clarify which Guile versions are supported. Change-Id: Ib119b10a2787446e0ae482a5e1b36d809c44bb31
2020-06-22Add tests for new alias default-args related commands and arguments.Philippe Waroquiers1-1/+1
Test the new default-args behaviour and completion for the alias command. Note that gdb.base/default-args.exp is somewhat copied from with.exp (the test of the with command), while default-exp.c is a plain copy of with.c. gdb/testsuite/ChangeLog 2020-06-22 Philippe Waroquiers <philippe.waroquiers@skynet.be> * gdb.base/default-args.exp: New test. * gdb.base/default-args.c: New file. * gdb.base/alias.exp: Update expected error msg for alias foo=bar. * gdb.base/default.exp: Update to new help text. * gdb.base/help.exp: Likewise. * gdb.base/page.exp: Likewise. * gdb.base/style.exp: Likewise. * gdb.guile/guile.exp: Likewise. * gdb.python/python.exp: Likewise.
2020-04-29[gdb/testsuite] Add xfails for PR gcc/90232Tom de Vries1-2/+17
With target board debug-types, we have these FAILs: ... FAIL: gdb.guile/scm-symtab.exp: test simple_struct in static symbols FAIL: gdb.python/py-symtab.exp: test simple_struct in static symbols ... due to PR gcc/90232, as explained in commit 15cd93d05e8 "[gdb/symtab] Handle struct decl with DW_AT_signature". Marks these as XFAILs. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2020-04-29 Tom de Vries <tdevries@suse.de> * lib/gdb.exp (debug_types): New proc. * gdb.guile/scm-symtab.exp: Add xfail for PR gcc/90232. * gdb.python/py-symtab.exp: Same.
2020-04-24Use the linkage name if it existsTom Tromey1-3/+1
The DWARF reader has had some odd code since the "physname" patches landed. In particular, these patches caused PR symtab/12707; namely, they made it so "set print demangle off" no longer works. This patch attempts to fix the problem. It arranges to store the linkage name on the symbol if it exists, and it changes the DWARF reader so that the demangled name is no longer (usually) stored in the symbol's "linkage name" field. c-linkage-name.exp needed a tweak, because it started working correctly. This conforms to what I think ought to happen, so this seems like an improvement here. compile-object-load.c needed a small change to use symbol_matches_search_name rather than directly examining the linkage name. Looking directly at the name does the wrong thing for C++. There is still some name-related confusion in the DWARF reader: * "physname" often refers to the logical name and not what I would consider to be the "physical" name; * dwarf2_full_name, dwarf2_name, and dwarf2_physname all exist and return different strings -- but this seems like at least one name too many. For example, Fortran requires dwarf2_full_name, but other languages do not. * To my surprise, dwarf2_physname prefers the form emitted by the demangler over the one that it computes. This seems backward to me, given that the partial symbol reader prefers the opposite, and it seems to me that this choice may perform better as well. I didn't attempt to clean up these things. It would be good to do, but whenever I contemplate it I get caught up in dreams of truly rewriting the DWARF reader instead. gdb/ChangeLog 2020-04-24 Tom Tromey <tom@tromey.com> PR symtab/12707: * dwarf2/read.c (add_partial_symbol): Use the linkage name if it exists. (new_symbol): Likewise. * compile/compile-object-load.c (get_out_value_type): Use symbol_matches_search_name. gdb/testsuite/ChangeLog 2020-04-24 Tom Tromey <tom@tromey.com> PR symtab/12707: * gdb.python/py-symbol.exp: Update expected results for linkage_name test. * gdb.cp/print-demangle.exp: New file. * gdb.base/c-linkage-name.exp: Fix test. * gdb.guile/scm-symbol.exp: Update expected results for linkage_name test.
2020-01-10Add "info connections" command, "info inferiors" connection number/stringPedro Alves1-1/+1
This commit extends the CLI a bit for multi-target, in three ways. #1 - New "info connections" command. This is a new command that lists the open connections (process_stratum targets). For example, if you're debugging two remote connections, a couple local/native processes, and a core dump, all at the same time, you might see something like this: (gdb) info connections Num What Description 1 remote 192.168.0.1:9999 Remote serial target in gdb-specific protocol 2 remote 192.168.0.2:9998 Remote serial target in gdb-specific protocol * 3 native Native process 4 core Local core dump file #2 - New "info inferiors" "Connection" column You'll also see a new matching "Connection" column in "info inferiors", showing you which connection an inferior is bound to: (gdb) info inferiors Num Description Connection Executable 1 process 18526 1 (remote 192.168.0.1:9999) target:/tmp/a.out 2 process 18531 2 (remote 192.168.0.2:9998) target:/tmp/a.out 3 process 19115 3 (native) /tmp/prog1 4 process 6286 4 (core) myprogram * 5 process 19122 3 (native) /bin/hello #3 - Makes "add-inferior" show the inferior's target connection "add-inferior" now shows you the connection you've just bound the inferior to, which is the current process_stratum target: (gdb) add-inferior [New inferior 2] Added inferior 2 on connection 1 (extended-remote localhost:2346) gdb/ChangeLog: 2020-01-10 Pedro Alves <palves@redhat.com> * Makefile.in (COMMON_SFILES): Add target-connection.c. * inferior.c (uiout_field_connection): New function. (print_inferior): Add new "connection-id" column. (add_inferior_command): Show connection number/string of added inferior. * process-stratum-target.h (process_stratum_target::connection_string): New virtual method. (process_stratum_target::connection_number): New field. * remote.c (remote_target::connection_string): New override. * target-connection.c: New file. * target-connection.h: New file. * target.c (decref_target): Remove process_stratum targets from the connection list. (target_stack::push): Add process_stratum targets to the connection list. gdb/testsuite/ChangeLog: 2020-01-10 Pedro Alves <palves@redhat.com> * gdb.base/kill-detach-inferiors-cmd.exp: Adjust expected output of "add-inferior". * gdb.base/quit-live.exp: Likewise. * gdb.base/remote-exec-file.exp: Likewise. * gdb.guile/scm-progspace.exp: Likewise. * gdb.linespec/linespec.exp: Likewise. * gdb.mi/new-ui-mi-sync.exp: Likewise. * gdb.mi/user-selected-context-sync.exp: Likewise. * gdb.multi/multi-target.exp (setup): Add "info connection" and "info inferiors" tests. * gdb.multi/remove-inferiors.exp: Adjust expected output of "add-inferior". * gdb.multi/watchpoint-multi.exp: Likewise. * gdb.python/py-inferior.exp: Likewise. * gdb.server/extended-remote-restart.exp: Likewise. * gdb.threads/fork-plus-threads.exp: Adjust expected output of "info inferiors". * gdb.threads/forking-threads-plus-breakpoint.exp: Likewise. * gdb.trace/report.exp: Likewise.
2020-01-01Update copyright year range in all GDB files.Joel Brobecker59-59/+59
gdb/ChangeLog: Update copyright year range in all GDB files.
2019-12-09Fix scripted probe breakpointsGeorge Barrett2-0/+30
The documentation for make-breakpoint from the Guile API and the `spec' variant of the gdb.Breakpoint constructor from the Python API state that the format acceptable for location strings is the same as that accepted by the break command. However, using the -probe qualifier at the beginning of the location string causes a GDB internal error as it attempts to decode a probe location in the wrong code path. Without this functionality, there doesn't appear to be another way to set breakpoints on probe points from Python or Guile scripts. This patch introduces a new helper function that returns a breakpoint_ops instance appropriate for a parsed location and updates the Guile and Python bindings to use said function, rather than the current hard-coded use of bkpt_breakpoint_ops. Since this logic is duplicated in the handling of the `break' and `trace' commands, those are also updated to call into the new helper function. gdb/ChangeLog: 2019-12-10 George Barrett <bob@bob131.so> Fix scripted probe breakpoints. * breakpoint.c (tracepoint_probe_breakpoint_ops): Move declaration forward. (breakpoint_ops_for_event_location_type) (breakpoint_ops_for_event_location): Add function definitions. (break_command_1, trace_command): Use breakpoint_ops_for_event_location. * breakpoint.h (breakpoint_ops_for_event_location): Add function declarations. * guile/scm-breakpoint.c (gdbscm_register_breakpoint_x): Use breakpoint_ops_for_event_location. * python/py-breakpoint.c (bppy_init): Use breakpoint_ops_for_event_location. gdb/testsuite/ChangeLog: 2019-12-10 George Barrett <bob@bob131.so> Test scripted probe breakpoints. * gdb.guile/scm-breakpoint.c (main): Add probe point. * gdb.python/py-breakpoint.c (main): Likewise. * gdb.guile/scm-breakpoint.exp (test_bkpt_probe): Add probe specifier test. * gdb.python/py-breakpoint.exp (test_bkpt_probe): Likewise.
2019-10-31[gdb/testsuite] Remove superfluous 3rd argument from gdb_test call (2)Tom de Vries1-1/+1
There's a pattern: ... gdb_test <command> <pattern> <command> ... that can be written shorter as: ... gdb_test <command> <pattern> ... Detect this pattern in proc gdb_test: ... global gdb_prompt upvar timeout timeout if [llength $args]>2 then { set message [lindex $args 2] + if { $message == [lindex $args 0] && [llength $args] == 3 } { + error "HERE" + } } else { set message [lindex $args 0] } ... and fix all occurrences in some gdb testsuite subdirs. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-10-31 Tom de Vries <tdevries@suse.de> * gdb.arch/amd64-disp-step-avx.exp: Drop superfluous 3rd argument to gdb_test. * gdb.arch/amd64-disp-step.exp: Same. * gdb.asm/asm-source.exp: Same. * gdb.btrace/buffer-size.exp: Same. * gdb.btrace/cpu.exp: Same. * gdb.btrace/enable.exp: Same. * gdb.dwarf2/count.exp: Same. * gdb.dwarf2/dw2-ranges-func.exp: Same. * gdb.dwarf2/dw2-ranges-psym.exp: Same. * gdb.fortran/vla-datatypes.exp: Same. * gdb.fortran/vla-history.exp: Same. * gdb.fortran/vla-ptype.exp: Same. * gdb.fortran/vla-value.exp: Same. * gdb.fortran/whatis_type.exp: Same. * gdb.guile/guile.exp: Same. * gdb.multi/tids.exp: Same. * gdb.python/py-finish-breakpoint.exp: Same. * gdb.python/py-framefilter.exp: Same. * gdb.python/py-pp-registration.exp: Same. * gdb.python/py-xmethods.exp: Same. * gdb.python/python.exp: Same. * gdb.server/connect-with-no-symbol-file.exp: Same. * gdb.server/no-thread-db.exp: Same. * gdb.server/run-without-local-binary.exp: Same. * gdb.stabs/weird.exp: Same. * gdb.threads/attach-many-short-lived-threads.exp: Same. * gdb.threads/thread-find.exp: Same. * gdb.threads/tls-shared.exp: Same. * gdb.threads/tls.exp: Same. * gdb.threads/wp-replication.exp: Same. * gdb.trace/ax.exp: Same. * lib/gdb.exp (gdb_test_exact, help_test_raw): Same. Change-Id: I2fa544c68f8c0099a77e03ff04ddc010eb2b6c7c
2019-06-13"set print raw frame-arguments" -> "set print raw-frame-arguments"Pedro Alves1-2/+2
A following patch will introduce options for the "backtrace" command, based on some "set print" and "set backtrace" settings. There's one setting in particular that is a bit annoying if we want to describe the backtrace options and the settings commands using the same data structures: "set print raw frame-arguments" The problem is that space between "raw" and "frame-arguments". Calling the option "bt -raw frame-arguments" would be odd. So I'm calling the option "bt -raw-frame-arguments" instead. And for consistency, this patch renames the set/show commands to: "set print raw-frame-arguments" "show print raw-frame-arguments" I.e., dash instead of space. The old commands are left in place, but marked deprecated. We need to adjust a couple testcases, because the relevant tests use gdb_test_no_output and the old commands are no longer silent: (gdb) set print raw frame-arguments on Warning: command 'set print raw frame-arguments' is deprecated. Use 'set print raw-frame-arguments'. gdb/ChangeLog: 2019-06-13 Pedro Alves <palves@redhat.com> * NEWS (Changed commands): Mention set/show print raw-frame-arguments, and that "set/show print raw frame-arguments" are now deprecated. * cli/cli-decode.c (add_setshow_boolean_cmd): Now returns the command. * command.h (add_setshow_boolean_cmd): Return cmd_list_element *. * stack.c (_initialize_stack): Install "set/show print raw-frame-arguments", and deprecate "set/show print raw frame-arguments". * valprint.c (_initialize_valprint): Deprecate "set/show print raw". gdb/doc/ChangeLog: 2019-06-13 Pedro Alves <palves@redhat.com> * gdb.texinfo (Print Settings): Document "set/show print raw-frame-arguments" instead of "set/show print raw frame-arguments". gdb/testsuite/ChangeLog: 2019-06-13 Pedro Alves <palves@redhat.com> * gdb.guile/scm-frame-args.exp: Use "set print raw-frame-arguments" instead of "set print raw frame-arguments". * gdb.python/py-frame-args.exp: Likewise.
2019-06-03Update tests following changes to "help" and "apropos"Philippe Waroquiers1-3/+1
Factorizes the testing of the help output, by having a single place that defines the common help trailer and/or prefix messages.
2019-01-01Update copyright year range in all GDB files.Joel Brobecker59-59/+59
This commit applies all changes made after running the gdb/copyright.py script. Note that one file was flagged by the script, due to an invalid copyright header (gdb/unittests/basic_string_view/element_access/char/empty.cc). As the file was copied from GCC's libstdc++-v3 testsuite, this commit leaves this file untouched for the time being; a patch to fix the header was sent to gcc-patches first. gdb/ChangeLog: Update copyright year range in all GDB files.
2018-10-18[gdb/testsuite] Fix capitalized test namesTom de Vries1-1/+1
At https://sourceware.org/gdb/wiki/GDBTestcaseCookbook\ #Follow_the_test_name_convention we find: .. Test names should start with a lower case and don't need to end with a period (they are not sentences). ... Fix some capitalized test names. Tested on x86_64-linux. 2018-10-18 Tom de Vries <tdevries@suse.de> * gdb.ada/bp_inlined_func.exp: Fix capitalized test name. * gdb.ada/excep_handle.exp: Same. * gdb.ada/mi_string_access.exp: Same. * gdb.ada/mi_var_union.exp: Same. * gdb.arch/arc-analyze-prologue.exp: Same. * gdb.arch/arc-decode-insn.exp: Same. * gdb.base/readnever.exp: Same. * gdb.fortran/printing-types.exp: Same. * gdb.guile/scm-lazy-string.exp: Same.
2018-01-15Fix scm-ports.exp regressionTom Tromey1-1/+1
In https://sourceware.org/ml/gdb-patches/2017-12/msg00215.html, Jan pointed out that the scalar printing patches caused a regression in scm-ports.exp on x86. What happens is that on x86, this: set sp_reg [get_integer_valueof "\$sp" 0] ... ends up setting sp_reg to a negative value, because get_integer_valueof uses "print/d": print /d $sp $1 = -11496 Then later the test suite does: gdb_test "guile (print (seek rw-mem-port (value->integer sp-reg) SEEK_SET))" \ "= $sp_reg" \ "seek to \$sp" ... expecting this value to be identical to the saved $sp_reg value. However it gets: guile (print (seek rw-mem-port (value->integer sp-reg) SEEK_SET)) = 4294955800 "print" is just a wrapper for guile's format: gdb_test_no_output "guile (define (print x) (format #t \"= ~A\" x) (newline))" The seek function returns a scm_t_off, the printing of which is handled by guile, not by gdb. Tested on x86-64 Fedora 26 using an ordinary build and also a -m32 build. 2018-01-15 Tom Tromey <tom@tromey.com> * gdb.guile/scm-ports.exp (test_mem_port_rw): Use get_valueof to compute sp_reg.