]> git.pld-linux.org Git - packages/gdb.git/blob - gdb-vla-frame-set.patch
- up to 7.3.1
[packages/gdb.git] / gdb-vla-frame-set.patch
1 commit 51dab9e418741ac7065cd5a6ec9b57285e90227c
2 https://bugzilla.redhat.com/show_bug.cgi?id=738482
3
4 --- a/gdb/printcmd.c
5 +++ b/gdb/printcmd.c
6 @@ -1981,6 +1981,10 @@ print_variable_and_value (const char *name, struct symbol *var,
7        struct value_print_options opts;
8  
9        val = read_var_value (var, frame);
10 +
11 +      make_cleanup_restore_selected_frame ();
12 +      select_frame (frame);
13 +
14        get_user_print_options (&opts);
15        common_val_print (val, stream, indent, &opts, current_language);
16      }
17 --- /dev/null
18 +++ b/gdb/testsuite/gdb.base/vla-frame.c
19 @@ -0,0 +1,31 @@
20 +/* This testcase is part of GDB, the GNU debugger.
21 +
22 +   Copyright 2011 Free Software Foundation, Inc.
23 +
24 +   This program is free software; you can redistribute it and/or modify
25 +   it under the terms of the GNU General Public License as published by
26 +   the Free Software Foundation; either version 3 of the License, or
27 +   (at your option) any later version.
28 +
29 +   This program is distributed in the hope that it will be useful,
30 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
31 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
32 +   GNU General Public License for more details.
33 +
34 +   You should have received a copy of the GNU General Public License
35 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
36 +
37 +#include <string.h>
38 +
39 +int
40 +main (int argc, char **argv)
41 +{
42 +  char s[2 + argc];
43 +  void (*f) (char *) = 0;
44 +
45 +  memset (s, 0, sizeof (s));
46 +  s[0] = 'X';
47 +
48 +  f (s);
49 +  return 0;
50 +}
51 --- /dev/null
52 +++ b/gdb/testsuite/gdb.base/vla-frame.exp
53 @@ -0,0 +1,38 @@
54 +# Copyright 2011 Free Software Foundation, Inc.
55 +#
56 +# This program is free software; you can redistribute it and/or modify
57 +# it under the terms of the GNU General Public License as published by
58 +# the Free Software Foundation; either version 3 of the License, or
59 +# (at your option) any later version.
60 +#
61 +# This program is distributed in the hope that it will be useful,
62 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
63 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
64 +# GNU General Public License for more details.
65 +#
66 +# You should have received a copy of the GNU General Public License
67 +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
68 +
69 +set testfile vla-frame
70 +set executable ${testfile}
71 +
72 +if { [prepare_for_testing ${testfile}.exp ${executable}] } {
73 +    return -1
74 +}
75 +
76 +if ![runto_main] {
77 +    return -1
78 +}
79 +
80 +set test "continue"
81 +gdb_test_multiple $test $test {
82 +    -re "Continuing\\.\r\n\r\nProgram received signal SIGSEGV, Segmentation fault\\.\r\n0x0+ in \\?\\? \\(\\)\r\n$gdb_prompt $" {
83 +       pass $test
84 +    }
85 +    -re "\r\n$gdb_prompt $" {
86 +       untested ${testfile}.exp
87 +       return
88 +    }
89 +}
90 +
91 +gdb_test "bt full" "\r\n +s = \"X\\\\000\"\r\n.*"
This page took 0.055216 seconds and 3 git commands to generate.