From owner-svn-src-all@freebsd.org Tue Oct 17 01:12:19 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 19677E4A32A; Tue, 17 Oct 2017 01:12:19 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D7D2474E2F; Tue, 17 Oct 2017 01:12:18 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9H1CHZM046519; Tue, 17 Oct 2017 01:12:17 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9H1CHSX046518; Tue, 17 Oct 2017 01:12:17 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201710170112.v9H1CHSX046518@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Tue, 17 Oct 2017 01:12:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324680 - head/sys/gdb X-SVN-Group: head X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: head/sys/gdb X-SVN-Commit-Revision: 324680 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Oct 2017 01:12:19 -0000 Author: rlibby Date: Tue Oct 17 01:12:17 2017 New Revision: 324680 URL: https://svnweb.freebsd.org/changeset/base/324680 Log: gdb kernel server: fixup Search:memory style This is a NFC patch to move around the Search:memory implementation so that it doesn't exceed the standard column width and doesn't take so much vertical space in gdb_trap. Submitted by: Daniel O'Connor Reviewed by: cem, jhb Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12684 Modified: head/sys/gdb/gdb_main.c Modified: head/sys/gdb/gdb_main.c ============================================================================== --- head/sys/gdb/gdb_main.c Tue Oct 17 00:25:44 2017 (r324679) +++ head/sys/gdb/gdb_main.c Tue Oct 17 01:12:17 2017 (r324680) @@ -94,6 +94,33 @@ gdb_init(void) return (cur_pri); } +static void +gdb_do_mem_search(void) +{ + size_t patlen; + intmax_t addr, size; + const unsigned char *found; + + if (gdb_rx_varhex(&addr) || gdb_rx_char() != ';' || + gdb_rx_varhex(&size) || gdb_rx_char() != ';' || + gdb_rx_bindata(gdb_bindata, sizeof(gdb_bindata), &patlen)) { + gdb_tx_err(EINVAL); + return; + } + if (gdb_search_mem((char *)(uintptr_t)addr, size, gdb_bindata, + patlen, &found)) { + if (found == 0ULL) + gdb_tx_begin('0'); + else { + gdb_tx_begin('1'); + gdb_tx_char(','); + gdb_tx_hex((intmax_t)(uintptr_t)found, 8); + } + gdb_tx_end(); + } else + gdb_tx_err(EIO); +} + static int gdb_trap(int type, int code) { @@ -257,27 +284,7 @@ gdb_trap(int type, int code) gdb_tx_end(); } } else if (gdb_rx_equal("Search:memory:")) { - size_t patlen; - intmax_t addr, size; - const unsigned char *found; - if (gdb_rx_varhex(&addr) || gdb_rx_char() != ';' || - gdb_rx_varhex(&size) || gdb_rx_char() != ';' || - gdb_rx_bindata(gdb_bindata, sizeof(gdb_bindata), &patlen)) { - gdb_tx_err(EINVAL); - break; - } - if (gdb_search_mem((char *)(uintptr_t)addr, size, gdb_bindata, patlen, &found)) { - if (found == 0ULL) - gdb_tx_begin('0'); - else { - gdb_tx_begin('1'); - gdb_tx_char(','); - gdb_tx_hex((intmax_t)(uintptr_t)found, 8); - } - gdb_tx_end(); - } else - gdb_tx_err(EIO); - break; + gdb_do_mem_search(); } else if (!gdb_cpu_query()) gdb_tx_empty(); break;