Deleted Added
full compact
gdb_main.c (234196) gdb_main.c (271173)
1/*-
2 * Copyright (c) 2004 Marcel Moolenaar
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *

--- 11 unchanged lines hidden (view full) ---

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2004 Marcel Moolenaar
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *

--- 11 unchanged lines hidden (view full) ---

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/gdb/gdb_main.c 234196 2012-04-12 21:34:58Z jhb $");
28__FBSDID("$FreeBSD: head/sys/gdb/gdb_main.c 271173 2014-09-05 16:40:47Z benno $");
29
30#include <sys/param.h>
31#include <sys/systm.h>
32#include <sys/kdb.h>
33#include <sys/kernel.h>
34#include <sys/pcpu.h>
35#include <sys/proc.h>
36#include <sys/reboot.h>

--- 11 unchanged lines hidden (view full) ---

48
49static struct gdb_dbgport null_gdb_dbgport;
50DATA_SET(gdb_dbgport_set, null_gdb_dbgport);
51SET_DECLARE(gdb_dbgport_set, struct gdb_dbgport);
52
53struct gdb_dbgport *gdb_cur = NULL;
54int gdb_listening = 0;
55
29
30#include <sys/param.h>
31#include <sys/systm.h>
32#include <sys/kdb.h>
33#include <sys/kernel.h>
34#include <sys/pcpu.h>
35#include <sys/proc.h>
36#include <sys/reboot.h>

--- 11 unchanged lines hidden (view full) ---

48
49static struct gdb_dbgport null_gdb_dbgport;
50DATA_SET(gdb_dbgport_set, null_gdb_dbgport);
51SET_DECLARE(gdb_dbgport_set, struct gdb_dbgport);
52
53struct gdb_dbgport *gdb_cur = NULL;
54int gdb_listening = 0;
55
56static unsigned char gdb_bindata[64];
57
56static int
57gdb_init(void)
58{
59 struct gdb_dbgport *dp, **iter;
60 int cur_pri, pri;
61
62 gdb_cur = NULL;
63 cur_pri = -1;

--- 185 unchanged lines hidden (view full) ---

249 if (thr_iter != NULL) {
250 gdb_tx_begin('m');
251 gdb_tx_hex((long)thr_iter->td_tid, 8);
252 gdb_tx_end();
253 } else {
254 gdb_tx_begin('l');
255 gdb_tx_end();
256 }
58static int
59gdb_init(void)
60{
61 struct gdb_dbgport *dp, **iter;
62 int cur_pri, pri;
63
64 gdb_cur = NULL;
65 cur_pri = -1;

--- 185 unchanged lines hidden (view full) ---

251 if (thr_iter != NULL) {
252 gdb_tx_begin('m');
253 gdb_tx_hex((long)thr_iter->td_tid, 8);
254 gdb_tx_end();
255 } else {
256 gdb_tx_begin('l');
257 gdb_tx_end();
258 }
259 } else if (gdb_rx_equal("Search:memory:")) {
260 size_t patlen;
261 intmax_t addr, size;
262 const unsigned char *found;
263 if (gdb_rx_varhex(&addr) || gdb_rx_char() != ';' ||
264 gdb_rx_varhex(&size) || gdb_rx_char() != ';' ||
265 gdb_rx_bindata(gdb_bindata, sizeof(gdb_bindata), &patlen)) {
266 gdb_tx_err(EINVAL);
267 break;
268 }
269 if (gdb_search_mem((char *)(uintptr_t)addr, size, gdb_bindata, patlen, &found)) {
270 if (found == 0ULL)
271 gdb_tx_begin('0');
272 else {
273 gdb_tx_begin('1');
274 gdb_tx_char(',');
275 gdb_tx_hex((intmax_t)(uintptr_t)found, 8);
276 }
277 gdb_tx_end();
278 } else
279 gdb_tx_err(EIO);
280 break;
257 } else if (!gdb_cpu_query())
258 gdb_tx_empty();
259 break;
260 case 's': { /* Step. */
261 uintmax_t addr;
262 register_t pc;
263 if (!gdb_rx_varhex(&addr)) {
264 pc = addr;

--- 42 unchanged lines hidden ---
281 } else if (!gdb_cpu_query())
282 gdb_tx_empty();
283 break;
284 case 's': { /* Step. */
285 uintmax_t addr;
286 register_t pc;
287 if (!gdb_rx_varhex(&addr)) {
288 pc = addr;

--- 42 unchanged lines hidden ---