diff options
author | Sergio Durigan Junior <sergiodj@redhat.com> | 2020-02-06 17:52:54 -0500 |
---|---|---|
committer | Sergio Durigan Junior <sergiodj@redhat.com> | 2020-02-11 11:36:17 -0500 |
commit | f6be87130b5b327075a09c05e78532816f186995 (patch) | |
tree | 8a0421b698c3e338402671191795dc11c342f8e3 /gdb/testsuite/gdb.base/cached-source-file.c | |
parent | bda874f6d192acb99108266e53ad09031df82f0a (diff) | |
download | gdb-f6be87130b5b327075a09c05e78532816f186995.zip gdb-f6be87130b5b327075a09c05e78532816f186995.tar.gz gdb-f6be87130b5b327075a09c05e78532816f186995.tar.bz2 |
New testcase for PR tui/25126 (staled source cache)
I'm dealing with a Fedora GDB bug that is related to PR tui/25126, and
I thought I'd write a specific testcase for it because I couldn't find
one.
The idea is to get the simple reproducer from the bug and tweak the
testcase around it. This one was a bit hard because, since we need to
modify the source file and recompile it, it involved a bit of TCL-foo
to do things. Also for this reason, I'm only enabling the test for
native boards.
I tested this with an upstream GDB and made sure everything is
passing. I also tested with a faulty GDB and made sure the test
failed.
gdb/testsuite/ChangeLog:
2020-02-11 Sergio Durigan Junior <sergiodj@redhat.com>
PR tui/25126
https://bugzilla.redhat.com/show_bug.cgi?id=1784210
* gdb.base/cached-source-file.c: New file.
* gdb.base/cached-source-file.exp: New file.
Change-Id: Ib1b074342ebe8613c6d1dfde631691ebdf6d81c6
Diffstat (limited to 'gdb/testsuite/gdb.base/cached-source-file.c')
-rw-r--r-- | gdb/testsuite/gdb.base/cached-source-file.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/cached-source-file.c b/gdb/testsuite/gdb.base/cached-source-file.c new file mode 100644 index 0000000..6f62c29 --- /dev/null +++ b/gdb/testsuite/gdb.base/cached-source-file.c @@ -0,0 +1,43 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2020 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Test for PR tui/25126. + + The bug is about a regression that makes GDB not reload its source + code cache when the inferior's symbols are reloaded, which leads to + wrong backtraces/listings. + + This bug is reproducible even without using the TUI. + + The .exp testcase depends on the line numbers and contents from + this file If you change this file, make sure to double-check the + testcase. */ + +#include <stdio.h> + +void +foo (void) +{ + printf ("hello\n"); /* break-here */ +} + +int +main () +{ + foo (); + return 0; +} |