All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: linux-kernel@vger.kernel.org
Cc: Jason Wessel <jason.wessel@windriver.com>,
	kgdb-bugreport@lists.sourceforge.net,
	Andi Kleen <andi@firstfloor.org>
Subject: [PATCH 09/13] scripts/gdb: Add is_target_arch helper
Date: Mon,  5 Nov 2012 17:09:02 +0100	[thread overview]
Message-ID: <ffbc702c9b10e271af1ba1b4cde5993c526e0713.1352131731.git.jan.kiszka@siemens.com> (raw)
In-Reply-To: <cover.1352131729.git.jan.kiszka@siemens.com>
In-Reply-To: <cover.1352131729.git.jan.kiszka@siemens.com>

This helper caches to result of "show architecture" and matches the
provided arch (sub-)string against that output.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 scripts/gdb/utils.py |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/scripts/gdb/utils.py b/scripts/gdb/utils.py
index 18e3bfc..31aaf53 100644
--- a/scripts/gdb/utils.py
+++ b/scripts/gdb/utils.py
@@ -88,3 +88,12 @@ def read_u64(buffer):
 		return read_u32(buffer[0:4]) + (read_u32(buffer[4:8]) << 32)
 	else:
 		return read_u32(buffer[4:8]) + (read_u32(buffer[0:4]) << 32)
+
+
+target_arch = None
+
+def is_target_arch(arch):
+	global target_arch
+	if target_arch == None:
+		target_arch = gdb.execute("show architecture", False, True)
+	return target_arch.find(arch) >= 0
-- 
1.7.3.4


  parent reply	other threads:[~2012-11-05 16:11 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-05 16:08 [PATCH 00/13] Add gdb python scripts as kernel debugging helpers Jan Kiszka
2012-11-05 16:08 ` Jan Kiszka
2012-11-05 16:08 ` [PATCH 01/13] scripts/gdb: Add infrastructure Jan Kiszka
2012-11-05 16:08 ` [PATCH 02/13] scripts/gdb: Add container_of helper and convenience function Jan Kiszka
2012-11-05 16:08 ` [PATCH 03/13] scripts/gdb: Add lx-symbols command Jan Kiszka
2012-11-05 16:08 ` [PATCH 04/13] scripts/gdb: Add get_target_endianness helper Jan Kiszka
2012-11-05 16:08 ` [PATCH 05/13] scripts/gdb: Add read_u16/32/64 helpers Jan Kiszka
2012-11-05 16:08 ` [PATCH 06/13] scripts/gdb: Add lx-dmesg command Jan Kiszka
2012-11-05 16:09 ` [PATCH 07/13] scripts/gdb: Add task iteration helper Jan Kiszka
2012-11-05 16:09 ` [PATCH 08/13] scripts/gdb: Add helper and convenience function to look up tasks Jan Kiszka
2012-11-05 16:09 ` Jan Kiszka [this message]
2012-11-05 16:09 ` [PATCH 10/13] scripts/gdb: Add internal helper and convenience function to retrieve thread_info Jan Kiszka
2012-11-05 16:09   ` Jan Kiszka
2012-11-05 16:09 ` [PATCH 11/13] scripts/gdb: Add get_gdbserver_type helper Jan Kiszka
2012-11-05 16:09 ` [PATCH 12/13] scripts/gdb: Add internal helper and convenience function for per-cpu lookup Jan Kiszka
2012-11-05 16:09   ` Jan Kiszka
2012-11-05 16:09 ` [PATCH 13/13] scripts/gdb: Add lx_current convenience function Jan Kiszka
2012-12-20 17:59 ` [PATCH 00/13] Add gdb python scripts as kernel debugging helpers Ben Widawsky
  -- strict thread matches above, loose matches on Subject: below --
2012-10-03 11:21 Jan Kiszka
2012-10-03 11:21 ` [PATCH 09/13] scripts/gdb: Add is_target_arch helper Jan Kiszka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ffbc702c9b10e271af1ba1b4cde5993c526e0713.1352131731.git.jan.kiszka@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=andi@firstfloor.org \
    --cc=jason.wessel@windriver.com \
    --cc=kgdb-bugreport@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.