1 /* This testcase is part of GDB, the GNU debugger.
3 Copyright 2010-2019 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(script_name) \
29 .pushsection \".debug_gdb_scripts\", \"S\",%progbits\n\
30 .byte " XSTRING (SECTION_SCRIPT_ID_SCHEME_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 (SCRIPT_FILE
)
41 DEFINE_GDB_SCRIPT (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_SCHEME_TEXT) "\n" \
53 ".ascii \"gdb.inlined-script\\n\"\n" \
54 ".ascii \"(define test-cmd\\n\"\n" \
55 ".ascii \" (make-command \\\"test-cmd\\\"\\n\"\n" \
56 ".ascii \" #:command-class COMMAND_OBSCURE\\n\"\n" \
57 ".ascii \" #:invoke (lambda (self arg from-tty)\\n\"\n" \
58 ".ascii \" (display (format #f \\\"test-cmd output, arg = ~a\\n\\\" arg)))))\\n\"\n" \
59 ".ascii \"(register-command! 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 */