From patchwork Mon Oct 14 15:46:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 176256 Delivered-To: patches@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp4682825ill; Mon, 14 Oct 2019 08:46:31 -0700 (PDT) X-Received: by 2002:a1c:a708:: with SMTP id q8mr14318808wme.86.1571067990929; Mon, 14 Oct 2019 08:46:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571067990; cv=none; d=google.com; s=arc-20160816; b=XWrbx5rM42KBX0BddqX6rwVQ2kRgHEVPPVUzLg0/KvRIyxONwDrDFX1VKkCJ18Dfo8 zQz/I9zuv6r7QFP8+YowK+RAtUhmc06pOZX/88r+XQTFoXYUYDv0EGZyWITe/Yf6FaDr F+DvkOgsN3SLSx7rLiyn4hkldrocqsNQX0XOEeFvFRL6ubOms2mi+7Omgn4+3AKPL9kh KfVMDMtxufkdeELoHF7PDjfy3Nt1uQ+web9jPA6j2CQ/q2kqIR2X1+XGY3XkzOGDDspI tk39RHl98lWsyzrKOLuHovUqvI7xh8iaJEOg6yxDM/Whn334xFgow1xdgRKJnAMi0/52 YfwQ== 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=gqnH5u+Rmz2NG69129OK2vF9yH2mCkTespyQ46VZaP8=; b=SM5abQZwrxxm+xvhSf3PjFkQuadAO+LEg5a3xM1jOD9Zmen2hheP8SXG0MWB9KpGKA QbalJXHB9bShOyoKlpWGAkvUja9gyB7246TbnzaikHhP682qqtzJvXxx572wVMsa6QOR DHenv0J3HMzNSsvUC19ZpGCeLmWh3dJtSYgm1I+2slymVJb2e/ZZhUsg2BgaLm70eDTM Fdgfj7JQpUTj70fJFPEOPcoRGtg+wk0y4qvnO8iEiRqHvPAbBdoreR/ilOW1Ft5zNlOf wl6begBZGo4oz68ptDsmC4CYxiAi8wtcd+0l+LnyCEOK48vtkp5iB8bMfRCfvmEKAMQB p2vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JnB1O5Qm; 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 p19sor10856312wme.10.2019.10.14.08.46.30 for (Google Transport Security); Mon, 14 Oct 2019 08:46:30 -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=JnB1O5Qm; 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=gqnH5u+Rmz2NG69129OK2vF9yH2mCkTespyQ46VZaP8=; b=JnB1O5QmG2avz0u1r/tYNyNtqVV3ZL9hHVUvFV60SIzhrPzy9leC5ZvDm19z/f4bcO 0gRaKyu4pgOPEzDnNkaJL6I/DjcFznx8QzRIGuWuWYTY6H5XWW6Quh7P5DtfDTmACNVs +0MKKHGZlzVbW4Tsdmzk1TAK/wWE9YRc/JElqor1Q62XSKgfOphUyhi0KdpoPx8ExNvF /E+RrbHctSrcNpffZ9br7HF4gDXO+Ey38oQjG3Lv2bzfEQhKyNlOFb1522zQt4FLRiIr slZAZdK0wW9bxM8C7TQYVJ9TFwqG1uoMCYYkbsmbZ3pOjwuLxBe1wtaCE00K3rLOOwbA MsYQ== 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=gqnH5u+Rmz2NG69129OK2vF9yH2mCkTespyQ46VZaP8=; b=mEcqVOSyHcgfAbE1eMtNruAKc3HxQYq9R+u/AmcD5iu79HIymAwM/UBpVyILUwNEGB 5sn5ilW0RK42a1KmiHkBAAtXHvO9ArC7lBQ61s2IBaVxS+4kRieuRv2T+69802er/RjM utwSY3hJtymQom+hM4OKyFVyWoTXUfPgBSCFyspbERSz0RT+tM3A9ybKWBMTZnZYyaUw nd2ztuVflT8/FR7GIShMy8QAE4jcpgqNPEQC81w60gJhK4lSNdz/WBHlz46bgSCQylhg A2InuvdbZchMKLSRGDvtr4nsTAaeQyGzJM7nMJVUouHaYzrrRhU8/EWQSlmZW+MsI9jQ GI9w== X-Gm-Message-State: APjAAAUGPtDzCwxAjC8nf/4LZ9NLvhvKNSqafO+D2uU1J44DPIWDbMJf xFSiO6f5Ed9T2FA9QOPeWEja/vpd6MMI4C/6 X-Google-Smtp-Source: APXvYqwGT4KOZXWes00rIf6fjnXihAP+4JZg25EojQh4Euuu0pxswSBdYFr1OfRcypxedl5j8+hG4w== X-Received: by 2002:a7b:c7d3:: with SMTP id z19mr12069411wmk.83.1571067990478; Mon, 14 Oct 2019 08:46:30 -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 q22sm16539738wmj.5.2019.10.14.08.46.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2019 08:46:29 -0700 (PDT) From: Daniel Thompson To: Jason Wessel , Douglas Anderson Cc: Daniel Thompson , kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org, patches@linaro.org Subject: [PATCH v3 0/5] kdb: Cleanup code to read user input and handle escape sequences Date: Mon, 14 Oct 2019 16:46:21 +0100 Message-Id: <20191014154626.351-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 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 | 229 ++++++++++++++++----------------- kernel/debug/kdb/kdb_private.h | 1 + 3 files changed, 123 insertions(+), 129 deletions(-) -- 2.21.0