aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/corefile2.exp
AgeCommit message (Collapse)AuthorFilesLines
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-01-13Use require isnativeTom Tromey1-3/+1
This changes some tests to use "require isnative".
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.base/*.expAndrew Burgess1-2/+2
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.base/ test script directory. There should be no changes in what is tested after this commit.
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-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-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-08-31Work around incorrect/broken pathnames in NT_FILE noteKevin Buettner1-0/+27
Luis Machado reported some regressions after I pushed recent core file related patches fixing BZ 25631: FAIL: gdb.base/corefile.exp: backtrace in corefile.exp FAIL: gdb.base/corefile.exp: core-file warning-free FAIL: gdb.base/corefile.exp: print func2::coremaker_local FAIL: gdb.base/corefile.exp: up in corefile.exp FAIL: gdb.base/corefile.exp: up in corefile.exp (reinit) This commit fixes these regressions. Thanks to Luis for testing an earlier version of the patch. (I was unable to reproduce these regressions in various test environments that I created.) Luis is testing in a docker container which is using the AUFS storage driver. It turns out that the kernel is placing docker host paths in the NT_FILE note instead of paths within the container. I've made a similar docker environment (though apparently not similar enough to reproduce the regressions). This is one of the paths that I see mentioned in the warning messages printed while loading the core file during NT_FILE note processing - note that I've shortened the path component starting with "d07c4": /var/lib/docker/aufs/diff/d07c4...21/lib/x86_64-linux-gnu/ld-2.27.so This is a path on the docker host; it does not exist in the container. In the docker container, this is the path: /lib/x86_64-linux-gnu/ld-2.27.so My first thought was to disable all NT_FILE mappings when any path was found to be bad. This would have caused GDB to fall back to accessing memory using the file stratum as it did before I added the NT_FILE note loading code. After further consideration, I realized that we could do better than this. For file-backed memory access, we can still use the NT_FILE mappings when available, and then attempt to access memory using the file stratum constrained to those address ranges corresponding to the "broken" mappings. In order to test it, I made some additions to corefile2.exp in which the test case's executable is renamed. The core file is then loaded; due to the fact that the executable has been renamed, those mappings will be unavailable. After loading the core file, the executable is renamed back to its original name at which point it is loaded using GDB's "file" command. The "interesting" tests are then run. These tests will print out values in file-backed memory regions along with mmap'd regions placed within/over the file-backed regions. Despite the fact that the executable could not be found during the NT_FILE note processing, these tests still work correctly due to the fact that memory is available from the file stratum combined with the fact that the broken NT_FILE mappings are used to prevent file-backed access outside of the "broken" mappings. gdb/ChangeLog: * corelow.c (unordered_set): Include. (class core_target): Add field 'm_core_unavailable_mappings'. (core_target::build_file_mappings): Print only one warning per inaccessible file. Add unavailable/broken mappings to m_core_unavailable_mappings. (core_target::xfer_partial): Call... (core_target::xfer_memory_via_mappings): New method. gdb/testsuite/ChangeLog: * gdb.base/corefile2.exp (renamed binfile): New tests.
2020-07-22New core file tests with mappings over existing program memoryKevin Buettner1-0/+185
This test case was inspired by Pedro's demonstration of a problem with my v2 patches. It can be found here: https://sourceware.org/pipermail/gdb-patches/2020-May/168826.html In a nutshell, my earlier patches could not handle the case in which a read-only mapping created with mmap() was created at an address used by other file-backed read-only memory in use by the process. This problem has been fixed (for Linux, anyway) by the commit "Use NT_FILE note section for reading core target memory". When I run this test without any of my recent corefile patches, I see these failures: FAIL: gdb.base/corefile2.exp: kernel core: print/x mbuf_ro[0]@4 FAIL: gdb.base/corefile2.exp: kernel core: print/x mbuf_ro[pagesize-4]@4 FAIL: gdb.base/corefile2.exp: kernel core: print/x mbuf_ro[-3]@6 FAIL: gdb.base/corefile2.exp: kernel core: print/x mbuf_rw[pagesize-3]@6 FAIL: gdb.base/corefile2.exp: kernel core: print/x mbuf_ro[pagesize-3]@6 FAIL: gdb.base/corefile2.exp: maint print core-file-backed-mappings FAIL: gdb.base/corefile2.exp: gcore core: print/x mbuf_ro[-3]@6 The ones involving mbuf_ro will almost certainly fail when run on non-Linux systems; I've used setup_xfail on those tests to prevent them from outright FAILing when not run on Linux. For a time, I had considered skipping these tests altogether when not run on Linux, but I changed my mind due to this failure... FAIL: gdb.base/corefile2.exp: print/x mbuf_rw[pagesize-3]@6 I think it *should* pass without my recent corefile patches. The fact that it doesn't is likely due to a bug in GDB. The following interaction with GDB demonstrates the problem: (gdb) print/x mbuf_rw[pagesize-3]@6 $1 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0} (gdb) print/x mbuf_rw[pagesize]@3 $2 = {0x6b, 0x6b, 0x6b} The last three values in display of $1 should be the same as those shown by $2. Like this... (gdb) print/x mbuf_rw[pagesize-3]@6 $1 = {0x0, 0x0, 0x0, 0x6b, 0x6b, 0x6b} (gdb) print/x mbuf_rw[pagesize]@3 $2 = {0x6b, 0x6b, 0x6b} That latter output was obtained with the use of all of my current corefile patches. I see no failures on Linux when running this test with my current set of corefile patches. I tested 3 architectures: x86_64, s390x, and aarch64. I also tested on FreeBSD 12.1-RELEASE. I see the following results both with and without the current set of core file patches: # of expected passes 26 # of expected failures 8 Of particular interest is that I did *not* see the problematic mbuf_rw failure noted earlier (both with and without the core file patches). I still don't have an explanation for why this failure occurred on Linux. Prior to running the tests, I had hypothesized that I'd see this failure on FreeBSD too, but testing shows that this is not the case. Also of importance is that we see no FAILs with this test on FreeBSD which indicates that I XFAILed the correct tests. This version runs the interesting tests twice, once with a kernel created core file and another time with a gcore created core file. It also does a very minimal test of the new command "maint print core-file-backed-mappings". gdb/testsuite/ChangeLog: * gdb.base/corefile2.exp: New file. * gdb.base/coremaker2.exp: New file.