1 /***************************************************************************
3 * Copyright (C) ST-Ericsson SA 2011 *
4 * Author: Michel Jaouen <michel.jaouen@stericsson.com> for ST-Ericsson. *
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 2 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/>. *
17 ***************************************************************************/
23 #include "server/server.h"
25 #include "target/target.h"
27 #include "server/gdb_server.h"
29 #include "helper/binarybuffer.h"
31 /* implementation of new packet in gdb interface for smp feature */
33 /* j : smp status request */
34 /* J : smp set request */
36 /* jc :read core id displayed by gdb connection */
37 /* reply XXXXXXXX core id is int32_t , 8 hex digits */
39 /* Reply ENN error not supported (target not smp) */
41 /* JcXX set core id displayed at next gdb continue */
42 /* maximum 8 bytes described core id int32_t (8 hex digits) */
43 /* (core id -1 , reserved for returning to normal continue mode) */
44 /* Reply ENN error not supported(target not smp,core id out of range) */
45 /* Reply OK : for success */
47 /* handling of this packet within gdb can be done by the creation */
48 /* internal variable by mean of function allocate_computed_value */
49 /* set $_core 1 => Jc01 packet is sent */
50 /* print $_core => jc packet is sent and result is affected in $ */
51 /* Another way to test this packet is the usage of maintenance packet */
52 /* maint packet Jc01 */
55 /* packet j :smp status request */
56 int gdb_read_smp_packet(struct connection
*connection
,
57 char const *packet
, int packet_size
)
59 struct target
*target
= get_target_from_connection(connection
);
60 int retval
= ERROR_OK
;
62 if (strncmp(packet
, "jc", 2) == 0) {
63 const uint32_t len
= sizeof(target
->gdb_service
->core
[0]);
64 char hex_buffer
[len
* 2 + 1];
66 buf_set_u32(buffer
, 0, len
* 8, target
->gdb_service
->core
[0]);
67 size_t pkt_len
= hexify(hex_buffer
, buffer
, sizeof(buffer
),
70 retval
= gdb_put_packet(connection
, hex_buffer
, pkt_len
);
73 retval
= gdb_put_packet(connection
, "E01", 3);
77 /* J : smp set request */
78 int gdb_write_smp_packet(struct connection
*connection
,
79 char const *packet
, int packet_size
)
81 struct target
*target
= get_target_from_connection(connection
);
84 int retval
= ERROR_OK
;
86 /* skip command character */
88 if (strncmp(packet
, "Jc", 2) == 0) {
90 coreid
= strtoul(packet
, &separator
, 16);
91 target
->gdb_service
->core
[1] = coreid
;
92 retval
= gdb_put_packet(connection
, "OK", 2);
95 retval
= gdb_put_packet(connection
, "E01", 3);
100 COMMAND_HANDLER(default_handle_smp_command
)
102 struct target
*target
= get_current_target(CMD_CTX
);
103 struct target_list
*head
;
106 return ERROR_COMMAND_SYNTAX_ERROR
;
109 command_print(CMD_CTX
, "%s", target
->smp
? "on" : "off");
113 if (!strcmp(CMD_ARGV
[0], "on")) {
114 foreach_smp_target(head
, target
->head
)
115 head
->target
->smp
= 1;
120 if (!strcmp(CMD_ARGV
[0], "off")) {
121 foreach_smp_target(head
, target
->head
)
122 head
->target
->smp
= 0;
124 /* fixes the target display to the debugger */
126 target
->gdb_service
->target
= target
;
131 return ERROR_COMMAND_SYNTAX_ERROR
;
134 COMMAND_HANDLER(deprecated_handle_smp_on_command
)
136 const char *argv
[] = {"on", NULL
};
138 LOG_WARNING("\'smp_on\' is deprecated, please use \'smp on\' instead.");
141 return CALL_COMMAND_HANDLER(default_handle_smp_command
);
144 COMMAND_HANDLER(deprecated_handle_smp_off_command
)
146 const char *argv
[] = {"off", NULL
};
148 LOG_WARNING("\'smp_off\' is deprecated, please use \'smp off\' instead.");
151 return CALL_COMMAND_HANDLER(default_handle_smp_command
);
154 const struct command_registration smp_command_handlers
[] = {
157 .handler
= default_handle_smp_command
,
158 .mode
= COMMAND_EXEC
,
159 .help
= "smp handling",
164 .handler
= deprecated_handle_smp_on_command
,
165 .mode
= COMMAND_EXEC
,
166 .help
= "Restart smp handling",
171 .handler
= deprecated_handle_smp_off_command
,
172 .mode
= COMMAND_EXEC
,
173 .help
= "Stop smp handling",
176 COMMAND_REGISTRATION_DONE
Linking to existing account procedure
If you already have an account and want to add another login method
you
MUST first sign in with your existing account and
then change URL to read
https://review.openocd.org/login/?link
to get to this page again but this time it'll work for linking. Thank you.
SSH host keys fingerprints
1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=.. |
|+o.. . |
|*.o . . |
|+B . . . |
|Bo. = o S |
|Oo.+ + = |
|oB=.* = . o |
| =+=.+ + E |
|. .=o . o |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)