1 /* This testcase is part of GDB, the GNU debugger.
3 Copyright 2010-2015 Free Software Foundation, Inc.
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.
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.
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/>. */
19 #include "gdb/section-scripts.h"
21 /* Put the path to the pretty-printer script in .debug_gdb_scripts so
22 gdb will automagically loaded it.
23 Normally "MS" would appear here, as in
24 .pushsection ".debug_gdb_scripts", "MS",@progbits,1
25 but we remove it to test files appearing twice in the section. */
27 #define DEFINE_GDB_SCRIPT_FILE(script_name) \
29 .pushsection \".debug_gdb_scripts\", \"S\",@progbits\n\
30 .byte " XSTRING (SECTION_SCRIPT_ID_PYTHON_FILE) "\n\
31 .asciz \"" script_name "\"\n\
36 #error "SCRIPT_FILE not defined"
39 /* Specify it twice to verify the file is only loaded once. */
40 DEFINE_GDB_SCRIPT_FILE (SCRIPT_FILE
)
41 DEFINE_GDB_SCRIPT_FILE (SCRIPT_FILE
)
43 /* Inlined scripts are harder to create in the same way as
44 DEFINE_GDB_SCRIPT_FILE. Keep things simple and just define it here.
45 Normally "MS" would appear here, as in
46 .pushsection ".debug_gdb_scripts", "MS",@progbits,1
47 but we remove it to test scripts appearing twice in the section. */
49 #define DEFINE_GDB_SCRIPT_TEXT \
51 ".pushsection \".debug_gdb_scripts\", \"S\",@progbits\n" \
52 ".byte " XSTRING (SECTION_SCRIPT_ID_PYTHON_TEXT) "\n" \
53 ".ascii \"gdb.inlined-script\\n\"\n" \
54 ".ascii \"class test_cmd (gdb.Command):\\n\"\n" \
55 ".ascii \" def __init__ (self):\\n\"\n" \
56 ".ascii \" super (test_cmd, self).__init__ (\\\"test-cmd\\\", gdb.COMMAND_OBSCURE)\\n\"\n" \
57 ".ascii \" def invoke (self, arg, from_tty):\\n\"\n" \
58 ".ascii \" print (\\\"test-cmd output, arg = %s\\\" % arg)\\n\"\n" \
59 ".ascii \"test_cmd ()\\n\"\n" \
64 /* Specify it twice to verify the script is only executed once. */
65 DEFINE_GDB_SCRIPT_TEXT
66 DEFINE_GDB_SCRIPT_TEXT
75 init_ss (struct ss
*s
, int a
, int b
)
88 return 0; /* break to inspect struct and union */