Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1895832ybn; Thu, 26 Sep 2019 03:58:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqyMAQ6ZAl2hyHCDhSkuTAz0DjihNxdkiIT8ngAKMGQZbtGZmk9hsXrmO4Qbz3bdVNoNcL4J X-Received: by 2002:a17:906:9381:: with SMTP id l1mr2442427ejx.93.1569495520254; Thu, 26 Sep 2019 03:58:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569495520; cv=none; d=google.com; s=arc-20160816; b=t+h8F6eYlykyQVYfmPTvsk9hqdR6OTFc32EMZmSQ8p+K40miB+gMpTkLV2w22Ibh/D bqtB1V1la+I53jQzg6lktPZ3U+LrbE9GAFCktPXpJlT6FPuON8acW213JEENPqWtVRfT AZ6dzYU+meowcyg/YONAm3Qdm6WPNx836sKSZPH4qEjCea1oaXx3MwcNKvqX3s+8elaf oip3Ifkqkj2wIfemg5/gW+bV+rExUnyVgsJldmAJJ9RGFFtrvf3/50hsLNcZLeEHQAvb nNQHJhrXtTYPQFAbES+45pTmppCuEubUEGN9rZTZl+ph2VBLFLBEXn7iI4qdwW8/PVuC w8aQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=vZ1ZsSVj18a6RvTBAEr2379v7Y7nRqSApdj4dC7ZSqE=; b=n1wFDZ9yAodws/UY98qHRMyYZVih/lIngaq6hMD8clzpPCPHYJ3PbFeKRB25SpSWpG wcZFs4Zw3/vIcNuMSulk6p8Tc3F4Dn3kpXdjx+vJDeFkLS1rX7CTL1hj8d5/6NGFQ7Xf bDJY2/N+pf+zIrqSXq4JtYLPxfJxrA7+U3udNERnZG1U2ieujoiOTAwZyPnwWxWwBky/ HMLeFf9KHlXKztKQS6tkOXwdg8LYRX/iA66sGNiAnWGJJlYtkHVzFEcQ8vQsgjzxusu7 aj0l6xznBBDRWweEhy/0FYGWfiF3OHYXDL4GBu6c24AUxC22hTkyKeL4bWi51C6HnFfM gxjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linbit-com.20150623.gappssmtp.com header.s=20150623 header.b=fpgGkcR6; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c14si1030220edc.81.2019.09.26.03.58.17; Thu, 26 Sep 2019 03:58:40 -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=@linbit-com.20150623.gappssmtp.com header.s=20150623 header.b=fpgGkcR6; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438869AbfIYPDz (ORCPT + 99 others); Wed, 25 Sep 2019 11:03:55 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:33029 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726036AbfIYPDz (ORCPT ); Wed, 25 Sep 2019 11:03:55 -0400 Received: by mail-wr1-f65.google.com with SMTP id b9so7364782wrs.0 for ; Wed, 25 Sep 2019 08:03:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linbit-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=vZ1ZsSVj18a6RvTBAEr2379v7Y7nRqSApdj4dC7ZSqE=; b=fpgGkcR6PeJ4SAhhpwKidK9B5w7sjAWVH2wvqRQ4LIvIpIvc3OIBuUlVqThZTJKiK7 fVCEL1P8JI82K0B2ELC7DC0ydThjPHvhVQlLkGrU62xtPFw8gDzRqrWD8RRV5klViBv9 /8vW5p8ua1TL+cdZLl8K+laWT7dti4mc/tn6j/3e9MxywiUFteLbSq3Ckk2XnbdqwHKa dlQfSFcki5lUItZs92CaKHhfu+ytsPZFLvkDf2IxR3rde0xyPySS2G6SqESIyVwegojF SlcLYuQXlLjm/lTUoyBUR5QtWwpnjoY2mdVeioCbo+4JPG9yrcQNVvDqkWu58MdWD7eG 1WMw== 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; bh=vZ1ZsSVj18a6RvTBAEr2379v7Y7nRqSApdj4dC7ZSqE=; b=HLjNSAC9b51ln7jpVGS9Yg/p5dvto+/F1EaPlBMNc0ZYDykPNUb2ttWp3bC9OeI/FX pbaDI3ylu9QT9C9UXAsfe964C3yj7FvUZDd1VjUVXMKzGFLL9D0ZbQfkBk7XVZ5dxhRL MQacwrtSVSrHR4Rb9PX1IAJsVyE72ahTgP16fM0nurU1f8EbcUxkG9wnk7cKfNm4rz1b Vo7yD1Pk5xzV8+P3pDyUyufWGv81HDKIhV1hCNgWff7a2iI9prihgQJXhI/AXmp2KK6g YD/1kDYHvt/dZHhapuQdNJ+u+Ls/kiOhm8Von/VraAxRWw5SyOWZa3NJK7Mvzrx274g7 Z2dA== X-Gm-Message-State: APjAAAUohYSk6TrI/9rMWkVTkc+sC2tZl5xgUigwvnz72fVOP5+iXO2D tPi3LYiDrbbmeb6SyeLvrvrOycjZI7Y= X-Received: by 2002:adf:dc4b:: with SMTP id m11mr10600742wrj.269.1569423831754; Wed, 25 Sep 2019 08:03:51 -0700 (PDT) Received: from baileys.linbit (212-186-191-219.static.upcbusiness.at. [212.186.191.219]) by smtp.gmail.com with ESMTPSA id x5sm6285337wrt.75.2019.09.25.08.03.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Sep 2019 08:03:51 -0700 (PDT) From: Joel Colledge To: Jan Kiszka , Kieran Bingham Cc: linux-kernel@vger.kernel.org, Joel Colledge Subject: [PATCH] scripts/gdb: fix lx-dmesg when CONFIG_PRINTK_CALLER is set Date: Wed, 25 Sep 2019 17:03:08 +0200 Message-Id: <20190925150308.6609-1-joel.colledge@linbit.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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]) -- 2.17.1