aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.python/python.exp
AgeCommit message (Collapse)AuthorFilesLines
2024-02-27Rewrite "python" command exception handlingTom Tromey1-5/+5
The "python" command (and the Python implementation of the gdb "source" command) does not handle Python exceptions in the same way as other gdb-facing Python code. In particular, exceptions are turned into a generic error rather than being routed through gdbpy_handle_exception, which takes care of converting to 'quit' as appropriate. I think this was done this way because PyRun_SimpleFile and friends do not propagate the Python exception -- they simply indicate that one occurred. This patch reimplements these functions to respect the general gdb convention here. As a bonus, some Windows-specific code can be removed, as can the _execute_file function. The bulk of this change is tweaking the test suite to match the new way that exceptions are displayed. These changes are largely uninteresting. However, it's worth pointing out the py-error.exp change. Here, the failure changes because the test changes the host charset to something that isn't supported by Python. This then results in a weird error in the new setup. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31354 Acked-By: Tom de Vries <tdevries@suse.de> Reviewed-By: Eli Zaretskii <eliz@gnu.org>
2024-01-12Update copyright year range in header of all files managed by GDBAndrew Burgess1-1/+1
This commit is the result of the following actions: - Running gdb/copyright.py to update all of the copyright headers to include 2024, - Manually updating a few files the copyright.py script told me to update, these files had copyright headers embedded within the file, - Regenerating gdbsupport/Makefile.in to refresh it's copyright date, - Using grep to find other files that still mentioned 2023. If these files were updated last year from 2022 to 2023 then I've updated them this year to 2024. I'm sure I've probably missed some dates. Feel free to fix them up as you spot them.
2023-06-03[gdb] Fix typosTom de Vries1-1/+1
Fix a few typos: - implemention -> implementation - convertion(s) -> conversion(s) - backlashes -> backslashes - signoring -> ignoring - (un)ambigious -> (un)ambiguous - occured -> occurred - hidding -> hiding - temporarilly -> temporarily - immediatelly -> immediately - sillyness -> silliness - similiar -> similar - porkuser -> pokeuser - thats -> that - alway -> always - supercede -> supersede - accomodate -> accommodate - aquire -> acquire - priveleged -> privileged - priviliged -> privileged - priviledges -> privileges - privilige -> privilege - recieve -> receive - (p)refered -> (p)referred - succesfully -> successfully - successfuly -> successfully - responsability -> responsibility - wether -> whether - wich -> which - disasbleable -> disableable - descriminant -> discriminant - construcstor -> constructor - underlaying -> underlying - underyling -> underlying - structureal -> structural - appearences -> appearances - terciarily -> tertiarily - resgisters -> registers - reacheable -> reachable - likelyhood -> likelihood - intepreter -> interpreter - disassemly -> disassembly - covnersion -> conversion - conviently -> conveniently - atttribute -> attribute - struction -> struct - resonable -> reasonable - popupated -> populated - namespaxe -> namespace - intialize -> initialize - identifer(s) -> identifier(s) - expection -> exception - exectuted -> executed - dungerous -> dangerous - dissapear -> disappear - completly -> completely - (inter)changable -> (inter)changeable - beakpoint -> breakpoint - automativ -> automatic - alocating -> allocating - agressive -> aggressive - writting -> writing - reguires -> requires - registed -> registered - recuding -> reducing - opeartor -> operator - ommitted -> omitted - modifing -> modifying - intances -> instances - imbedded -> embedded - gdbaarch -> gdbarch - exection -> execution - direcive -> directive - demanged -> demangled - decidely -> decidedly - argments -> arguments - agrument -> argument - amespace -> namespace - targtet -> target - supress(ed) -> suppress(ed) - startum -> stratum - squence -> sequence - prompty -> prompt - overlow -> overflow - memember -> member - languge -> language - geneate -> generate - funcion -> function - exising -> existing - dinking -> syncing - destroh -> destroy - clenaed -> cleaned - changep -> changedp (name of variable) - arround -> around - aproach -> approach - whould -> would - symobl -> symbol - recuse -> recurse - outter -> outer - freeds -> frees - contex -> context Tested on x86_64-linux. Reviewed-By: Tom Tromey <tom@tromey.com>
2023-05-05gdb/testsuite: more newline pattern cleanupAndrew Burgess1-1/+1
After this commit: commit e2f620135d92f7cd670af4e524fffec7ac307666 Date: Thu Mar 30 13:26:25 2023 +0100 gdb/testsuite: change newline patterns used in gdb_test It was pointed out in PR gdb/30403 that the same patterns can be found in other lib/gdb.exp procs and that it would probably be a good idea if these procs remained in sync with gdb_test. Actually, the bug specifically calls out gdb_test_multiple when using with '-wrap', but I found a couple of other locations in gdb_continue_to_breakpoint, gdb_test_multiline, get_valueof, and get_local_valueof. In all these locations one or both of the following issues are addressed: 1. A leading pattern of '[\r\n]*' is pointless. If there is a newline it will be matched, but if there is not then the testsuite doesn't care. Also, as expect is happy to skip non-matched output at the start of a pattern, if there is a newline expect is happy to skip over it before matching the rest. As such, this leading pattern is removed. 2. Using '\[\r\n\]*$gdb_prompt' means that we will swallow unexpected blank lines at the end of a command's output, but also, if the pattern from the test script ends with a '\r', '\n', or '.' then these will partially match the trailing newline, with the remainder of the newline matched by the pattern from gdb.exp. This split matching doesn't add any value, it's just something that has appeared as a consequence of how gdb.exp was originally written. In this case the '\[\r\n\]*' is replaced with '\r\n'. I've rerun the testsuite and fixed the regressions that I saw, these were places where GDB emits a blank line at the end of the command output, which we now need to explicitly match in the test script, this was for: gdb.dwarf2/dw2-out-of-range-end-of-seq.exp gdb.guile/guile.exp gdb.python/python.exp Or a location where the test script was matching part of the newline sequence, while gdb.exp was previously matching the remainder of the newline sequence. Now we rely on gdb.exp to match the complete newline sequence, this was for: gdb.base/commands.exp Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30403
2023-04-27gdb/testsuite: special case '^' in gdb_test patternAndrew Burgess1-1/+1
In this commit I propose that we add special handling for the '^' when used at the start of a gdb_test pattern. Consider this usage: gdb_test "some_command" "^command output pattern" I think the intention here is pretty clear - run 'some_command', and the output from the command should be exactly 'command output pattern'. After the previous commit which tightened up how gdb_test matches the final newline and prompt we know that the only thing after the output pattern will be a single newline and prompt, and the leading '^' ensures that there's no output before 'command output pattern', so this will do what I want, right? ... except it doesn't. The command itself will also needs to be matched, so I should really write: gdb_test "some_command" "^some_command\r\ncommand output pattern" which will do what I want, right? Well, that's fine until I change the command and include some regexp character, then I have to write: gdb_test "some_command" \ "^[string_to_regexp some_command]\r\ncommand output pattern" but this all gets a bit verbose, so in most cases I simply don't bother anchoring the output with a '^', and a quick scan of the testsuite would indicate that most other folk don't both either. What I propose is this: the *only* thing that can appear immediately after the '^' is the command converted into a regexp, so lets do that automatically, moving the work into gdb_test. Thus, when I write: gdb_test "some_command" "^command output pattern" Inside gdb_test we will spot the leading '^' in the pattern, and inject the regexp version of the command after the '^', followed by a '\r\n'. My hope is that given this new ability, folk will be more inclined to anchor their output patterns when this makes sense to do so. This should increase our ability to catch any unexpected output from GDB that appears as a result of running a particular command. There is one problem case we need to consider, sometime people do this: gdb_test "" "^expected output pattern" In this case no command is sent to GDB, but we are still expecting some output from GDB. This might be a result of some asynchronous event for example. As there is no command sent to GDB (from the gdb_test) there will be no command text to parse. In this case my proposed new feature injects the command regexp, which is the empty string (as the command itself is empty), but still injects the '\r\n' after the command regexp, thus we end up with this pattern: ^\r\nexpected output pattern This extra '\r\n' is not what we should expected here, and so there is a special case inside gdb_test -- if the command is empty then don't add anything after the '^' character. There are a bunch of tests that do already use '^' followed by the command, and these can all be simplified in this commit. I've tried to run all the tests that I can to check this commit, but I am certain that there will be some tests that I manage to miss. Apologies for any regressions this commit causes, hopefully fixing the regressions will not be too hard. Reviewed-By: Tom Tromey <tom@tromey.com>
2023-01-26Use clean_restart in gdb.pythonTom Tromey1-4/+1
Change gdb.python to use clean_restart more consistently.
2023-01-01Update copyright year range in header of all files managed by GDBJoel Brobecker1-1/+1
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-11-28gdb/testsuite: remove use of then keyword from gdb.python/*.expAndrew Burgess1-3/+3
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 gdb.python/ test script directory. There should be no changes in what is tested after this commit.
2022-08-30Fix flush for sys.stderrTom Tromey1-2/+2
GDB overwrites Python's sys.stdout and sys.stderr, but does not properly implement the 'flush' method -- it only ever will flush stdout. This patch fixes the bug. I couldn't find a straightforward way to write a test for this.
2022-07-08Accept gdb.Value in more Python APIsTom Tromey1-0/+3
PR python/27000 points out that gdb.block_for_pc will accept a Python integer, but not a gdb.Value. This patch corrects this oversight. I looked at all uses of GDB_PY_LLU_ARG and fixed these up to use get_addr_from_python instead. I also looked at uses of GDB_PY_LL_ARG, but those seemed relatively unlikely to be useful with a gdb.Value, so I didn't change them. My thinking here is that a Value will typically come from inferior memory, and something like a line number is not too likely to be found this way. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=27000
2022-01-01Automatic Copyright Year update after running gdb/copyright.pyJoel Brobecker1-1/+1
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-13[gdb/testsuite] Require use_gdb_stub == 0 where appropriateTom de Vries1-17/+20
When running with target board native-gdbserver, we run into a number of FAILs due to use of the start command (and similar), which is not supported when use_gdb_stub == 1. Fix this by: - requiring use_gdb_stub == 0 for the entire test-case, or - guarding some tests in the test-case with use_gdb_stub == 0. Tested on x86_64-linux.
2021-10-13[gdb/testsuite] Fix test name in gdb.python/python.expTom de Vries1-4/+11
When running test-case gdb.python/python.exp, we have: ... PASS: gdb.python/python.exp: starti via gdb.execute, not from tty PASS: gdb.python/python.exp: starti via interactive input ... The two tests are instances of the same test, with different values for starti command argument from_tty, so it's strange that the test names are so different. This is due to using a gdb_test nested in a gdb_test_multiple, with the inner one using a different test name than the outer one. [ That could still make sense if both produced passes, but that's not the case here. ] Fix this by using $gdb_test_name, such that we have: ... PASS: gdb.python/python.exp: starti via gdb.execute, not from tty PASS: gdb.python/python.exp: starti via gdb.execute, from tty ... Also make this more readable by using variables. Tested on x86_64-linux.
2021-09-30gdb/testsuite: make runto_main not pass no-message to runtoSimon Marchi1-3/+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-12Improve forward progress test in python.expCarl Love1-1/+16
The test steps into func2 and than does an up to get back to the previous frame. The test checks that the line number you are at after the up command is greater than the line where the function was called from. The assembly/codegen for the powerpc target includes a NOP after the branch-link. func2 (); /* Break at func2 call site. / 10000694: 59 00 00 48 bl 100006ec 10000698: 00 00 00 60 nop return 0; / Break to end. */ 1000069c: 00 00 20 39 li r9,0 The PC at the instruction following the branch-link is 0x10000698 which GDB.find_pc_line() maps to the same line number as the bl instruction. GDB did move past the branch-link location thus making forward progress. The following proposed fix adds an additional PC check to see if forward progress was made. The line test is changed from greater than to greater than or equal.
2021-06-08Use is/is not to check for None in python code.Lancelot SIX1-1/+1
While reviewing a patch sent to the mailing list, I noticed there are few places where python code checks if a variable is 'None' or not by using the comparison operators '==' and '!='. PEP8[1], which is used as coding standard in GDB coding standards, recommends using 'is' / 'is not' when comparing to a singleton such as 'None'. This patch proposes to change the instances of '== None' by 'is None' and '!= None' by 'is not None'. [1] https://www.python.org/dev/peps/pep-0008/ gdb/doc/ChangeLog: * python.texi (Writing a Pretty-Printer): Use 'is None' instead of '== None'. gdb/ChangeLog: * python/lib/gdb/FrameDecorator.py (FrameDecorator): Use 'is None' instead of '== None'. (FrameVars): Use 'is not None' instead of '!= None'. * python/lib/gdb/command/frame_filters.py (SetFrameFilterPriority): Use 'is None' instead of '== None' and 'is not None' instead of '!= None'. gdb/testsuite/ChangeLog: * gdb.base/premature-dummy-frame-removal.py (TestUnwinder): Use 'is None' instead of '== None' and 'is not None' instead of '!= None'. * gdb.python/py-frame-args.py (lookup_function): Same. * gdb.python/py-framefilter-invalidarg.py (Reverse_Function): Same. * gdb.python/py-framefilter.py (Reverse_Function): Same. * gdb.python/py-nested-maps.py (lookup_function): Same. * gdb.python/py-objfile-script-gdb.py (lookup_function): Same. * gdb.python/py-prettyprint.py (lookup_function): Same. * gdb.python/py-section-script.py (lookup_function): Same. * gdb.python/py-unwind-inline.py (dummy_unwinder): Same. * gdb.python/python.exp: Same. * gdb.rust/pp.py (lookup_function): Same.
2021-02-08gdb/python: reformat an error stringAndrew Burgess1-1/+1
While working on another patch I noticed an oddly formatted error message in the Python code. When 'set python print-stack message' is in effect then consider this Python script: class TestCommand (gdb.Command): def __init__ (self): gdb.Command.__init__ (self, "test-cmd", gdb.COMMAND_DATA) def invoke(self, args, from_tty): raise RuntimeError ("bad") TestCommand () And this GDB session: (gdb) source path/to/python/script.py (gdb) test-cmd Python Exception <class 'RuntimeError'> bad: Error occurred in Python: bad The line 'Python Exception <class 'RuntimeError'> bad:' doesn't look terrible in this situation, the colon at the end of the first line makes sense given the second line. However, there are places in GDB where there is no second line printed, for example consider this python script: def stop_listener (e): raise RuntimeError ("bad") gdb.events.stop.connect (stop_listener) Then this GDB session: (gdb) file helloworld.exe (gdb) start Temporary breakpoint 1 at 0x40112a: file hello.c, line 6. Starting program: helloworld.exe Temporary breakpoint 1, main () at hello.c:6 6 printf ("Hello World\n"); Python Exception <class 'RuntimeError'> bad: (gdb) si 0x000000000040112f 6 printf ("Hello World\n"); Python Exception <class 'RuntimeError'> bad: In this case there is no auxiliary information displayed after the warning, and the line ending in the colon looks weird to me. A quick survey of the code seems to indicate that it is not uncommon for there to be no auxiliary information line printed, its not just the one case I found above. I propose that the line that currently looks like this: Python Exception <class 'RuntimeError'> bad: Be reformatted like this: Python Exception <class 'RuntimeError'>: bad I think this looks fine then in either situation. The first now looks like this: (gdb) test-cmd Python Exception <class 'RuntimeError'>: bad Error occurred in Python: bad And the second like this: (gdb) si 0x000000000040112f 6 printf ("Hello World\n"); Python Exception <class 'RuntimeError'>: bad There's just two tests that needed updating. Errors are checked for in many more tests, but most of the time the pattern doesn't care about the colon. gdb/ChangeLog: * python/python.c (gdbpy_print_stack): Reformat an error message. gdb/testsuite/ChangeLog: * gdb.python/py-framefilter.exp: Update expected results. * gdb.python/python.exp: Update expected results.
2021-01-01Update copyright year range in all GDB filesJoel Brobecker1-1/+1
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-09-26gdb: Fix from_tty argument to gdb.execute in Python.Gareth Rees1-0/+13
Prior to commit 56bcdbea2b, the from_tty keyword argument to the Python function gdb.execute controlled whether the command took input from the terminal. When from_tty=True, "starti" and similar commands prompted the user: (gdb) python gdb.execute("starti", from_tty=True) The program being debugged has been started already. Start it from the beginning? (y or n) y Starting program: /bin/true Program stopped. When from_tty=False, these commands did not prompt the user, and "yes" was assumed: (gdb) python gdb.execute("starti", from_tty=False) Program stopped. However, after commit 56bcdbea2b, the from_tty keyword argument no longer had this effect. For example, as of commit 7ade7fba75: (gdb) python gdb.execute("starti", from_tty=True) The program being debugged has been started already. Start it from the beginning? (y or n) [answered Y; input not from terminal] Starting program: /bin/true Program stopped. Note the "[answered Y; input not from terminal]" in the output even though from_tty=True was requested. Looking at commit 56bcdbea2b, it seems that the behaviour of the from_tty argument was changed accidentally. The commit message said: Let gdb.execute handle multi-line commands This changes the Python API so that gdb.execute can now handle multi-line commands, like "commands" or "define". and there was no mention of changing the effect of the from_tty argument. It looks as though the code for setting the instream to nullptr was accidentally moved from execute_user_command() to execute_control_commands() along with the other scoped restores. Accordingly, the simplest way to fix this is to partially reverse commit 56bcdbea2b by moving the code for setting the instream to nullptr back to execute_user_command() where it was to begin with. Additionally, add a test case to reduce the risk of similar breakage in future. gdb/ChangeLog: PR python/26586 * cli/cli-script.c (execute_control_commands): don't set instream to nullptr here as this breaks the from_tty argument to gdb.execute in Python. (execute_user_command): set instream to nullptr here instead. gdb/testsuite/ChangeLog: PR python/26586 * gdb.python/python.exp: add test cases for the from_tty argument to gdb.execute.
2020-06-26Make test names unique in python.exp and guile.expPhilippe Waroquiers1-56/+62
Version 2, handles the comments of Simon and Pedro. Note that gdb_test_multiline and gdb_py_test_multiple are using the "input line" as the test name, and so when there is a duplicated input line (such as a line containing "end"), we have duplicated test names => as gdb_test_multiline and gdb_py_test_multiple are identical, as indicated in FIXME, move this to gdb.exp, and make the test name unique by adding the inputnr to the pass message for each input. 2020-06-26 Philippe Waroquiers <philippe.waroquiers@skynet.be> * lib/gdb.exp (gdb_test_multiline): New, moved from gdb-guile.exp, have a input seq nr in each pass message. * lib/gdb-guile.exp (gdb_test_multiline): Move to gdb.exp. * lib/gdb-python.exp (gdb_py_test_multiple): Remove. * gdb.python/python.exp: Make test names unique, use gdb_test_multiline instead of gdb_py_test_multiple, use $gdb_test_name. * gdb.guile/guile.exp: Make test names unique, use $gdb_test_name
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-01-14Fix valgrind error from gdb.decode_lineTom Tromey1-0/+4
PR symtab/12535 points out that gdb.decode_line("") will cause a valgrind report. I think the empty linespec does not really make sense. So, this patch changes gdb.decode_line to treat a whitespace-only linespec the same as a non-existing argument. gdb/ChangeLog 2020-01-14 Tom Tromey <tom@tromey.com> PR symtab/12535: * python/python.c (gdbpy_decode_line): Treat empty string the same as no argument. gdb/testsuite/ChangeLog 2020-01-14 Tom Tromey <tom@tromey.com> PR symtab/12535: * gdb.python/python.exp: Test decode_line with empty string argument. Change-Id: I1d95812b4b7a21d69a3e9afd05b9e3141a931897
2020-01-01Update copyright year range in all GDB files.Joel Brobecker1-1/+1
gdb/ChangeLog: Update copyright year range in all GDB files.
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-08-15Rename internal Python functions to start with an underscoreChristian Biesinger1-2/+2
I could not tell if GdbSetPythonDirectory is internal or not because I could not find any references to it, so I left it as-is. Tested by running the testsuite on gdb.python/*.exp; everything still passes. 2019-08-15 Christian Biesinger <cbiesinger@google.com> * python/lib/gdb/__init__.py (GdbOutputFile): Rename to have a leading underscore. (GdbOutputErrorFile): Likewise. (global scope): Adjust constructor calls to GdbOutput{,Error}File accordingly. (execute_unwinders): Rename to have a leading underscore. (auto_load_packages): Likewise. (global scope): Adjust call to auto_load_packages accordingly. (GdbSetPythonDirectory): Likewise. * python/py-unwind.c (pyuw_sniffer): Call _execute_unwinders instead of execute_unwinders. gdb/testsuite/ChangeLog: 2019-08-15 Christian Biesinger <cbiesinger@google.com> * gdb.python/python.exp: Expect a leading underscore on GdbOutput{,Error}File.
2019-07-29[gdb/testsuite] Fix python.exp with check-read1Tom de Vries1-2/+2
when running python/python.exp with check-read1, we get: ... (gdb) PASS: gdb.python/python.exp: prompt substitution readline - end python gdb.prompt_hook = error_prompt^M Python Exception <type 'exceptions.RuntimeError'> Python exception calledPASS: gdb.python/python.exp: set hook : ^M (gdb) PASS: gdb.python/python.exp: set the hook to default python gdb.prompt_hook = None^M (gdb) PASS: gdb.python/python.exp: set print-stack full for prompt error test set python print-stack full^M (gdb) FAIL: gdb.python/python.exp: set the hook python gdb.prompt_hook = error_prompt^M Traceback (most recent call last):^M File "<string>", line 3, in error_prompt^M RuntimeError: Python exception called^M (gdb) FAIL: gdb.python/python.exp: set the hook to default ... The problem is that gdb_test_multiple here: ... gdb_test_multiple "python gdb.prompt_hook = error_prompt" "set the hook" { -re "Python Exception (exceptions.RuntimeError|<(type 'exceptions.|class ')RuntimeError'>) Python excepti on called.*" { pass "set hook" } } ... specifies a regexp that ends with ".*" but doesn't specify the expected $gdb_prompt. Consequently, due to check-read1, the ".*" is matched to "" and the remaining $gdb_prompt is read by the the following gdb_py_test_silent_cmd, which has its own $gdb_prompt read by the following gdb_py_test_silent_cmd, which has its own $gdb_prompt causing a mismatch for the following gdb_test_multiple: ... gdb_test_multiple "python gdb.prompt_hook = error_prompt" "set the hook" { -re "Traceback.*File.*line.*RuntimeError.*Python exception called.*" { pass "set hook" } } ... which causes both FAILs. The second gdb_test_multiple has the same problem as the first, but it happens not to cause a FAIL because it's followed by a gdb_py_test_silent_cmd and a clean_restart. Fix the regexps in both gdb_test_multiple calls. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-07-29 Tom de Vries <tdevries@suse.de> * gdb.python/python.exp: Don't terminate gdb_test_multiple regexp with ".*".
2019-05-17testsuite: Disable some tests when loggingAlan Hayward1-1/+4
Fix up all failures encountered when running the testsuite with GDB_DEBUG="infrun". Some tests rely on enabling debugging for various components. With debugging on, this will be lost to the debug file. Disable separate tty for mi tests when debugging. This currently does not work. disasm.c should send errors to the stderr instead of the logfile. Note that enabling debug for other components might still cause additional errors above what has been fixed here. gdb/ChangeLog: * disasm.c (set_disassembler_options): Send errors to stderr. gdb/testsuite/ChangeLog: * gdb.base/breakpoint-in-ro-region.exp: Disable when debugging. * gdb.base/debug-expr.exp: Likewise. * gdb.base/foll-fork.exp: Likewise. * gdb.base/foll-vfork.exp: Likewise. * gdb.base/fork-print-inferior-events.exp: Likewise. * gdb.base/gdb-sigterm.exp: Likewise. * gdb.base/gdbinit-history.exp: Likewise. * gdb.base/osabi.exp: Likewise. * gdb.base/sss-bp-on-user-bp-2.exp: Likewise. * gdb.base/ui-redirect.exp: Likewise. * gdb.gdb/unittest.exp: Likewise. * gdb.mi/mi-break.exp: Disable separate-mi-tty when debugging. * gdb.mi/mi-watch.exp: Likewise. * gdb.mi/new-ui-mi-sync.exp: Likewise. * gdb.mi/user-selected-context-sync.exp: Likewise. * gdb.python/python.exp: Disable debug test when debugging. * gdb.threads/check-libthread-db.exp: Disable when debugging. * gdb.threads/signal-while-stepping-over-bp-other-thread.exp: Likewise. * gdb.threads/stepi-random-signal.exp: Likewise.
2019-01-01Update copyright year range in all GDB files.Joel Brobecker1-1/+1
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-11-21Make command-repeat work after gdb.executeBenno Fünfstück1-0/+1
Since commit 56bcdbea2bed ("Let gdb.execute handle multi-line commands") command repetition after using the `gdb.execute` Python function fails (the previous command is not repeated anymore). This happens because read_command_lines_1 sets dont_repeat, but the call to prevent_dont_repeat in execute_gdb_command is later. The fix is to move the call to prevent_dont_repeat to the beginning of the function. Tested on my laptop (ArchLinux-x86_64). gdb/ChangeLog: PR python/23714 * gdb/python/python.c (execute_gdb_command): Call prevent_dont_repeat earlier to avoid affecting dont_repeat. gdb/testuite/ChangeLog: PR python/23714 * gdb.python/python.exp: Test command repetition after gdb.execute.
2018-09-23Report Python errors coming from gdb.post_eventTom Tromey1-1/+12
PR python/14062 points out that errors coming from the gdb.post_event callback are not reported. This can make it hard to understand why your Python code in gdb isn't working. Because users have control over whether exceptions are printed at all, it seems good to simply have post_event report errors in the usual way. 2018-09-23 Tom Tromey <tom@tromey.com> PR python/14062: * python/python.c (gdbpy_run_events): Do not ignore exceptions. gdb/testsuite/ChangeLog 2018-09-23 Tom Tromey <tom@tromey.com> PR python/14062: * gdb.python/python.exp: Add test for post_event error.
2018-09-17python: Make gdb.execute("show commands") work (PR 23669)Simon Marchi1-0/+4
Since commit 56bcdbea2bed ("Let gdb.execute handle multi-line commands") trying to use a command like gdb.execute("show commands") in Python fails. GDB ends up trying to run the "commands" command. The reason is that GDB gets confused with the special "commands" command. In process_next_line, the lookup_cmd_1 function returns the cmd_list_element representing the "commands" sub-command of "show". Lower, we check the cmd_list_element to see if it matches various control commands by name, including the "commands" command. This is where we wrongfully conclude that the executed command must be "commands", when in reality it was "show commands". The fix proposed in this patch removes the comparisons by name, instead comparing the cmd_list_element object by pointer with the objects created at initialization time. Tested on the buildbot, though on a single builder (Fedora-x86_64-m64). gdb/ChangeLog: PR python/23669 * breakpoint.c (commands_cmd_element): New. (_initialize_breakpoint): Assign commands_cmd_element. * breakpoint.h (commands_cmd_element): New. * cli/cli-script.c (while_cmd_element, if_command, define_cmd_element): New. (command_name_equals): Remove. (process_next_line): Compare commands by pointer, not by name. (_initialize_cli_script): Assign the various cmd_list_element variables. * compile/compile.c (compile_cmd_element): New. (_initialize_compile): Assign compile_cmd_element. * compile/compile.h (compile_cmd_element): New. * guile/guile.c (guile_cmd_element): New. (install_gdb_commands): Assign guile_cmd_element. * guile/guile.h (guile_cmd_element): New. * python/python.c (python_cmd_element): New. (_initialize_python): Assign python_cmd_element. * python/python.h (python_cmd_element): New. * tracepoint.c (while_stepping_cmd_element): New. (_initialize_tracepoint): Assign while_stepping_cmd_element. * tracepoint.h (while_stepping_cmd_element): New. gdb/testsuite/ChangeLog: PR python/23669 * gdb.python/python.exp: Test gdb.execute("show commands").
2018-06-05Add "continue" response to pagerTom Tromey1-6/+6
This adds a "continue" response to the pager. If the user types "c" in response to the pager prompt, pagination will be disabled for the duration of one command -- but re-enabled afterward. This is handy if you type a command that produces a lot of output, and you don't want to baby-sit it by typing "return" each time the prompt comes up. Tested by the buildbot. gdb/ChangeLog 2018-06-05 Tom Tromey <tom@tromey.com> PR cli/12326: * NEWS: Add entry about pager. * utils.c (pagination_disabled_for_command): New global. (prompt_for_continue): Allow "c" response to prompt. (reinitialize_more_filter): Clear pagination_disabled_for_command. (fputs_maybe_filtered): Check pagination_disabled_for_command. gdb/doc/ChangeLog 2018-06-05 Tom Tromey <tom@tromey.com> PR cli/12326: * gdb.texinfo (Screen Size): Document "c" response to pagination prompt. gdb/testsuite/ChangeLog 2018-06-05 Tom Tromey <tom@tromey.com> PR cli/12326: * gdb.cp/static-print-quit.exp: Update. * lib/gdb.exp (pagination_prompt): Update. * gdb.base/page.exp: Use pagination_prompt. Add new tests. * gdb.python/python.exp: Update.
2018-05-31Add basic Python API for convenience variablesTom Tromey1-0/+20
This adds a basic Python API for accessing convenience variables. With this, convenience variables can be read and set from Python. Although gdb supports convenience variables whose value changes at each call, this is not exposed to Python; it could be, but I think it's just as good to write a convenience function in this situation. This is PR python/23080. Tested on x86-64 Fedora 26. 2018-04-22 Tom Tromey <tom@tromey.com> PR python/23080: * NEWS: Update for new functions. * python/py-value.c (gdbpy_set_convenience_variable) (gdbpy_convenience_variable): New functions. * python/python-internal.h (gdbpy_convenience_variable) (gdbpy_set_convenience_variable): Declare. * python/python.c (python_GdbMethods): Add convenience_variable, set_convenience_variable. doc/ChangeLog 2018-04-22 Tom Tromey <tom@tromey.com> PR python/23080: * python.texi (Basic Python): Document gdb.convenience_variable, gdb.set_convenience_variable. testsuite/ChangeLog 2018-04-22 Tom Tromey <tom@tromey.com> PR python/23080: * gdb.python/python.exp: Add convenience variable tests.
2018-05-04Let gdb.execute handle multi-line commandsTom Tromey1-0/+3
This changes the Python API so that gdb.execute can now handle multi-line commands, like "commands" or "define". ChangeLog 2018-05-04 Tom Tromey <tom@tromey.com> PR python/22730: * NEWS: Mention gdb.execute change. * gdbcmd.h (execute_control_command): Don't declare. * python/python.c (execute_gdb_command): Use read_command_lines_1, execute_control_commands, execute_control_commands_to_string. * cli/cli-script.h (execute_control_commands) (execute_control_commands_to_string): Declare. (execute_control_command): Add from_tty parameter. * cli/cli-script.c (execute_control_commands) (execute_control_commands_to_string): New functions. (execute_user_command): Use execute_control_commands. (execute_control_command_1): Add "from_tty" parameter. Update. (execute_control_command): Likewise. testsuite/ChangeLog 2018-05-04 Tom Tromey <tom@tromey.com> PR python/22730: * gdb.python/python.exp: Test multi-line execute.
2018-01-02Update copyright year range in all GDB filesJoel Brobecker1-1/+1
gdb/ChangeLog: Update copyright year range in all GDB files
2017-01-20Make gdb.python/python.exp more robustLuis Machado1-1/+15
I noticed gdb.python/python.exp failing on aarch64-elf like so: FAIL: gdb.python/python.exp: Test decode_line func1 line number This particular test expects the line number for func1 to be 19, hardcoded. In my aarch64-elf tests gdb thinks func1 is at line 20, making the test fail. The following patch addresses this by reading the line number information from GDB and comparing it against the python decoded symtab information. gdb/testsuite/ChangeLog: 2017-01-20 Luis Machado <lgustavo@codesourcery.com> * gdb.python/python.exp: Check line number against what GDB thinks the line number is for func1.
2017-01-01update copyright year range in GDB filesJoel Brobecker1-1/+1
This applies the second part of GDB's End of Year Procedure, which updates the copyright year range in all of GDB's files. gdb/ChangeLog: Update copyright year range in all GDB files.
2016-12-01Fix test names starting with uppercase using multi-line gdb_test/mi_gdb_testLuis Machado1-1/+1
This fixes offender testcases that have test names starting with uppercase when using gdb_test/mi_gdb_test in a multi-line construct. gdb/testsuite/ChangeLog 2016-12-01 Luis Machado <lgustavo@codesourcery.com> Fix test names starting with uppercase throughout the files. * gdb.ada/array_return.exp * gdb.ada/expr_delims.exp * gdb.ada/mi_dyn_arr.exp * gdb.ada/mi_interface.exp * gdb.ada/mi_var_array.exp * gdb.ada/watch_arg.exp * gdb.arch/alpha-step.exp * gdb.arch/altivec-regs.exp * gdb.arch/e500-regs.exp * gdb.arch/powerpc-d128-regs.exp * gdb.base/arrayidx.exp * gdb.base/break.exp * gdb.base/checkpoint.exp * gdb.base/debug-expr.exp * gdb.base/dmsym.exp * gdb.base/radix.exp * gdb.base/sepdebug.exp * gdb.base/testenv.exp * gdb.base/watch_thread_num.exp * gdb.base/watchpoint-cond-gone.exp * gdb.cell/break.exp * gdb.cell/ea-cache.exp * gdb.compile/compile.exp * gdb.cp/gdb2495.exp * gdb.gdb/selftest.exp * gdb.gdb/xfullpath.exp * gdb.go/hello.exp * gdb.go/integers.exp * gdb.objc/basicclass.exp * gdb.pascal/hello.exp * gdb.pascal/integers.exp * gdb.python/py-breakpoint.exp * gdb.python/py-cmd.exp * gdb.python/py-linetable.exp * gdb.python/py-xmethods.exp * gdb.python/python.exp * gdb.reverse/consecutive-precsave.exp * gdb.reverse/finish-precsave.exp * gdb.reverse/i386-precsave.exp * gdb.reverse/machinestate-precsave.exp * gdb.reverse/sigall-precsave.exp * gdb.reverse/solib-precsave.exp * gdb.reverse/step-precsave.exp * gdb.reverse/until-precsave.exp * gdb.reverse/watch-precsave.exp * gdb.threads/leader-exit.exp * gdb.threads/pthreads.exp * gdb.threads/wp-replication.exp * gdb.trace/actions.exp * gdb.trace/mi-tsv-changed.exp * gdb.trace/tsv.exp
2016-12-01Fix test names starting with uppercase using gdb_test_multipleLuis Machado1-1/+1
This fixes offender testcases that have test names starting with uppercase when using gdb_test_multiple in a single-line construct. gdb/testsuite/ChangeLog 2016-12-01 Luis Machado <lgustavo@codesourcery.com> Fix test names starting with uppercase throughout the files. * gdb.arch/i386-bp_permanent.exp * gdb.arch/i386-gnu-cfi.exp * gdb.base/disasm-end-cu.exp * gdb.base/macscp.exp * gdb.base/pending.exp * gdb.base/watch_thread_num.exp * gdb.cp/exception.exp * gdb.cp/gdb2495.exp * gdb.cp/local.exp * gdb.python/py-evsignal.exp * gdb.python/python.exp * gdb.trace/tracecmd.exp
2016-12-01Fix test names starting with uppercase using gdb_test on a single line.Luis Machado1-29/+29
Changes in v3: Fixed incorrect substitutions. This fixes offender testcases that have test names starting with uppercase when using gdb_test in a single line construct. gdb/testsuite/ChangeLog 2016-12-01 Luis Machado <lgustavo@codesourcery.com> Fix test names starting with uppercase throughout the files. * gdb.arch/i386-mpx-simple_segv.exp * gdb.arch/i386-mpx.exp * gdb.arch/i386-permbkpt.exp * gdb.arch/pa-nullify.exp * gdb.arch/powerpc-d128-regs.exp * gdb.arch/vsx-regs.exp * gdb.base/bfp-test.exp * gdb.base/break.exp * gdb.base/breakpoint-shadow.exp * gdb.base/callfuncs.exp * gdb.base/charset.exp * gdb.base/commands.exp * gdb.base/completion.exp * gdb.base/dfp-test.exp * gdb.base/echo.exp * gdb.base/ending-run.exp * gdb.base/eval.exp * gdb.base/expand-psymtabs.exp * gdb.base/float128.exp * gdb.base/floatn.exp * gdb.base/foll-exec-mode.exp * gdb.base/gdb1056.exp * gdb.base/gdb11531.exp * gdb.base/kill-after-signal.exp * gdb.base/multi-forks.exp * gdb.base/overlays.exp * gdb.base/pending.exp * gdb.base/sepdebug.exp * gdb.base/testenv.exp * gdb.base/valgrind-db-attach.exp * gdb.base/watch_thread_num.exp * gdb.base/watchpoint-cond-gone.exp * gdb.base/watchpoint.exp * gdb.base/watchpoints.exp * gdb.cp/arg-reference.exp * gdb.cp/baseenum.exp * gdb.cp/operator.exp * gdb.cp/shadow.exp * gdb.dwarf2/dw2-op-out-param.exp * gdb.dwarf2/dw2-reg-undefined.exp * gdb.go/chan.exp * gdb.go/hello.exp * gdb.go/integers.exp * gdb.go/methods.exp * gdb.go/package.exp * gdb.guile/scm-parameter.exp * gdb.guile/scm-progspace.exp * gdb.guile/scm-value.exp * gdb.mi/mi-pending.exp * gdb.mi/user-selected-context-sync.exp * gdb.multi/multi-attach.exp * gdb.multi/tids.exp * gdb.opt/clobbered-registers-O2.exp * gdb.pascal/floats.exp * gdb.pascal/integers.exp * gdb.python/py-block.exp * gdb.python/py-events.exp * gdb.python/py-parameter.exp * gdb.python/py-symbol.exp * gdb.python/py-symtab.exp * gdb.python/py-type.exp * gdb.python/py-value.exp * gdb.python/py-xmethods.exp * gdb.python/python.exp * gdb.reverse/break-precsave.exp * gdb.reverse/consecutive-precsave.exp * gdb.reverse/finish-precsave.exp * gdb.reverse/i386-precsave.exp * gdb.reverse/machinestate-precsave.exp * gdb.reverse/sigall-precsave.exp * gdb.reverse/solib-precsave.exp * gdb.reverse/step-precsave.exp * gdb.reverse/until-precsave.exp * gdb.reverse/watch-precsave.exp * gdb.server/ext-attach.exp * gdb.server/ext-restart.exp * gdb.server/ext-run.exp * gdb.server/ext-wrapper.exp * gdb.stabs/gdb11479.exp * gdb.stabs/weird.exp * gdb.threads/attach-many-short-lived-threads.exp * gdb.threads/kill.exp * gdb.threads/watchpoint-fork.exp
2016-12-01Fix test names starting with uppercase output by basic functionsLuis Machado1-4/+4
The following patch is based on the previous patch i sent and handles cases of test names that start with an uppercase letter. Test names should start with lowercase unless it starts with the name of a technology, architecture, ISA etc. This first patch addresses cases of test names output explicitly via xfail, kfail, kpass, fail, pass, unsupported, untested and also names set with the pattern "set test" and "set testname". gdb/testsuite/ChangeLog: 2016-12-01 Luis Machado <lgustavo@codesourcery.com> Fix test names starting with uppercase throughout all the files below. * gdb.ada/array_return.exp * gdb.ada/catch_ex.exp * gdb.ada/info_exc.exp * gdb.ada/mi_catch_ex.exp * gdb.ada/mi_dyn_arr.exp * gdb.ada/mi_ex_cond.exp * gdb.ada/mi_exc_info.exp * gdb.ada/mi_interface.exp * gdb.ada/mi_task_arg.exp * gdb.ada/mi_task_info.exp * gdb.ada/mi_var_array.exp * gdb.arch/alpha-step.exp * gdb.arch/amd64-disp-step.exp * gdb.arch/arm-disp-step.exp * gdb.arch/disp-step-insn-reloc.exp * gdb.arch/e500-prologue.exp * gdb.arch/ftrace-insn-reloc.exp * gdb.arch/gdb1558.exp * gdb.arch/i386-bp_permanent.exp * gdb.arch/i386-disp-step.exp * gdb.arch/i386-float.exp * gdb.arch/i386-gnu-cfi.exp * gdb.arch/ia64-breakpoint-shadow.exp * gdb.arch/mips16-thunks.exp * gdb.arch/pa-nullify.exp * gdb.arch/powerpc-aix-prologue.exp * gdb.arch/powerpc-power.exp * gdb.arch/ppc-dfp.exp * gdb.arch/s390-tdbregs.exp * gdb.arch/spu-info.exp * gdb.arch/spu-ls.exp * gdb.arch/thumb-bx-pc.exp * gdb.base/advance.exp * gdb.base/annota-input-while-running.exp * gdb.base/arrayidx.exp * gdb.base/asmlabel.exp * gdb.base/async.exp * gdb.base/attach-wait-input.exp * gdb.base/auto-connect-native-target.exp * gdb.base/batch-preserve-term-settings.exp * gdb.base/bfp-test.exp * gdb.base/bigcore.exp * gdb.base/bp-permanent.exp * gdb.base/break-always.exp * gdb.base/break-fun-addr.exp * gdb.base/break-idempotent.exp * gdb.base/break-main-file-remove-fail.exp * gdb.base/break-probes.exp * gdb.base/break-unload-file.exp * gdb.base/break.exp * gdb.base/call-ar-st.exp * gdb.base/call-rt-st.exp * gdb.base/call-sc.exp * gdb.base/call-signal-resume.exp * gdb.base/call-strs.exp * gdb.base/callexit.exp * gdb.base/callfuncs.exp * gdb.base/catch-gdb-caused-signals.exp * gdb.base/catch-signal-siginfo-cond.exp * gdb.base/catch-syscall.exp * gdb.base/compare-sections.exp * gdb.base/cond-eval-mode.exp * gdb.base/condbreak-call-false.exp * gdb.base/consecutive-step-over.exp * gdb.base/cursal.exp * gdb.base/disabled-location.exp * gdb.base/disasm-end-cu.exp * gdb.base/display.exp * gdb.base/double-prompt-target-event-error.exp * gdb.base/dprintf-bp-same-addr.exp * gdb.base/dprintf-detach.exp * gdb.base/dprintf-next.exp * gdb.base/dprintf-non-stop.exp * gdb.base/dprintf-pending.exp * gdb.base/dso2dso.exp * gdb.base/ending-run.exp * gdb.base/enum_cond.exp * gdb.base/examine-backward.exp * gdb.base/exe-lock.exp * gdb.base/exec-invalid-sysroot.exp * gdb.base/execl-update-breakpoints.exp * gdb.base/execution-termios.exp * gdb.base/fileio.exp * gdb.base/fixsection.exp * gdb.base/foll-exec-mode.exp * gdb.base/foll-exec.exp * gdb.base/fork-running-state.exp * gdb.base/frame-args.exp * gdb.base/fullpath-expand.exp * gdb.base/func-ptr.exp * gdb.base/gcore-relro-pie.exp * gdb.base/gdb1090.exp * gdb.base/gdb1555.exp * gdb.base/global-var-nested-by-dso.exp * gdb.base/gnu-ifunc.exp * gdb.base/hbreak-in-shr-unsupported.exp * gdb.base/hbreak-unmapped.exp * gdb.base/hook-stop.exp * gdb.base/infcall-input.exp * gdb.base/info-fun.exp * gdb.base/info-shared.exp * gdb.base/interrupt-noterm.exp * gdb.base/jit-so.exp * gdb.base/jit.exp * gdb.base/line-symtabs.exp * gdb.base/list.exp * gdb.base/longjmp.exp * gdb.base/macscp.exp * gdb.base/max-value-size.exp * gdb.base/nodebug.exp * gdb.base/nofield.exp * gdb.base/overlays.exp * gdb.base/paginate-after-ctrl-c-running.exp * gdb.base/paginate-bg-execution.exp * gdb.base/paginate-inferior-exit.exp * gdb.base/pending.exp * gdb.base/pr11022.exp * gdb.base/printcmds.exp * gdb.base/ptr-typedef.exp * gdb.base/ptype.exp * gdb.base/randomize.exp * gdb.base/range-stepping.exp * gdb.base/realname-expand.exp * gdb.base/relativedebug.exp * gdb.base/remote.exp * gdb.base/savedregs.exp * gdb.base/sepdebug.exp * gdb.base/set-noassign.exp * gdb.base/shlib-call.exp * gdb.base/shreloc.exp * gdb.base/sigaltstack.exp * gdb.base/sigbpt.exp * gdb.base/siginfo-addr.exp * gdb.base/siginfo-obj.exp * gdb.base/siginfo-thread.exp * gdb.base/signest.exp * gdb.base/signull.exp * gdb.base/sigrepeat.exp * gdb.base/skip.exp * gdb.base/so-impl-ld.exp * gdb.base/solib-corrupted.exp * gdb.base/solib-disc.exp * gdb.base/solib-display.exp * gdb.base/solib-overlap.exp * gdb.base/solib-search.exp * gdb.base/solib-symbol.exp * gdb.base/source-execution.exp * gdb.base/sss-bp-on-user-bp-2.exp * gdb.base/sss-bp-on-user-bp.exp * gdb.base/stack-checking.exp * gdb.base/stale-infcall.exp * gdb.base/step-break.exp * gdb.base/step-line.exp * gdb.base/step-over-exit.exp * gdb.base/step-test.exp * gdb.base/structs.exp * gdb.base/sym-file.exp * gdb.base/symtab-search-order.exp * gdb.base/term.exp * gdb.base/type-opaque.exp * gdb.base/unload.exp * gdb.base/until-nodebug.exp * gdb.base/until.exp * gdb.base/unwindonsignal.exp * gdb.base/watch-cond.exp * gdb.base/watch-non-mem.exp * gdb.base/watch_thread_num.exp * gdb.base/watchpoint-reuse-slot.exp * gdb.base/watchpoint-solib.exp * gdb.base/watchpoint.exp * gdb.btrace/dlopen.exp * gdb.cell/arch.exp * gdb.cell/break.exp * gdb.cell/bt.exp * gdb.cell/core.exp * gdb.cell/data.exp * gdb.cell/dwarfaddr.exp * gdb.cell/ea-cache.exp * gdb.cell/ea-standalone.exp * gdb.cell/ea-test.exp * gdb.cell/f-regs.exp * gdb.cell/fork.exp * gdb.cell/gcore.exp * gdb.cell/mem-access.exp * gdb.cell/ptype.exp * gdb.cell/registers.exp * gdb.cell/sizeof.exp * gdb.cell/solib-symbol.exp * gdb.cell/solib.exp * gdb.compile/compile-tls.exp * gdb.cp/exception.exp * gdb.cp/gdb2495.exp * gdb.cp/local.exp * gdb.cp/mb-inline.exp * gdb.cp/mb-templates.exp * gdb.cp/pr10687.exp * gdb.cp/pr9167.exp * gdb.cp/scope-err.exp * gdb.cp/templates.exp * gdb.cp/virtfunc.exp * gdb.dwarf2/dw2-dir-file-name.exp * gdb.dwarf2/dw2-single-line-discriminators.exp * gdb.fortran/complex.exp * gdb.fortran/library-module.exp * gdb.guile/guile.exp * gdb.guile/scm-cmd.exp * gdb.guile/scm-frame-inline.exp * gdb.guile/scm-objfile.exp * gdb.guile/scm-pretty-print.exp * gdb.guile/scm-symbol.exp * gdb.guile/scm-type.exp * gdb.guile/scm-value.exp * gdb.linespec/keywords.exp * gdb.linespec/ls-errs.exp * gdb.linespec/macro-relative.exp * gdb.linespec/thread.exp * gdb.mi/mi-breakpoint-changed.exp * gdb.mi/mi-dprintf-pending.exp * gdb.mi/mi-fullname-deleted.exp * gdb.mi/mi-logging.exp * gdb.mi/mi-pending.exp * gdb.mi/mi-solib.exp * gdb.mi/new-ui-mi-sync.exp * gdb.mi/user-selected-context-sync.exp * gdb.multi/dummy-frame-restore.exp * gdb.multi/multi-arch-exec.exp * gdb.multi/remove-inferiors.exp * gdb.multi/watchpoint-multi-exit.exp * gdb.opt/solib-intra-step.exp * gdb.perf/backtrace.exp * gdb.perf/single-step.exp * gdb.perf/skip-command.exp * gdb.perf/skip-prologue.exp * gdb.perf/solib.exp * gdb.python/lib-types.exp * gdb.python/py-as-string.exp * gdb.python/py-bad-printers.exp * gdb.python/py-block.exp * gdb.python/py-breakpoint.exp * gdb.python/py-cmd.exp * gdb.python/py-events.exp * gdb.python/py-evthreads.exp * gdb.python/py-finish-breakpoint.exp * gdb.python/py-finish-breakpoint2.exp * gdb.python/py-frame-inline.exp * gdb.python/py-frame.exp * gdb.python/py-inferior.exp * gdb.python/py-infthread.exp * gdb.python/py-mi.exp * gdb.python/py-objfile.exp * gdb.python/py-pp-maint.exp * gdb.python/py-pp-registration.exp * gdb.python/py-prettyprint.exp * gdb.python/py-recurse-unwind.exp * gdb.python/py-shared.exp * gdb.python/py-symbol.exp * gdb.python/py-symtab.exp * gdb.python/py-template.exp * gdb.python/py-type.exp * gdb.python/py-unwind-maint.exp * gdb.python/py-unwind.exp * gdb.python/py-value.exp * gdb.python/python.exp * gdb.reverse/finish-reverse-bkpt.exp * gdb.reverse/insn-reverse.exp * gdb.reverse/next-reverse-bkpt-over-sr.exp * gdb.reverse/solib-precsave.exp * gdb.reverse/solib-reverse.exp * gdb.stabs/gdb11479.exp * gdb.stabs/weird.exp * gdb.threads/fork-child-threads.exp * gdb.threads/fork-plus-threads.exp * gdb.threads/fork-thread-pending.exp * gdb.threads/forking-threads-plus-breakpoint.exp * gdb.threads/hand-call-in-threads.exp * gdb.threads/interrupted-hand-call.exp * gdb.threads/linux-dp.exp * gdb.threads/local-watch-wrong-thread.exp * gdb.threads/next-while-other-thread-longjmps.exp * gdb.threads/non-ldr-exit.exp * gdb.threads/pending-step.exp * gdb.threads/print-threads.exp * gdb.threads/process-dies-while-detaching.exp * gdb.threads/process-dies-while-handling-bp.exp * gdb.threads/pthreads.exp * gdb.threads/queue-signal.exp * gdb.threads/reconnect-signal.exp * gdb.threads/signal-command-handle-nopass.exp * gdb.threads/signal-command-multiple-signals-pending.exp * gdb.threads/signal-delivered-right-thread.exp * gdb.threads/signal-sigtrap.exp * gdb.threads/sigthread.exp * gdb.threads/staticthreads.exp * gdb.threads/stepi-random-signal.exp * gdb.threads/thread-unwindonsignal.exp * gdb.threads/thread_check.exp * gdb.threads/thread_events.exp * gdb.threads/tid-reuse.exp * gdb.threads/tls-nodebug.exp * gdb.threads/tls-shared.exp * gdb.threads/tls-so_extern.exp * gdb.threads/tls.exp * gdb.threads/wp-replication.exp * gdb.trace/actions-changed.exp * gdb.trace/actions.exp * gdb.trace/backtrace.exp * gdb.trace/change-loc.exp * gdb.trace/collection.exp * gdb.trace/deltrace.exp * gdb.trace/disconnected-tracing.exp * gdb.trace/entry-values.exp * gdb.trace/ftrace-lock.exp * gdb.trace/ftrace.exp * gdb.trace/infotrace.exp * gdb.trace/mi-trace-frame-collected.exp * gdb.trace/mi-trace-unavailable.exp * gdb.trace/mi-traceframe-changed.exp * gdb.trace/mi-tracepoint-changed.exp * gdb.trace/mi-tsv-changed.exp * gdb.trace/no-attach-trace.exp * gdb.trace/packetlen.exp * gdb.trace/passc-dyn.exp * gdb.trace/passcount.exp * gdb.trace/pending.exp * gdb.trace/pr16508.exp * gdb.trace/qtro.exp * gdb.trace/range-stepping.exp * gdb.trace/read-memory.exp * gdb.trace/report.exp * gdb.trace/save-trace.exp * gdb.trace/signal.exp * gdb.trace/stap-trace.exp * gdb.trace/status-stop.exp * gdb.trace/strace.exp * gdb.trace/tfile.exp * gdb.trace/tfind.exp * gdb.trace/trace-break.exp * gdb.trace/trace-condition.exp * gdb.trace/trace-enable-disable.exp * gdb.trace/trace-mt.exp * gdb.trace/tracecmd.exp * gdb.trace/tracefile-pseudo-reg.exp * gdb.trace/tspeed.exp * gdb.trace/tstatus.exp * gdb.trace/tsv.exp * gdb.trace/unavailable.exp * gdb.trace/while-dyn.exp * gdb.trace/while-stepping.exp * lib/gdb-guile.exp * lib/gdb.exp * lib/mi-support.exp * lib/pascal.exp * lib/perftest.exp * lib/prelink-support.exp * lib/selftest-support.exp
2016-10-07python: accept address and explicit locations in gdb.decode_lineMarkus Metzger1-0/+7
The gdb.decode_line python function is documented to support the same location expressions as the "break" command. It currently expects a linespec location. Instead of creating a linespec location directly, create the location via string_to_event_location_basic.
2016-01-01GDB copyright headers update after running GDB's copyright.py script.Joel Brobecker1-1/+1
gdb/ChangeLog: Update year range in copyright notice of all files.
2015-10-26PR python/18938: source -s foo.py with foo.py a symlink to foo.notpy failsDoug Evans1-0/+13
gdb/ChangeLog: PR python/18938 * cli/cli-cmds (source_script_fron_sctream): New arg file_to_open. All callers updated. gdb/testsuite/ChangeLog: * gdb.python/python.exp: Add test for symlink from .py file to .notpy file.
2015-01-01Update year range in copyright notice of all files owned by the GDB project.Joel Brobecker1-1/+1
gdb/ChangeLog: Update year range in copyright notice of all files.
2014-12-01Fix Python help() test for Python 3Simon Marchi1-1/+1
The message displayed when using help() changed a bit with time, so this adjusts the test accordingly. gdb/testsuite/ChangeLog: * gdb.python/python.exp: Change expected reply to help().
2014-11-02Match the working directory on remote hostYao Qi1-1/+8
The test in gdb.python/python.exp tests "extended-prompt" and expects working directory is printed. However, working directory on remote host doesn't have "gdb/testsuite", so the test fails on remote host like: set extended-prompt \w ^M ^M /home/yao FAIL: gdb.python/python.exp: set extended prompt working directory (timeout) This patch is to get the working directory first, and use it to match the output of "set extended-prompt \\w ". It works for remote host and non remote host. gdb/testsuite: 2014-11-02 Yao Qi <yao@codesourcery.com> * gdb.python/python.exp: Get working directory and match the output of "set extended-prompt \\w " with it.
2014-10-29PR python/17372 - Python hangs when displaying help()Pedro Alves1-0/+16
This is more of a readline/terminal issue than a Python one. PR17372 is a regression in 7.8 caused by the fix for PR17072: commit 0017922d0292d8c374584f6100874580659c9973 Author: Pedro Alves <palves@redhat.com> Date: Mon Jul 14 19:55:32 2014 +0100 Background execution + pagination aborts readline/gdb gdb_readline_wrapper_line removes the handler after a line is processed. Usually, we'll end up re-displaying the prompt, and that reinstalls the handler. But if the output is coming out of handling a stop event, we don't re-display the prompt, and nothing restores the handler. So the next input wakes up the event loop and calls into readline, which aborts. ... gdb/ 2014-07-14 Pedro Alves <palves@redhat.com> PR gdb/17072 * top.c (gdb_readline_wrapper_line): Tweak comment. (gdb_readline_wrapper_cleanup): If readline is enabled, reinstall the input handler callback. The problem is that installing the input handler callback also preps the terminal, putting it in raw mode and with echo disabled, which is bad if we're going to call a command that assumes cooked/canonical mode, and echo enabled, like in the case of the PR, Python's interactive shell. Another example I came up with that doesn't depend on Python is starting a subshell with "(gdb) shell /bin/sh" from a multi-line command. Tests covering both these examples are added. The fix is to revert the original fix for PR gdb/17072, and instead restore the callback handler after processing an asynchronous target event. Furthermore, calling rl_callback_handler_install when we already have some input in readline's line buffer discards that input, which is obviously a bad thing to do while the user is typing. No specific test is added for that, because I first tried calling it even if the callback handler was still installed and that resulted in hundreds of failures in the testsuite. gdb/ 2014-10-29 Pedro Alves <palves@redhat.com> PR python/17372 * event-top.c (change_line_handler): Call gdb_rl_callback_handler_remove instead of rl_callback_handler_remove. (callback_handler_installed): New global. (gdb_rl_callback_handler_remove, gdb_rl_callback_handler_install) (gdb_rl_callback_handler_reinstall): New functions. (display_gdb_prompt): Call gdb_rl_callback_handler_remove and gdb_rl_callback_handler_install instead of rl_callback_handler_remove and rl_callback_handler_install. (gdb_disable_readline): Call gdb_rl_callback_handler_remove instead of rl_callback_handler_remove. * event-top.h (gdb_rl_callback_handler_remove) (gdb_rl_callback_handler_install) (gdb_rl_callback_handler_reinstall): New declarations. * infrun.c (reinstall_readline_callback_handler_cleanup): New cleanup function. (fetch_inferior_event): Install it. * top.c (gdb_readline_wrapper_line) Call gdb_rl_callback_handler_remove instead of rl_callback_handler_remove. (gdb_readline_wrapper_cleanup): Don't call rl_callback_handler_install. gdb/testsuite/ 2014-10-29 Pedro Alves <palves@redhat.com> PR python/17372 * gdb.python/python.exp: Test a multi-line command that spawns interactive Python. * gdb.base/multi-line-starts-subshell.exp: New file.
2014-10-15Fix file name matching on remote host.Yao Qi1-3/+15
I see the following fails in the remote host testing we do for mingw32 hosted GDB, python print (symtab[1][0].symtab)^M python.c^M (gdb) FAIL: gdb.python/python.exp: Test decode_line current locationn filename python print (symtab[1][0].symtab)^M python.c^M (gdb) FAIL: gdb.python/python.exp: Test decode_line python.c:26 filename The test cases doesn't consider remote host and assumes that directory on build also exists on host. In this patch, we only match file base name if host is remote, otherwise, match file with dir name. gdb/testsuite: 2014-10-15 Yao Qi <yao@codesourcery.com> * gdb.python/py-symbol.exp: Match file base name if host is remote, otherwise match file name with dir name. * gdb.python/py-symtab.exp: Likewise. * gdb.python/python.exp: Likewise.
2014-10-15Clean up gdb.python/ testsYao Qi1-3/+3
This patch is to clean up various gdb.python/*.exp tests, such as removing trailing ".*" from the pattern and fix one typo I find during reading the code. gdb/testsuite: 2014-10-15 Yao Qi <yao@codesourcery.com> * gdb.python/python.exp: Remove trailing ".*". Fix typo locationn. * gdb.python/py-symbol.exp: Remove trailing ".*" in the pattern. * gdb.python/py-symtab.exp: Likewise.