aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.python/py-inferior.exp
AgeCommit message (Collapse)AuthorFilesLines
2024-04-26gdb_is_target_native -> gdb_protocol_is_nativePedro Alves1-1/+1
gdb_is_target_native uses "maint print target-stack", which is unnecessary when checking whether gdb_protocol is empty would do. Checking gdb_protocol is more efficient, and can be done before starting GDB and running to main, unlike gdb_is_target_native. This adds a new gdb_protocol_is_native procedure, and uses it in place of gdb_is_target_native. At first, I thought that we'd end up with a few testcases needing to use gdb_is_target_native still, especially multi-target tests that connect to targets different from the default board target, but no, actually all uses of gdb_is_target_native could be converted. gdb_is_target_native will be eliminated in a following patch. In some spots, we no longer need to defer the check until after starting GDB, so the patch adjusts accordingly. Change-Id: Ia706232dbffac70f9d9740bcb89c609dbee5cee3 Approved-By: Tom Tromey <tom@tromey.com>
2024-04-18[gdb/testsuite] Use allocator_may_return_null=1 in two test-casesTom de Vries1-1/+9
Simon reported [1] that recent commit 06e967dbc9b ("[gdb/python] Throw MemoryError in inferior.read_memory if malloc fails") introduced AddressSanitizer allocation-size-too-big errors in the two test-cases affected by this commit. Fix this by suppressing the error in the two test-cases using allocator_may_return_null=1. Tested on aarch64-linux. Approved-By: Tom Tromey <tom@tromey.com> [1] https://sourceware.org/pipermail/gdb-patches/2024-April/208171.html
2024-04-16[gdb/python] Throw MemoryError in inferior.read_memory if malloc failsTom de Vries1-0/+6
PR python/31631 reports a gdb internal error when doing: ... (gdb) python gdb.selected_inferior().read_memory (0, 0xffffffffffffffff) utils.c:709: internal-error: virtual memory exhausted. A problem internal to GDB has been detected, further debugging may prove unreliable. ... Fix this by throwing a python MemoryError, such that we have instead: ... (gdb) python gdb.selected_inferior().read_memory (0, 0xffffffffffffffff) Python Exception <class 'MemoryError'>: Error occurred in Python. (gdb) ... Likewise for DAP. Tested on x86_64-linux. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31631
2024-02-27Rewrite "python" command exception handlingTom Tromey1-12/+12
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-12gdb/testsuite: fix failure in gdb.python/py-inferior.expAndrew Burgess1-13/+18
After this commit: commit 1925bba80edd37c2ef90ef1d2c599dfc2fc17f72 Date: Thu Jan 4 10:01:24 2024 +0000 gdb/python: add gdb.InferiorThread.__repr__() method failures were reported for gdb.python/py-inferior.exp. The test grabs a gdb.InferiorThread object representing an inferior thread, and then, later in the test, expects this Python object to become invalid when the inferior thread has exited. The gdb.InferiorThread object was obtained from the list returned by calling gdb.Inferior.threads(). The mistake I made in the original commit was to assume that the order of the threads returned from gdb.Inferior.threads() somehow reflected the thread creation order. Specifically, I was expecting the main thread to be first in the list, and "other" threads to appear ... not first. However, the gdb.Inferior.threads() function creates a list and populates it from a map. The order of the threads in the returned list has no obvious relationship to the thread creation order, and can vary from host to host. On my machine the ordering was as I expected, so the test passed for me. For others the ordering was not as expected, and it just happened that we ended up recording the gdb.InferiorThread for the main thread. As the main thread doesn't exit (until the test is over), the gdb.InferiorThread object never became invalid, and the test failed. Fixed in this commit by taking more care to correctly find a non-main thread. I do this by recording the main thread early on (when there is only one inferior thread), and then finding any thread that is not this main thread. Then, once all of the secondary threads have exited, I know that the second InferiorThread object I found should now be invalid. The test still passes for me, and I believe this should fix the issue for everyone else too. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31238
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.
2024-01-12gdb/python: Add gdb.InferiorThread.__dict__ attributeAndrew Burgess1-0/+17
The gdb.Objfile, gdb.Progspace, gdb.Type, and gdb.Inferior Python types already have a __dict__ attribute, which allows users to create user defined attributes within the objects. This is useful if the user wants to cache information within an object. This commit adds the same functionality to the gdb.InferiorThread type. After this commit there is a new gdb.InferiorThread.__dict__ attribute, which is a dictionary. A user can, for example, do this: (gdb) pi >>> t = gdb.selected_thread() >>> t._user_attribute = 123 >>> t._user_attribute 123 >>> There's a new test included. Reviewed-By: Eli Zaretskii <eliz@gnu.org> Approved-By: Tom Tromey <tom@tromey.com>
2024-01-12gdb/python: Add gdb.Inferior.__dict__ attributeAndrew Burgess1-0/+19
The gdb.Objfile, gdb.Progspace, and gdb.Type Python types already have a __dict__ attribute, which allows users to create user defined attributes within the objects. This is useful if the user wants to cache information within an object. This commit adds the same functionality to the gdb.Inferior type. After this commit there is a new gdb.Inferior.__dict__ attribute, which is a dictionary. A user can, for example, do this: (gdb) pi >>> i = gdb.selected_inferior() >>> i._user_attribute = 123 >>> i._user_attribute 123 >>> There's a new test included. Reviewed-By: Eli Zaretskii <eliz@gnu.org> Approved-By: Tom Tromey <tom@tromey.com>
2024-01-12gdb/python: add gdb.InferiorThread.__repr__() methodAndrew Burgess1-1/+15
Add a gdb.InferiorThread.__repr__() method. Before this patch we would see output like this: (gdb) pi >>> gdb.selected_thread() <gdb.InferiorThread object at 0x7f4dcc49b970> After this patch, we now see: (gdb) pi >>> gdb.selected_thread() <gdb.InferiorThread id=1.2 target-id="Thread 0x7ffff7da1700 (LWP 458134)"> More verbose, but, I hope, more useful. If the gdb.InferiorThread becomes invalid, then we will see: (gdb) pi >>> invalid_thread_variable <gdb.InferiorThread (invalid)> Which is inline with how other invalid objects are displayed. Approved-By: Tom Tromey <tom@tromey.com>
2023-07-19Fix gdb.Inferior.read_memory without execution (PR dap/30644)Pedro Alves1-0/+10
Andrew reported that the previous change to gdb.Inferior.read_memory & friends introducing scoped_restore_current_inferior_for_memory broke gdb.dap/stop-at-main.exp. This is also reported as PR dap/30644. The root of the problem is that all the methods that now use scoped_restore_current_inferior_for_memory cause GDB to crash with a failed assert if they are run on an inferior that is not yet started. E.g.: (gdb) python i = gdb.selected_inferior () (gdb) python i.read_memory (4,4) gdb/thread.c:626: internal-error: any_thread_of_inferior: Assertion `inf->pid != 0' failed. This patch fixes the problem by removing scoped_restore_current_inferior_for_memory's ctor ptid parameter and the any_thread_of_inferior calls completely, and making scoped_restore_current_inferior_for_memory switch inferior_ptid to a pid ptid. I was a little worried that some port might be assuming inferior_ptid points at a thread in the xfer_partial memory access routines. We know that anything that supports forks must not assume that, due to how detach_breakpoints works. I looked at a number of xfer_partial implementations, and didn't see anything that is looking at inferior_ptid in a way that would misbehave. I'm thinking that we could go forward with this and just fix ports if they break. While on some ports like on AMD GPU we have thread-specific address spaces, and so when accessing memory for those address spaces, we must have the right thread context (via inferior_ptid) selected, in Inferior.read_memory, we only have the inferior to work with, so this API as is can't be used to access thread-specific address spaces. IOW, it can only be used to access the global address space that is visible to both the CPU and the GPUs. In proc-service.c:ps_xfer_memory, the other spot using scoped_restore_current_inferior_for_memory, we're always accessing per-inferior memory. If we end up using scoped_restore_current_inferior_for_memory later to set up the context to read memory from a specific thread, then we can add an alternative ctor that takes a thread_info pointer, and make inferior_ptid point to the thread, for example. New test added to gdb.python/py-inferior.exp, exercising Inferior.read_memory without execution. No regressions on native and extended-gdbserver x86_64 GNU/Linux. Reviewed-By: Tom Tromey <tom@tromey.com> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30644 Change-Id: I11309c5ddbbb51a4594cf63c21b3858bfd9aed19
2023-07-14Use correct inferior in Inferior.read_memory et alTom Tromey1-0/+27
A user noticed that Inferior.read_memory and a few other Python APIs will always use the currently selected inferior, not the one passed to the call. This patch fixes the bug by arranging to switch to the inferior. I found this same issue in several APIs, so this fixes them all. I also added a few missing calls to INFPY_REQUIRE_VALID to these methods. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30615 Approved-By: Pedro Alves <pedro@palves.net>
2023-07-14Rename Python variable in py-inferior.expTom Tromey1-5/+6
py-inferior.exp creates a Python variable named 'str'. This clashes with the built-in type of the same name and can be confusing when trying to evaluate Python code when debugging the test case. This patch renames it. Approved-By: Pedro Alves <pedro@palves.net>
2023-07-14Refactor py-inferior.expTom Tromey1-14/+29
This changes py-inferior.exp to make it a bit more robust when adding new inferiors during the course of the test. Approved-By: Pedro Alves <pedro@palves.net>
2023-07-14Minor cleanups in py-inferior.expTom Tromey1-4/+3
While working on this series, I noticed a some oddities in py-inferior.exp. One is an obviously incorrect comment, and the others are confusing test names. This patch fixes these. Approved-By: Pedro Alves <pedro@palves.net>
2023-05-24Add attributes and methods to gdb.InferiorTom Tromey1-0/+36
This adds two new attributes and three new methods to gdb.Inferior. The attributes let Python code see the command-line arguments and the name of "main". Argument setting is also supported. The methods let Python code manipulate the inferior's environment variables. Reviewed-By: Eli Zaretskii <eliz@gnu.org>
2023-01-13Rename to allow_python_testsTom Tromey1-1/+1
This changes skip_python_tests to invert the sense, and renames it to allow_python_tests.
2023-01-13Use "require" for Python testsTom Tromey1-3/+2
This changes various tests to use "require" for the Python feature.
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-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 gdb.python/ test script directory. There should be no changes in what is tested after this commit.
2022-03-23gdb/python: remove Python 2 supportSimon Marchi1-5/+1
New in this version: - Add a PY_MAJOR_VERSION check in configure.ac / AC_TRY_LIBPYTHON. If the user passes --with-python=python2, this will cause a configure failure saying that GDB only supports Python 3. Support for Python 2 is a maintenance burden for any patches touching Python support. Among others, the differences between Python 2 and 3 string and integer types are subtle. It requires a lot of effort and thinking to get something that behaves correctly on both. And that's if the author and reviewer of the patch even remember to test with Python 2. See this thread for an example: https://sourceware.org/pipermail/gdb-patches/2021-December/184260.html So, remove Python 2 support. Update the documentation to state that GDB can be built against Python 3 (as opposed to Python 2 or 3). Update all the spots that use: - sys.version_info - IS_PY3K - PY_MAJOR_VERSION - gdb_py_is_py3k ... to only keep the Python 3 portions and drop the use of some now-removed compatibility macros. I did not update the configure script more than just removing the explicit references to Python 2. We could maybe do more there, like check the Python version and reject it if that version is not supported. Otherwise (with this patch), things will only fail at compile time, so it won't really be clear to the user that they are trying to use an unsupported Python version. But I'm a bit lost in the configure code that checks for Python, so I kept that for later. Change-Id: I75b0f79c148afbe3c07ac664cfa9cade052c0c62
2022-01-26Change how Python architecture and language are handledTom Tromey1-0/+2
Currently, gdb's Python layer captures the current architecture and language when "entering" Python code. This has some undesirable effects, and so this series changes how this is handled. First, there is code like this: gdbpy_enter enter_py (python_gdbarch, python_language); This is incorrect, because both of these are NULL when not otherwise assigned. This can cause crashes in some cases -- I've added one to the test suite. (Note that this crasher is just an example, other ones along the same lines are possible.) Second, when the language is captured in this way, it means that Python code cannot affect the current language for its own purposes. It's reasonable to want to write code like this: gdb.execute('set language mumble') ... stuff using the current language gdb.execute('set language previous-value') However, this won't actually work, because the language is captured on entry. I've added a test to show this as well. This patch changes gdb to try to avoid capturing the current values. The Python concept of the current gdbarch is only set in those few cases where a non-default value is computed or needed; and the language is not captured at all -- instead, in the cases where it's required, the current language is temporarily changed.
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-11-30gdb/python: introduce gdb.TargetConnection object typeAndrew Burgess1-2/+18
This commit adds a new object type gdb.TargetConnection. This new type represents a connection within GDB (a connection as displayed by 'info connections'). There's three ways to find a gdb.TargetConnection, there's a new 'gdb.connections()' function, which returns a list of all currently active connections. Or you can read the new 'connection' property on the gdb.Inferior object type, this contains the connection for that inferior (or None if the inferior has no connection, for example, it is exited). Finally, there's a new gdb.events.connection_removed event registry, this emits a new gdb.ConnectionEvent whenever a connection is removed from GDB (this can happen when all inferiors using a connection exit, though this is not always the case, depending on the connection type). The gdb.ConnectionEvent has a 'connection' property, which is the gdb.TargetConnection being removed from GDB. The gdb.TargetConnection has an 'is_valid()' method. A connection object becomes invalid when the underlying connection is removed from GDB (as discussed above, this might be when all inferiors using a connection exit, or it might be when the user explicitly replaces a connection in GDB by issuing another 'target' command). The gdb.TargetConnection has the following read-only properties: 'num': The number for this connection, 'type': e.g. 'native', 'remote', 'sim', etc 'description': The longer description as seen in the 'info connections' command output. 'details': A string or None. Extra details for the connection, for example, a remote connection's details might be 'hostname:port'.
2021-09-30gdb/testsuite: make runto_main not pass no-message to runtoSimon Marchi1-1/+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-05-14gdb/python: add a 'connection_num' attribute to Inferior objectsTankut Baris Aktemur1-1/+24
Define a 'connection_num' attribute for Inferior objects. The read-only attribute is the ID of the connection of an inferior, as printed by "info inferiors". In GDB's internal terminology, that's the process stratum target of the inferior. If the inferior has no target connection, the attribute is None. gdb/ChangeLog: 2021-05-14 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * python/py-inferior.c (infpy_get_connection_num): New function. (inferior_object_getset): Add a new element for 'connection_num'. * NEWS: Mention the 'connection_num' attribute of Inferior objects. gdb/doc/ChangeLog: 2021-05-14 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * python.texi (Inferiors In Python): Mention the 'connection_num' attribute. gdb/testsuite/ChangeLog: 2021-05-14 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * gdb.python/py-inferior.exp: Add test cases for 'connection_num'.
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-06-30Fix test breakages caused by removal of gdb_py_test_multiple.Philippe Waroquiers1-2/+2
Tom de Vries detected that some python tests were broken as they were still using gdb_py_test_multiple that was replaced by gdb_test_multiline. Repair these tests by using the new function. gdb/testsuite/ChangeLog 2020-06-30 Philippe Waroquiers <philippe.waroquiers@skynet.be> * gdb.python/py-breakpoint.exp: use gdb_test_multiline instead of gdb_py_test_multiple. * gdb.python/py-cmd.exp: Likewise. * gdb.python/py-events.exp: Likewise. * gdb.python/py-function.exp: Likewise. * gdb.python/py-inferior.exp: Likewise. * gdb.python/py-infthread.exp: Likewise. * gdb.python/py-linetable.exp: Likewise. * gdb.python/py-parameter.exp: Likewise. * gdb.python/py-value.exp: Likewise.
2020-01-10Add "info connections" command, "info inferiors" connection number/stringPedro Alves1-2/+2
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 Brobecker1-1/+1
gdb/ChangeLog: Update copyright year range in all GDB files.
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-10-06Add Inferior.architecture methodTom Tromey1-0/+8
I've written a couple of gdb unwinders in Python, and while doing so, I wanted to find the architecture of the inferior. (In an unwinder in particular, one can't use the frame's architecture, because there is no frame.) This patch adds Inferior.architecture to allow this. Normally I think I would have chosen an attribute and not a method here, but seeing that Frame.architecture is a method, I chose a method as well, for consistency. gdb/ChangeLog 2018-10-06 Tom Tromey <tom@tromey.com> PR python/19399: * python/py-inferior.c: Add "architecture" entry. (infpy_architecture): New function. gdb/doc/ChangeLog 2018-10-06 Tom Tromey <tom@tromey.com> PR python/19399: * python.texi (Inferiors In Python): Document Inferior.Architecture. gdb/testsuite/ChangeLog 2018-10-06 Tom Tromey <tom@tromey.com> PR python/19399: * gdb.python/py-inferior.exp: Add architecture test.
2018-09-13python: Add Inferior.progspace propertySimon Marchi1-0/+5
This patch adds a progspace property to the gdb.Inferior type, which allows getting the gdb.Progspace object associated to that inferior. In conjunction with the following patch, this will allow scripts iterate on objfiles associated with a particular inferior. gdb/ChangeLog: * python/py-inferior.c (infpy_get_progspace): New function. (inferior_object_getset): Add progspace property. * NEWS: Mention the new property. gdb/doc/ChangeLog: * python.texi (Inferiors In Python): Document Inferior.progspace. (Program Spaces In Python): Document that gdb.current_progspace() is the same as gdb.selected_inferior().progspace. gdb/testsuite/ChangeLog: * gdb.python/py-inferior.exp: Add tests for Inferior.progspace and a few other Inferior properties when the Inferior is no longer valid.
2018-09-13python: Provide textual representation for Inferior and ObjfileSimon Marchi1-1/+16
Printing a GDB Python object is notoriously not helpful: >>> print(gdb.selected_inferior()) <gdb.Inferior object at 0x7fea59aed198> >>> print(gdb.objfiles()) [<gdb.Objfile object at 0x7fea59b57c90>] This makes printing debug traces more difficult than it should be. This patch provides some repr() implementation for these two types (more to come if people agree with the idea, but I want to test the water first). Here's the same example as above, but with this patch: >>> print(gdb.selected_inferior()) <gdb.Inferior num=1> >>> print(gdb.objfiles()) [<gdb.Objfile filename=/home/emaisin/build/binutils-gdb-gcc-git/gdb/test>] I implemented repr rather than str, because when printing a list (or another container I suppose), Python calls the repr method of the elements. This is useful when printing a list of inferiors or objfiles. The print(gdb.objfiles()) above would not have worked if I had implemented str. I found this post useful to understand the difference between repr and str: https://stackoverflow.com/questions/1436703/difference-between-str-and-repr gdb/ChangeLog: * python/py-inferior.c (infpy_repr): New. (inferior_object_type): Register infpy_repr. * python/py-objfile.c (objfpy_repr): New. (objfile_object_type): Register objfpy_repr. gdb/testsuite/ChangeLog: * gdb.python/py-inferior.exp: Test repr() of gdb.Inferior. * gdb.python/py-objfile.exp: Test repr() of gdb.Objfile. * gdb.python/py-symtab.exp: Update test printing an objfile. gdb/doc/ChangeLog: * python.texi (Basic Python): Mention the string representation of GDB Python objects.
2018-09-12python: Add tests for trying to use an invalid Inferior objectSimon Marchi1-0/+13
This patch adds tests for trying to use property or methods on a gdb.Inferior object that represents an inferior that does not exist anymore. We expect an exception to be thrown. gdb/testsuite/ChangeLog: * gdb.python/py-inferior.exp: Test using an invalid gdb.Inferior object.
2018-01-02Update copyright year range in all GDB filesJoel Brobecker1-1/+1
gdb/ChangeLog: Update copyright year range in all GDB files
2017-09-11Add new_inferior, inferior_deleted, and new_thread eventsTom Tromey1-0/+24
This adds a few new events to gdb's Python layer: new_inferior, inferior_deleted, and new_thread. I wanted to be able to add a combined inferior/thread display window to my GUI, and I needed a few events to make this work. This is PR python/15622. ChangeLog 2017-09-11 Tom Tromey <tom@tromey.com> PR python/15622: * NEWS: Add entry. * python/python.c (do_start_initialization): Initialize new event types. * python/python-internal.h (gdbpy_initialize_new_inferior_event) (gdbpy_initialize_inferior_deleted_event) (gdbpy_initialize_new_thread_event): Declare. * python/py-threadevent.c (create_thread_event_object): Add option "thread" parameter. * python/py-inferior.c (new_thread_event_object_type) (new_inferior_event_object_type) (inferior_deleted_event_object_type): Declare. (python_new_inferior, python_inferior_deleted): New functions. (add_thread_object): Emit new_thread event. (gdbpy_initialize_inferior): Attach new functions to corresponding observers. (new_thread, new_inferior, inferior_deleted): Define new event types. * python/py-evts.c (gdbpy_initialize_py_events): Add new registries. * python/py-events.h (events_object) <new_inferior, inferior_deleted, new_thread>: New fields. * python/py-event.h (create_thread_event_breakpoint): Add optional "thread" parameter. doc/ChangeLog 2017-09-11 Tom Tromey <tom@tromey.com> * python.texi (Events In Python): Document new events. testsuite/ChangeLog 2017-09-11 Tom Tromey <tom@tromey.com> * gdb.python/py-infthread.exp: Add tests for new_thread event. * gdb.python/py-inferior.exp: Add tests for new inferior events.
2017-06-13gdb/testsuite: Add "get_endianness" convenience procAndreas Arnez1-9/+3
The test suite contains multiple instances of determining the target's endianness with GDB's "show endian" command. This patch replaces these by an invocation of a new convenience proc 'get_endianness'. gdb/testsuite/ChangeLog: * lib/gdb.exp (get_endianness): New proc. * gdb.arch/aarch64-fp.exp: Use it. * gdb.arch/altivec-regs.exp: Likewise. * gdb.arch/e500-regs.exp: Likewise. * gdb.arch/vsx-regs.exp: Likewise. * gdb.base/dump.exp: Likewise. * gdb.base/funcargs.exp: Likewise. * gdb.base/gnu_vector.exp: Likewise. * gdb.dwarf2/formdata16.exp: Likewise. * gdb.dwarf2/implptrpiece.exp: Likewise. * gdb.dwarf2/nonvar-access.exp: Likewise. * gdb.python/py-inferior.exp: Likewise. * gdb.trace/unavailable-dwarf-piece.exp: Likewise.
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 output by basic functionsLuis Machado1-1/+1
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-01-12Reapply: List inferiors/threads/pspaces in ascending orderPedro Alves1-2/+2
[This reapplies a change that was accidentally reverted with c0ecb95f3d.] Before: (gdb) info threads Id Target Id Frame 3 Thread 0x7ffff77c3700 (LWP 29035) callme () at foo.c:30 2 Thread 0x7ffff7fc4700 (LWP 29034) 0x000000000040087b in child_function_2 (arg=0x0) at foo.c:60 * 1 Thread 0x7ffff7fc5740 (LWP 29030) 0x0000003b37209237 in pthread_join (threadid=140737353893632, thread_return=0x0) at pthread_join.c:92 After: (gdb) info threads Id Target Id Frame * 1 Thread 0x7ffff7fc5740 (LWP 29030) 0x0000003b37209237 in pthread_join (threadid=140737353893632, thread_return=0x0) at pthread_join.c:92 2 Thread 0x7ffff7fc4700 (LWP 29034) 0x000000000040087b in child_function_2 (arg=0x0) at foo.c:60 3 Thread 0x7ffff77c3700 (LWP 29035) callme () at foo.c:30 gdb/doc/ChangeLog: 2015-11-24 Pedro Alves <palves@redhat.com> PR 17539 * gdb.texinfo (Inferiors and Programs): Adjust "maint info program-spaces" example to ascending order listing. (Threads): Adjust "info threads" example to ascending order listing. (Forks): Adjust "info inferiors" example to ascending order listing. gdb/ChangeLog: 2015-11-24 Pedro Alves <palves@redhat.com> PR 17539 * inferior.c (add_inferior_silent): Append the new inferior to the end of the list. * progspace.c (add_program_space): Append the new pspace to the end of the list. * thread.c (new_thread): Append the new thread to the end of the list. gdb/testsuite/ChangeLog: 2015-11-24 Pedro Alves <palves@redhat.com> PR 17539 * gdb.base/foll-exec-mode.exp: Adjust to GDB listing inferiors and threads in ascending order. * gdb.base/foll-fork.exp: Likewise. * gdb.base/foll-vfork.exp: Likewise. * gdb.base/multi-forks.exp: Likewise. * gdb.mi/mi-nonstop.exp: Likewise. * gdb.mi/mi-nsintrall.exp: Likewise. * gdb.multi/base.exp: Likewise. * gdb.multi/multi-arch.exp: Likewise. * gdb.python/py-inferior.exp: Likewise. * gdb.threads/break-while-running.exp: Likewise. * gdb.threads/execl.exp: Likewise. * gdb.threads/gcore-thread.exp: Likewise. * gdb.threads/info-threads-cur-sal.exp: Likewise. * gdb.threads/kill.exp: Likewise. * gdb.threads/linux-dp.exp: Likewise. * gdb.threads/multiple-step-overs.exp: Likewise. * gdb.threads/next-bp-other-thread.exp: Likewise. * gdb.threads/step-bg-decr-pc-switch-thread.exp: Likewise. * gdb.threads/step-over-lands-on-breakpoint.exp: Likewise. * gdb.threads/step-over-trips-on-watchpoint.exp: Likewise. * gdb.threads/thread-find.exp: Likewise. * gdb.threads/tls.exp: Likewise. * lib/mi-support.exp (mi_reverse_list): Delete. (mi_check_thread_states): No longer reverse list.
2016-01-11testsuite: Fix false FAILs on too long base directoryJan Kratochvil1-2/+2
I was getting gu (print arg0)^M = 0x7fffffffdafb "/unsafebuild-x86_64-redhat-linux-gnu/gdb/testsuite.unix.-m64/outputs/gdb.guile/scm-value/scm-"...^M (gdb) FAIL: gdb.guile/scm-value.exp: verify dereferenced value python print (arg0)^M 0x7fffffffdafd "/unsafebuild-x86_64-redhat-linux-gnu/gdb/testsuite.unix.-m64/outputs/gdb.python/py-value/py-v"...^M (gdb) FAIL: gdb.python/py-value.exp: verify dereferenced value and also: (gdb) p argv[0]^M $2 = 0x7fffffffd832 "/home/jkratoch/redhat/gdb-test-", 'x' <repeats 169 times>...^M (gdb) FAIL: gdb.guile/scm-value.exp: argv[0] should be available on this target gdb/testsuite/ChangeLog 2016-01-11 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.guile/scm-value.exp (test_value_in_inferior): Set print elements and repeats to unlimited. * gdb.python/py-value.exp: Likewise. * lib/gdb.exp (gdb_has_argv0): Save and temporarily set print elements and repeats to unlimited.
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-11-24List inferiors/threads/pspaces in ascending orderPedro Alves1-2/+2
Before: (gdb) info threads Id Target Id Frame 3 Thread 0x7ffff77c3700 (LWP 29035) callme () at foo.c:30 2 Thread 0x7ffff7fc4700 (LWP 29034) 0x000000000040087b in child_function_2 (arg=0x0) at foo.c:60 * 1 Thread 0x7ffff7fc5740 (LWP 29030) 0x0000003b37209237 in pthread_join (threadid=140737353893632, thread_return=0x0) at pthread_join.c:92 After: (gdb) info threads Id Target Id Frame * 1 Thread 0x7ffff7fc5740 (LWP 29030) 0x0000003b37209237 in pthread_join (threadid=140737353893632, thread_return=0x0) at pthread_join.c:92 2 Thread 0x7ffff7fc4700 (LWP 29034) 0x000000000040087b in child_function_2 (arg=0x0) at foo.c:60 3 Thread 0x7ffff77c3700 (LWP 29035) callme () at foo.c:30 gdb/doc/ChangeLog: 2015-11-24 Pedro Alves <palves@redhat.com> PR 17539 * gdb.texinfo (Inferiors and Programs): Adjust "maint info program-spaces" example to ascending order listing. (Threads): Adjust "info threads" example to ascending order listing. (Forks): Adjust "info inferiors" example to ascending order listing. gdb/ChangeLog: 2015-11-24 Pedro Alves <palves@redhat.com> PR 17539 * inferior.c (add_inferior_silent): Append the new inferior to the end of the list. * progspace.c (add_program_space): Append the new pspace to the end of the list. * thread.c (new_thread): Append the new thread to the end of the list. gdb/testsuite/ChangeLog: 2015-11-24 Pedro Alves <palves@redhat.com> PR 17539 * gdb.base/foll-exec-mode.exp: Adjust to GDB listing inferiors and threads in ascending order. * gdb.base/foll-fork.exp: Likewise. * gdb.base/foll-vfork.exp: Likewise. * gdb.base/multi-forks.exp: Likewise. * gdb.mi/mi-nonstop.exp: Likewise. * gdb.mi/mi-nsintrall.exp: Likewise. * gdb.multi/base.exp: Likewise. * gdb.multi/multi-arch.exp: Likewise. * gdb.python/py-inferior.exp: Likewise. * gdb.threads/break-while-running.exp: Likewise. * gdb.threads/execl.exp: Likewise. * gdb.threads/gcore-thread.exp: Likewise. * gdb.threads/info-threads-cur-sal.exp: Likewise. * gdb.threads/kill.exp: Likewise. * gdb.threads/linux-dp.exp: Likewise. * gdb.threads/multiple-step-overs.exp: Likewise. * gdb.threads/next-bp-other-thread.exp: Likewise. * gdb.threads/step-bg-decr-pc-switch-thread.exp: Likewise. * gdb.threads/step-over-lands-on-breakpoint.exp: Likewise. * gdb.threads/step-over-trips-on-watchpoint.exp: Likewise. * gdb.threads/thread-find.exp: Likewise. * gdb.threads/tls.exp: Likewise. * lib/mi-support.exp (mi_reverse_list): Delete. (mi_check_thread_states): No longer reverse list.
2015-11-24Make gdb.python/py-inferior.exp test names uniquePedro Alves1-100/+117
Before we had: $ cat testsuite/gdb.sum | grep "PASS" | sort | uniq -c | sort -n ... 1 PASS: gdb.python/py-inferior.exp: write str 2 PASS: gdb.python/py-inferior.exp: Get inferior list length 2 PASS: gdb.python/py-inferior.exp: py start_addr = gdb.selected_frame ().read_var ('search_buf') 2 PASS: gdb.python/py-inferior.exp: Switch to first inferior 3 PASS: gdb.python/py-inferior.exp: find mixed-sized pattern 4 PASS: gdb.python/py-inferior.exp: py length = search_buf.type.sizeof 4 PASS: gdb.python/py-inferior.exp: py start_addr = search_buf.address 5 PASS: gdb.python/py-inferior.exp: Check inferior validity $ gdb/testsuite/ChangeLog: 2015-11-24 Pedro Alves <palves@redhat.com> * gdb.python/py-inferior.exp: Use with_test_prefix. Consistently use lowercase.
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-01-01Update Copyright year range in all files maintained by GDB.Joel Brobecker1-1/+1
2013-06-07Remove superfluous semicolons from testsuite throughout.Pedro Alves1-1/+1
A few months ago semicolons after "return" were removed throughout the testsuite. However, as I pointed out in review, they're unnecessary not just after "return", but pretty much after any tcl command. ';' is the command separator, and you only need it if there's another command on the same line afterwards. This patch was written by running: $ find . -name "*.exp" | xargs grep -l ";\s*$" | xargs sed -i 's/\([^#][^\s*;]*\)\s*;\s*$/\1/' and then undoing changes to comments, and lib/future.exp. Tested on x86_64 Fedora 17. gdb/testsuite/ 2013-06-07 Pedro Alves <palves@redhat.com> * boards/native-extended-gdbserver.exp: Remove semicolon. * config/arm-ice.exp: Likewise. * config/bfin.exp: Likewise. * config/cygmon.exp: Likewise. * config/h8300.exp: Likewise. * config/monitor.exp: Likewise. * config/sid.exp: Likewise. * config/sim.exp: Likewise. * config/slite.exp: Likewise. * config/vx.exp: Likewise. * gdb.arch/i386-bp_permanent.exp: Likewise. * gdb.asm/asm-source.exp: Likewise. * gdb.base/args.exp: Likewise. * gdb.base/attach-pie-misread.exp: Likewise. * gdb.base/auxv.exp: Likewise. * gdb.base/bigcore.exp: Likewise. * gdb.base/bitfields2.exp: Likewise. * gdb.base/bitfields.exp: Likewise. * gdb.base/break.exp: Likewise. * gdb.base/break-interp.exp: Likewise. * gdb.base/callfuncs.exp: Likewise. * gdb.base/call-sc.exp: Likewise. * gdb.base/commands.exp: Likewise. * gdb.base/corefile.exp: Likewise. * gdb.base/dbx.exp: Likewise. * gdb.base/ending-run.exp: Likewise. * gdb.base/exprs.exp: Likewise. * gdb.base/funcargs.exp: Likewise. * gdb.base/hbreak2.exp: Likewise. * gdb.base/huge.exp: Likewise. * gdb.base/list.exp: Likewise. * gdb.base/memattr.exp: Likewise. * gdb.base/overlays.exp: Likewise. * gdb.base/printcmds.exp: Likewise. * gdb.base/recurse.exp: Likewise. * gdb.base/remotetimeout.exp: Likewise. * gdb.base/reread.exp: Likewise. * gdb.base/savedregs.exp: Likewise. * gdb.base/scope.exp: Likewise. * gdb.base/sepdebug.exp: Likewise. * gdb.base/setshow.exp: Likewise. * gdb.base/setvar.exp: Likewise. * gdb.base/sigaltstack.exp: Likewise. * gdb.base/siginfo-addr.exp: Likewise. * gdb.base/siginfo.exp: Likewise. * gdb.base/siginfo-obj.exp: Likewise. * gdb.base/sigrepeat.exp: Likewise. * gdb.base/sigstep.exp: Likewise. * gdb.base/structs.exp: Likewise. * gdb.base/testenv.exp: Likewise. * gdb.base/twice.exp: Likewise. * gdb.base/valgrind-db-attach.exp: Likewise. * gdb.base/valgrind-infcall.exp: Likewise. * gdb.base/varargs.exp: Likewise. * gdb.base/watchpoint.exp: Likewise. * gdb.cp/gdb1355.exp: Likewise. * gdb.cp/misc.exp: Likewise. * gdb.disasm/hppa.exp: Likewise. * gdb.disasm/t01_mov.exp: Likewise. * gdb.disasm/t02_mova.exp: Likewise. * gdb.disasm/t03_add.exp: Likewise. * gdb.disasm/t04_sub.exp: Likewise. * gdb.disasm/t05_cmp.exp: Likewise. * gdb.disasm/t06_ari2.exp: Likewise. * gdb.disasm/t07_ari3.exp: Likewise. * gdb.disasm/t08_or.exp: Likewise. * gdb.disasm/t09_xor.exp: Likewise. * gdb.disasm/t10_and.exp: Likewise. * gdb.disasm/t11_logs.exp: Likewise. * gdb.disasm/t12_bit.exp: Likewise. * gdb.disasm/t13_otr.exp: Likewise. * gdb.gdb/selftest.exp: Likewise. * gdb.hp/gdb.base-hp/callfwmall.exp: Likewise. * gdb.mi/mi-reverse.exp: Likewise. * gdb.pascal/floats.exp: Likewise. * gdb.python/py-inferior.exp: Likewise. * gdb.threads/attach-into-signal.exp: Likewise. * gdb.threads/pthreads.exp: Likewise. * gdb.threads/thread_events.exp: Likewise. * gdb.threads/watchthreads.exp: Likewise. * gdb.trace/actions-changed.exp: Likewise. * gdb.trace/actions.exp: Likewise. * gdb.trace/ax.exp: Likewise. * gdb.trace/backtrace.exp: Likewise. * gdb.trace/change-loc.exp: Likewise. * gdb.trace/deltrace.exp: Likewise. * gdb.trace/disconnected-tracing.exp: Likewise. * gdb.trace/ftrace.exp: Likewise. * gdb.trace/infotrace.exp: Likewise. * gdb.trace/passc-dyn.exp: Likewise. * gdb.trace/passcount.exp: Likewise. * gdb.trace/pending.exp: Likewise. * gdb.trace/qtro.exp: Likewise. * gdb.trace/range-stepping.exp: Likewise. * gdb.trace/report.exp: Likewise. * gdb.trace/save-trace.exp: Likewise. * gdb.trace/status-stop.exp: Likewise. * gdb.trace/strace.exp: Likewise. * gdb.trace/tfile.exp: Likewise. * gdb.trace/tfind.exp: Likewise. * gdb.trace/trace-break.exp: Likewise. * gdb.trace/tracecmd.exp: Likewise. * gdb.trace/trace-mt.exp: Likewise. * gdb.trace/tspeed.exp: Likewise. * gdb.trace/tsv.exp: Likewise. * gdb.trace/while-stepping.exp: Likewise. * lib/gdb.exp: Likewise. * lib/gdbserver-support.exp: Likewise. * lib/java.exp: Likewise. * lib/mi-support.exp: Likewise. * lib/pascal.exp: Likewise. * lib/prompt.exp: Likewise. * lib/trace-support.exp: Likewise.
2013-01-01Update years in copyright notice for the GDB files.Joel Brobecker1-1/+1
Two modifications: 1. The addition of 2013 to the copyright year range for every file; 2. The use of a single year range, instead of potentially multiple year ranges, as approved by the FSF.
2012-12-102012-12-10 Paul Koning <paul_koning@dell.com>Paul Koning1-32/+37
* gdb.base/charset.exp: Change print syntax for Python 3 compatibility. * gdb.python/py-block.exp: Ditto. * gdb.python/py-breakpoint.exp: Ditto. * gdb.python/py-cmd.exp: Ditto. * gdb.python/py-events.py: Ditto. * gdb.python/py-finish-breakpoint.py: Ditto. * gdb.python/py-finish-breakpoint2.exp: Ditto. * gdb.python/py-finish-breakpoint2.py: Ditto. * gdb.python/py-frame-inline.exp: Ditto. * gdb.python/py-frame.exp: Ditto. * gdb.python/py-infthread.exp: Ditto. * gdb.python/py-objfile.exp: Ditto. * gdb.python/py-parameter.exp: Ditto. * gdb.python/py-progspace.exp: Ditto. * gdb.python/py-prompt.exp: Ditto. * gdb.python/py-symbol.exp: Ditto. * gdb.python/py-symtab.exp: Ditto. * gdb.python/py-template.exp: Ditto. * gdb.python/py-value-cc.exp: Ditto. * gdb.python/python.exp: Ditto. * gdb.python/source2.py: Ditto. * gdb.python/lib-types.exp: Change print syntax for Python 3 compatibility. Use sorted() function rather than sort() method. Accept either int or long values for enum values. * gdb.python/py-events.exp: Use exec(open(...).read()) instead of execfile for Python 3 compatibility. * gdb.python/py-evsignal.exp: Ditto. * gdb.python/py-evthreads.exp: Ditto. * gdb.python/py-mi.exp: Ditto. * gdb.python/py-pp-maint.exp: Ditto. * gdb.python/py-prettyprint.exp: Ditto. * gdb.python/py-finish-breakpoint.exp: Change print syntax for Python 3 compatibility. Skip tests for Python 2.4. * gdb.python/py-inferior.exp: Change print syntax for Python 3 compatibility. Use byte string rather than character string in memory write test if Python 3. * gdb.python/py-pp-maint.py: Change class declarations to "new class" syntax. * gdb.python/py-prettyprint.py: Change iterator class to generator function for Python 3 compatibility. Make all classes "new style". Fix indentation issue and stray semicolon. * gdb.python/py-shared.expChange print syntax for Python 3 compatibility. Define "long" if Python 3. * gdb.python/py-type.exp: Change print syntax for Python 3 compatibility. Accept either int or long values for enum values. * gdb.python/py-value.exp: Change print syntax for Python 3 compatibility. Skip "long" and "unicode" tests if Python 3. Accept either "type" or "class" in type checks. * lib/gdb.exp (gdb_py_is_py3k): New flag set if Python 3. (gdb_py_is_py24): New flag set if Python 2.4 or 2.5.
2012-07-26gdb/Jan Kratochvil1-3/+12
* python/py-inferior.c (infpy_threads): Call update_thread_list (). gdb/testsuite/ * gdb.python/py-inferior.c (thread): New function. (check_threads): New function. (test_threads): New function. * gdb.python/py-inferior.exp: Added test. Replaced runto with continue to breakpoint.