Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4747580ybp; Mon, 14 Oct 2019 09:23:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqzzWQgwOGGT5ZCw+/RnPiu9ydA4UpaLpDjcZ1tXnwE0l+ma9ORI4X+Kq2gJ2RwoX3rmREa3 X-Received: by 2002:a17:906:524b:: with SMTP id y11mr13733692ejm.82.1571070231747; Mon, 14 Oct 2019 09:23:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571070231; cv=none; d=google.com; s=arc-20160816; b=qw5xphxThBABEQhO9GHhwGoTaBY5M6IXWdzaITlyF/fHaojPmetwM9EYDu0vPJCC+L MgAzfEnf7e5AClOBPIOUgck75wzQIhSujHjvqgGboBYPxakb2ouu9XJ/LnPqPxuW9OVv ukG0mTRXUazyAgz9LlV4X1JeHjJw7/ji211FgRLweawy2WrLTobgMgIs6/6LI3ZXIivL l0rLTKESfocRW5k+F0Kwl2si/kHqJFc1kaP5YlxOA63caiOPkJTlcB6Cq1aUpGL4TW7Z o+de0nyLHp5PzasH4wPRALF8f2oShAO25srwZVtaI9BiMiftbBl+tzqx/Zr99fRpKHlJ P12A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=gqnH5u+Rmz2NG69129OK2vF9yH2mCkTespyQ46VZaP8=; b=n+0sMCMeSayoO6RQZ92nrBevoagw1lQX027vDXSk4D48Ms/3UgKIppPXGruYBACZc9 XnYQdKo3Ot6Iu1pqJGnZDWrX/aH4wMrIJvMuwuYUVQ588M5bCOqVBYTr8pZ/K9HNQNSl +56WYNZvu2WlPAlUlJVT7rJkZ7a6gfOQbeuSX4XbEqlYJ14zSdFT/kbZ2VrACwtvODLt twvNclXMYGgc4yLrEyJgURRpOQkO0vXGiitjPtoOOmPrlDh3HQwyUDZQCbU4DVxGTlSY uO+lk92eg/CemfD8yT5t3aNrEcFzgODFhyqp9zQtwm3sXpu5tORBwWz3ufSu+GqPysd5 NVlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JnB1O5Qm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v13si11689947edy.441.2019.10.14.09.23.28; Mon, 14 Oct 2019 09:23:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JnB1O5Qm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731189AbfJNPqc (ORCPT + 99 others); Mon, 14 Oct 2019 11:46:32 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:37992 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729930AbfJNPqc (ORCPT ); Mon, 14 Oct 2019 11:46:32 -0400 Received: by mail-wm1-f67.google.com with SMTP id 3so17256754wmi.3 for ; Mon, 14 Oct 2019 08:46:31 -0700 (PDT) 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=Bb0hX7i+R3QAjz/AIvx9vUoTPaa8mVYUOZCisxyI9UB/QOEPU/ZUhe+rkAzqShzd3p fNowxmZ/FJqu/hq/+aQ5QRVUN8/q88sb2Bp1aC1qbkuLe6rJUGF1dxe4L2zibsmlDjU0 FNuW3lSHVcY0DDpiaKmSpa+rb7UvM+OsJxP/NtdZbWuar1Dv+JMDdUAn7UQsC5dJmkIW MIw8FkPpfDjZ6drh3RMH+66aAnReIXi+OkZzfcgpp9ChIiN/bz49tR4qxw6jLwClLOhK wDoZLPU/TaBfNnjEk+yCfhTAnhoeYnnbduRhxZJBS6HXgbiirlFIcQt0rfpBT3U5Tz7d bJpQ== X-Gm-Message-State: APjAAAV8oHBhpaXS4ef4fJLq+DsSku/Tov6pd3iSUi/lZTPWNhD+b6wz YFsj2+hGr76T3hS+VSR+bpFFuw== X-Received: by 2002:a7b:c7d3:: with SMTP id z19mr12069411wmk.83.1571067990478; Mon, 14 Oct 2019 08:46:30 -0700 (PDT) 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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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