arm, objdump: print obsolote warning when 26-bit set in instructions
[binutils-gdb.git] / gdb / unittests / tracepoint-selftests.c
blob02700284548369615e4c09e6fca588ecbbd7e64b
1 /* Self tests for tracepoint-related code for GDB, the GNU debugger.
3 Copyright (C) 2018-2024 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 #include "gdbsupport/selftest.h"
21 #include "tracepoint.h"
23 namespace selftests {
24 namespace tracepoint_tests {
26 static void
27 test_parse_static_tracepoint_marker_definition ()
29 static_tracepoint_marker marker;
30 const char def[] = ("1234:6d61726b657231:6578747261207374756666,"
31 "abba:6d61726b657232:,"
32 "cafe:6d61726b657233:6d6f72657374756666");
33 const char *start = def;
34 const char *end;
36 parse_static_tracepoint_marker_definition (start, &end, &marker);
38 SELF_CHECK (marker.address == 0x1234);
39 SELF_CHECK (marker.str_id == "marker1");
40 SELF_CHECK (marker.extra == "extra stuff");
41 SELF_CHECK (end == strchr (start, ','));
43 start = end + 1;
44 parse_static_tracepoint_marker_definition (start, &end, &marker);
46 SELF_CHECK (marker.address == 0xabba);
47 SELF_CHECK (marker.str_id == "marker2");
48 SELF_CHECK (marker.extra == "");
49 SELF_CHECK (end == strchr (start, ','));
51 start = end + 1;
52 parse_static_tracepoint_marker_definition (start, &end, &marker);
54 SELF_CHECK (marker.address == 0xcafe);
55 SELF_CHECK (marker.str_id == "marker3");
56 SELF_CHECK (marker.extra == "morestuff");
57 SELF_CHECK (end == def + strlen (def));
60 } /* namespace tracepoint_tests */
61 } /* namespace selftests */
63 void _initialize_tracepoint_selftests ();
64 void
65 _initialize_tracepoint_selftests ()
67 selftests::register_test
68 ("parse_static_tracepoint_marker_definition",
69 selftests::tracepoint_tests::test_parse_static_tracepoint_marker_definition);