Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2499353ybp; Thu, 10 Oct 2019 08:15:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqzBQqXef9M8nMBZNSX7IOwHjgSN1sgLFbiS3KUCU21LmRcWtEwEE2LpQch2oBP2+INZybRO X-Received: by 2002:a50:8d8a:: with SMTP id r10mr8775743edh.302.1570720529042; Thu, 10 Oct 2019 08:15:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570720529; cv=none; d=google.com; s=arc-20160816; b=ahskoODJh2xBGu4PssXj5rF+C5BbpshQqdUtsCRQLmykpqMIJw8jZtLGagWbI1dcxb 0Fnnt7lK6V5/gna7dGnCrdGOlg+E2HMqcm21NJbXDi0wn8iH2lyN8hszd5kqN4vrBUbf Nu2O6izVy9MiSOPMv/EXzwXO1p7cvC8h+0yorEmI7s4pk7gdq840WM5dAf427Rp1v0ji Tnq99yZ8xs6mvPP/nwuSKlWxZKkcgY1XXlb7pSm4OcolCr6CjqjIv3+70LPDVJUztkYu FT4Jt8N8d9TL9nJbTntfxpwhfXqewdsDUq6ZEiMFAuBi1F4cNL988M4JOCEdlLpOa0lw /kcA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=flNBjoHLYRpfB1swiJIDCxGp8L9aIeu1d4VrshAl9TY=; b=QhXqSq2YZ2HDYm+hCkxtRyHrn/yHQjoIOJHsfYFOO5HxaZZgprv93+hglujozUo9kY LGgW4aKqDo2wJxihvdjWQgIskCzq9GsT3DMqiWinKxMsMiGdl5vL8ngVSBO2Fq6yo6L/ 9i8U8dmGcuDYnB/2De9WBJDaFMs8TNjV/pP+yAB1gGj9KoHQJ6e5Yn9QjCbYrs3FoMg5 bC18907oFu0qkxJNhSRw3iF/YebRmqtHBg44yBeH2DEd3SHCg4JyhqPO0CQcHJV7QXxT WCqC4ZW49lPNHcrOIVRKpP8SGN9I8ArjlE/M/AtHxv0WecBN5sI58R6l5qMiwptVzAL5 1Vsw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=siemens.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h26si3220087ejx.177.2019.10.10.08.15.04; Thu, 10 Oct 2019 08:15:29 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726415AbfJJPOE (ORCPT + 99 others); Thu, 10 Oct 2019 11:14:04 -0400 Received: from goliath.siemens.de ([192.35.17.28]:46516 "EHLO goliath.siemens.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725901AbfJJPOD (ORCPT ); Thu, 10 Oct 2019 11:14:03 -0400 Received: from mail2.sbs.de (mail2.sbs.de [192.129.41.66]) by goliath.siemens.de (8.15.2/8.15.2) with ESMTPS id x9AFDvdJ011240 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 10 Oct 2019 17:13:57 +0200 Received: from [139.25.68.37] ([139.25.68.37]) by mail2.sbs.de (8.15.2/8.15.2) with ESMTP id x9AFDuI1025064; Thu, 10 Oct 2019 17:13:56 +0200 Subject: Re: [PATCH] scripts/gdb: fix lx-dmesg when CONFIG_PRINTK_CALLER is set To: Joel Colledge , Kieran Bingham , Andrew Morton Cc: linux-kernel@vger.kernel.org References: <20190925150308.6609-1-joel.colledge@linbit.com> From: Jan Kiszka Message-ID: Date: Thu, 10 Oct 2019 17:13:56 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: <20190925150308.6609-1-joel.colledge@linbit.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 25.09.19 17:03, Joel Colledge wrote: > When CONFIG_PRINTK_CALLER is set, struct printk_log contains an > additional member caller_id. As a result, the offset of the log text is > different. > > This fixes the following error: > > (gdb) lx-dmesg > Python Exception embedded null character: > Error occurred in Python command: embedded null character > > Signed-off-by: Joel Colledge > --- > scripts/gdb/linux/constants.py.in | 1 + > scripts/gdb/linux/dmesg.py | 4 +++- > 2 files changed, 4 insertions(+), 1 deletion(-) > > diff --git a/scripts/gdb/linux/constants.py.in b/scripts/gdb/linux/constants.py.in > index 2efbec6b6b8d..3c9794a0bf55 100644 > --- a/scripts/gdb/linux/constants.py.in > +++ b/scripts/gdb/linux/constants.py.in > @@ -74,4 +74,5 @@ LX_CONFIG(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) > LX_CONFIG(CONFIG_HIGH_RES_TIMERS) > LX_CONFIG(CONFIG_NR_CPUS) > LX_CONFIG(CONFIG_OF) > +LX_CONFIG(CONFIG_PRINTK_CALLER) > LX_CONFIG(CONFIG_TICK_ONESHOT) > diff --git a/scripts/gdb/linux/dmesg.py b/scripts/gdb/linux/dmesg.py > index 6d2e09a2ad2f..1352680ef731 100644 > --- a/scripts/gdb/linux/dmesg.py > +++ b/scripts/gdb/linux/dmesg.py > @@ -14,6 +14,7 @@ > import gdb > import sys > > +from linux import constants > from linux import utils > > > @@ -53,7 +54,8 @@ class LxDmesg(gdb.Command): > continue > > text_len = utils.read_u16(log_buf[pos + 10:pos + 12]) > - text = log_buf[pos + 16:pos + 16 + text_len].decode( > + text_start = pos + (20 if constants.LX_CONFIG_PRINTK_CALLER else 16) > + text = log_buf[text_start:text_start + text_len].decode( > encoding='utf8', errors='replace') > time_stamp = utils.read_u64(log_buf[pos:pos + 8]) > > Sorry for the delay: Reviewed-by: Jan Kiszka I suspect we will see more in nearer future with upcoming printk rework... Jan -- Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux