From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56613) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X7jmK-00026K-FY for qemu-devel@nongnu.org; Thu, 17 Jul 2014 07:23:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X7jmA-0003no-31 for qemu-devel@nongnu.org; Thu, 17 Jul 2014 07:23:12 -0400 Received: from mail-pd0-x232.google.com ([2607:f8b0:400e:c02::232]:58642) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X7jm9-0003nP-Sf for qemu-devel@nongnu.org; Thu, 17 Jul 2014 07:23:02 -0400 Received: by mail-pd0-f178.google.com with SMTP id w10so2982636pde.37 for ; Thu, 17 Jul 2014 04:23:01 -0700 (PDT) From: Sanidhya Kashyap Date: Thu, 17 Jul 2014 16:51:21 +0530 Message-Id: <1405596081-29701-9-git-send-email-sanidhya.iiith@gmail.com> In-Reply-To: <1405596081-29701-1-git-send-email-sanidhya.iiith@gmail.com> References: <1405596081-29701-1-git-send-email-sanidhya.iiith@gmail.com> Subject: [Qemu-devel] [PATCH v4 8/8] BitmapLog: python script for extracting bitmap from a binary file List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu list Cc: Amit Shah , Sanidhya Kashyap , "Dr. David Alan Gilbert" , Juan Quintela Signed-off-by: Sanidhya Kashyap --- scripts/extract-bitmap.py | 97 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100755 scripts/extract-bitmap.py diff --git a/scripts/extract-bitmap.py b/scripts/extract-bitmap.py new file mode 100755 index 0000000..5edc49d --- /dev/null +++ b/scripts/extract-bitmap.py @@ -0,0 +1,97 @@ +#!/usr/bin/python +# This python script helps in extracting the dirty bitmap present +# in the file after executing the log-dirty-bitmap command either +# from the qmp or hmp interface. This file only processes binary +# file obtained via command. +# +# Copyright (C) 2014 Sanidhya Kashyap +# +# Authors: +# Sanidhya Kashyap +# +# +# This work is licensed under the terms of the GNU GPL, version 2 or later. + +import struct +import argparse +from functools import partial + +long_bytes = 8 +byte_size = 8 +int_bytes = 4 +string_bytes = 256 +complete_bitmap_list = [] +block_list = [] + +def get_unsigned_long_integer(value): + return struct.unpack('