Line
Link Here
|
0 |
-- a/gdb/cli/cli-cmds.c |
0 |
++ b/gdb/cli/cli-cmds.c |
Lines 1291-1296
list_command (const char *arg, int from_tty)
Link Here
|
1291 |
set_default_source_symtab_and_line (); |
1291 |
set_default_source_symtab_and_line (); |
1292 |
cursal = get_current_source_symtab_and_line (); |
1292 |
cursal = get_current_source_symtab_and_line (); |
1293 |
} |
1293 |
} |
|
|
1294 |
if (cursal.symtab == nullptr) |
1295 |
error (_("No debug information available to print source lines.")); |
1294 |
list_around_line (arg, cursal); |
1296 |
list_around_line (arg, cursal); |
1295 |
/* Set the repeat args so just pressing "enter" after using "list ." |
1297 |
/* Set the repeat args so just pressing "enter" after using "list ." |
1296 |
will print the following lines instead of the same lines again. */ |
1298 |
will print the following lines instead of the same lines again. */ |
1297 |
-- /dev/null |
1299 |
++ b/gdb/testsuite/gdb.base/list-nodebug.c |
Line 0
Link Here
|
0 |
-- /dev/null |
1 |
/* This testcase is part of GDB, the GNU debugger. |
|
|
2 |
|
3 |
Copyright 2024 Free Software Foundation, Inc. |
4 |
|
5 |
This program is free software; you can redistribute it and/or modify |
6 |
it under the terms of the GNU General Public License as published by |
7 |
the Free Software Foundation; either version 3 of the License, or |
8 |
(at your option) any later version. |
9 |
|
10 |
This program is distributed in the hope that it will be useful, |
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 |
GNU General Public License for more details. |
14 |
|
15 |
You should have received a copy of the GNU General Public License |
16 |
along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
17 |
|
18 |
int main () |
19 |
{ |
20 |
return 0; |
21 |
} |
|
|
22 |
++ b/gdb/testsuite/gdb.base/list-nodebug.exp |
Line 0
Link Here
|
0 |
- |
1 |
# Copyright 2024 Free Software Foundation, Inc. |
|
|
2 |
|
3 |
# This program is free software; you can redistribute it and/or modify |
4 |
# it under the terms of the GNU General Public License as published by |
5 |
# the Free Software Foundation; either version 3 of the License, or |
6 |
# (at your option) any later version. |
7 |
# |
8 |
# This program is distributed in the hope that it will be useful, |
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 |
# GNU General Public License for more details. |
12 |
# |
13 |
# You should have received a copy of the GNU General Public License |
14 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
15 |
|
16 |
# Test that using the command "list" in a file with no debug information |
17 |
# will not crash GDB and will give reasonable output. |
18 |
|
19 |
standard_testfile .c |
20 |
|
21 |
if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ |
22 |
{nodebug}]} { |
23 |
return -1 |
24 |
} |
25 |
|
26 |
if {![runto_main]} { |
27 |
untested "couldn't run to main" |
28 |
return |
29 |
} |
30 |
|
31 |
# Check that GDB doesn't crash when we use list . on an inferior with |
32 |
# no debug information |
33 |
gdb_test "list ." "No debug.*" "first 'list .'" |
34 |
# This should be called twice because the first list invocation since |
35 |
# printing a frame may take a different codepath, which wouldn't |
36 |
# trigger the crash. |
37 |
gdb_test "list ." "No debug.*" "second 'list .'" |