From patchwork Fri Oct 25 07:33:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 177674 Delivered-To: patches@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp3285923ill; Fri, 25 Oct 2019 00:33:42 -0700 (PDT) X-Received: by 2002:adf:a506:: with SMTP id i6mr1448013wrb.159.1571988822759; Fri, 25 Oct 2019 00:33:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571988822; cv=none; d=google.com; s=arc-20160816; b=XYhfHQO4bDuYB9SngMoA0XbEQZfkIHCsVBY4Xvn7fVlxGZqb2yzjj8oy+kDOB2ua3H PfBvGflw0JhDqSn6hfXj5pUoNBk64gkz3hyL5BEnAzosmJz/9E9zD0RNarXDsNx0VxWW hT856EgsPdUgOETTgsVhLu0XLSRC+p0Gp4phspshKvhka0s08hUsx/G0cz66hUjRtO+t /LiMjH6uE6UFkxb1K8RM2F+OYTB4Ll2mjBsKqAJsHi8hhxLbdTOG9OKd4xifDEO3n98o WWnbsDh+Djfede6WY865kloyP0IFt0uhXDzqPuOFQGqGPS7phtaq+hw9nY6Yo0GMcJsi tO/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=AZwaHL4zUXAc+2jSAvKzwc1oPJbnq12fm9YvyXEq80U=; b=KdA795PL/Z0Pgq5exxR0pscK7Fqfmdf+12jpC6OuVldPWl+3pBH674mthdk+A1ot4z FVUUsVEo/yinEIH3ARJuIW1eARwO7KWAQD3N349V3a9iod0YmilYgMJrw9M2txjZ+OLv gVrLxcO+BpOnXVB6ZEn9CeuESsF2A/bsrE+v/6l0f1N6WAc62mHZCACJcTcEUpmalkOe xcDm4EtHqDQkc8iBC4DJUq9aFx9EEbIUip8BofHy73vI6zUZhdFkvDpNmsUXExLwSj6l V9MrypQ8+EQah3xB/KGfBTM0KwEl/o9rdsIX+Pmw+EykEvEwofJ1krb2NjGw4JfBru3L CBEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cPO878sF; spf=pass (google.com: domain of daniel.thompson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=daniel.thompson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id p30sor815491wmi.9.2019.10.25.00.33.42 for (Google Transport Security); Fri, 25 Oct 2019 00:33:42 -0700 (PDT) Received-SPF: pass (google.com: domain of daniel.thompson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cPO878sF; spf=pass (google.com: domain of daniel.thompson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=daniel.thompson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=AZwaHL4zUXAc+2jSAvKzwc1oPJbnq12fm9YvyXEq80U=; b=cPO878sFxyYN1EKPeQuJv1STDEUAJr98GQYzetFPL6WpyIB18hWX4V2ABvwFcm3jRn HnsZNFrinwvAzLvxMZzvJIpL1roUaOWPV5b/KsxP6gfH+Dl3YNr1GRdHpvn/qFhYbEKP j+mbqHQgGiGNDiADkDClK/N/Z0uDKefzLlDFpWXaO+sxM7Q4Et5kPiGde42pJYOoXypk Lgt12VLvP/SNW2jZe3+Ci+yoJ9bVwpfWIv4y0+g6n7FBThRxYpwPDTk9Ne09WY20+dEi eqnRECEquGCOjH+OuJa5aecfkdXeh5LuwxOuudonI1xS1tg+J8bW+GPItBtz4rm5zdjc kpYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=AZwaHL4zUXAc+2jSAvKzwc1oPJbnq12fm9YvyXEq80U=; b=VWrwQa30m7p+EScnspuW2p8MNt6AGuAAgu0dtUR6XX/ZwPm6Nxzyb3/m579JK7yHU6 OYXvWY/sJ1Z8UXX4Sdgg3nljwXSioMo5EXybmTufOdoamIFeopcPL2rjZdDgCyW3BgEx 4gBrOyIIBD4l/2mB1QJcB3u/r5jVqqcIhwIOkhzn2+v6q1cmgP7kt5w1ln0jXubp0a+m xS0TnV+kYPlYK/6ABP0qB0t4ylNJaWM84r60gOGBV7XDUG9VONp0LxQ6ltQ5akf727MN RjznxIoT5JcRiavQPaDf6OtR2RiarKlLfJ1SMh/qvdnTkKocakOHwxiuPM5fdN2BERqh mzEQ== X-Gm-Message-State: APjAAAXifjBzpBRALEr6QJuVKWIQNEyZ/XVnJMqieBVmNssTg2BzF3b9 j3TlusBvW67ZkJkR3bPakUa7K09ON9q3UIgq X-Google-Smtp-Source: APXvYqyHtw1To5nIiVgf+IJKA3aSW6xtEhJEmCS+qT03yi8R7IUoUo5PIOyYFa+izhGvlsOZA/ldGw== X-Received: by 2002:a1c:730e:: with SMTP id d14mr2113496wmb.165.1571988822284; Fri, 25 Oct 2019 00:33:42 -0700 (PDT) Return-Path: Received: from wychelm.lan (cpc141214-aztw34-2-0-cust773.18-1.cable.virginm.net. [86.9.19.6]) by smtp.gmail.com with ESMTPSA id a11sm1586602wmh.40.2019.10.25.00.33.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2019 00:33:41 -0700 (PDT) From: Daniel Thompson To: Douglas Anderson , Jason Wessel Cc: Daniel Thompson , kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org, patches@linaro.org Subject: [PATCH v4 0/5] kdb: Cleanup code to read user input and handle escape sequences Date: Fri, 25 Oct 2019 08:33:23 +0100 Message-Id: <20191025073328.643-1-daniel.thompson@linaro.org> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 I've been meaning to repost this for some time, and inspired by having someone keen to review it, I dug it out again! I split this as carefully as I could into small pieces but the original code was complex so even in small bits it doesn't make for light reading. Things do make more sense once you realize/remember that escape_delay is a count down timer that expires the escape sequences! Most of the patches are simple tidy ups although patches 4 and 5 introduce new behaviours. Patch 4 shouldn't be controversial but perhaps patch 5 is (although hopefully not ;-) ). Mostly this is auto tested, see here: https://github.com/daniel-thompson/kgdbtest/commit/c65e28d99357c2df6dac2cebe195574e634d04dc Changes in v4: - Sorry this is late. Looks like I got so distracted by testing the series I forgot to post it to the lists. - Introduced kdb_handle_escape() in patch 1 (instead of renaming it in the middle of the patch series) and documented it in kernel doc format. - Adopted do {} while for the character fetch loop in kdb_bt.c - Added Doug's reviewed-by to the remaining patches. The kept them despite the subtle internal reorg w.r.t. kdb_handle_escape() since the whole patchset has changed little since he last saw it (beyond fixing his review comments). Changes in v3: - Accepted all review comments from Doug (except the return type of kdb_getchar() as discussed in the mail threads). In particular this fixes a bug in the handling of the btaprompt. - Added Doug's reviewed-by to patches 1 and 2. Changes in v2: - Improve comment in patch 4 to better describe what is happening - Rebase on v5.4-rc2 Daniel Thompson (5): kdb: Tidy up code to handle escape sequences kdb: Simplify code to fetch characters from console kdb: Remove special case logic from kdb_read() kdb: Improve handling of characters from different input sources kdb: Tweak escape handling for vi users kernel/debug/kdb/kdb_bt.c | 22 ++-- kernel/debug/kdb/kdb_io.c | 231 ++++++++++++++++----------------- kernel/debug/kdb/kdb_private.h | 1 + 3 files changed, 125 insertions(+), 129 deletions(-) -- 2.21.0