Hello community,
here is the log from the commit of package cfi_compress for openSUSE:Factory
checked in at Thu Dec 4 18:03:45 CET 2008.
--------
--- cfi_compress/cfi_compress.changes 2008-11-04 14:40:20.000000000 +0100
+++ /mounts/work_src_done/STABLE/cfi_compress/cfi_compress.changes 2008-12-04 14:48:42.000000000 +0100
@@ -1,0 +2,9 @@
+Thu Dec 4 14:38:55 CET 2008 - mjambor@suse.cz
+
+- Fixed wrong assert in write_byte in idicore.py
+- Checking DWARF version of individual CIEs.
+- Added documentation of hitherto undescribed functions, also added
+ documentation of the compressed format.
+- Allow big-endian ELF inputs.
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ cfi_compress.spec ++++++
--- /var/tmp/diff_new_pack.L21062/_old 2008-12-04 18:03:27.000000000 +0100
+++ /var/tmp/diff_new_pack.L21062/_new 2008-12-04 18:03:27.000000000 +0100
@@ -20,7 +20,7 @@
Name: cfi_compress
Version: 0.1
-Release: 3
+Release: 4
License: GPL v2 or later
Url: http://users.suse.cz/~mjambor/idi.html
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@@ -61,6 +61,12 @@
%py_sitedir/*egg-info
%changelog
+* Thu Dec 04 2008 mjambor@suse.cz
+- Fixed wrong assert in write_byte in idicore.py
+- Checking DWARF version of individual CIEs.
+- Added documentation of hitherto undescribed functions, also added
+ documentation of the compressed format.
+- Allow big-endian ELF inputs.
* Tue Nov 04 2008 ro@suse.de
- add COPYING file to source dir (bnc#438771)
* Mon Oct 20 2008 jblunck@suse.de
++++++ cfi_compress-0.1.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/cfi_compress-0.1/cfi_compress.spec new/cfi_compress-0.1/cfi_compress.spec
--- old/cfi_compress-0.1/cfi_compress.spec 2008-10-17 17:59:51.000000000 +0200
+++ new/cfi_compress-0.1/cfi_compress.spec 2008-10-20 14:06:24.000000000 +0200
@@ -1,7 +1,6 @@
#
-# spec file for package cfi_compress (Version 0.114)
+# spec file for package cfi_compress (Version 0.1)
#
-# Copyright (c) 2007-2008 Nikolay Derkach
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
@@ -23,25 +22,20 @@
Version: 0.1
Release: 0
License: GPL v2 or later
-Url: https://launchpad.net/cfi_compress
+Url: http://users.suse.cz/~mjambor/idi.html
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: python-devel
Source0: %{name}-%{version}.tar.bz2
-Group: System/Monitoring
-Summary: Automatic crash handler
+Group: Development/Tools/Building
+Summary: Tool for Call Frame Information (CFI) Compression
%description
-Cfi_Compress automatically collects data from crashed processes and compiles
-a problem report in /var/crash/.
-
-See http://opensuse.org/Interactive_Crash_Analysis for more
-information.
-
+This tools are used at build time to reduce the impact of having unwind information with every binary.
Authors:
--------
- Martin Pitt
+ Martin Jambor
%prep
%setup -n cfi_compress-%{version}
@@ -59,7 +53,6 @@
%defattr(-,root,root)
/usr/bin/cfi_compress
/usr/bin/cfi_uncompress
-# python modules
%dir %py_sitedir/idicore
%py_sitedir/idicore/*
%py_sitedir/*egg-info
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/cfi_compress-0.1/doc/compressed_debug_frame_format.txt new/cfi_compress-0.1/doc/compressed_debug_frame_format.txt
--- old/cfi_compress-0.1/doc/compressed_debug_frame_format.txt 1970-01-01 01:00:00.000000000 +0100
+++ new/cfi_compress-0.1/doc/compressed_debug_frame_format.txt 2008-11-06 21:45:54.000000000 +0100
@@ -0,0 +1,101 @@
+ Compressed debug_frame format specification
+ ===========================================
+
+ Prerequisites
+ ~~~~~~~~~~~~~
+
+Before reading on, basic knowledge of the DWARF 2 call frame
+information, at least on the macro-level. The rest of this document
+relies on knowledge of various terms and even data types defined
+there.
+
+
+General Entry format
+~~~~~~~~~~~~~~~~~~~~
+
+Each entry starts with a byte describing whether it is a new record or
+a reappearance of an old one, what it is, and so on.
+
+The General format of the initial byte is (each letter represents one
+bit):
+
+NTDDDDDD
+
+T...CIE (1) / FDE (0)
+N...New entry (1) / Reference (0)
+D...Depends on the previous two bits :-)
+
+
+Therefore there are four possibilities:
+
+
+New CIE
+~~~~~~~
+
+Initial byte format:
+
+11LLLLLL
+
+LLLLLL... six bits of CIE Length. Special value 0 means that the
+ length is higher than 2^6-1 and thus cannot be encoded in this way.
+ In this case the length is encoded as unsigned LEB128 (see the DWARF
+ spec for details) immediately after this initial byte.
+
+The initial byte is followed by ordinary CIE data but with length and
+CIE ID stripped off.
+
+Overall outline:
+
+Byte Uleb Variable
+11LLLLLL [Len] Payload
+
+
+CIE Reference (useless)
+~~~~~~~~~~~~~~~~~~~~~~~
+
+Initial byte would start with 10 but this combination has no sense
+and thus should never appear in compressed unwind info.
+
+(In case it is ever needed in the future, the format would be
+10CCCCCC [CID])
+
+New FDE
+~~~~~~~
+
+Initial byte format:
+01CCCLLL
+
+CCC... the number of the CIE this FDE is associated with. Special
+ value 0 means the number is higher than 2^3-1 and thus cannot be
+ encoded in this way. In this case, the associated CIE number is
+ stored in an unsigned LEB128 number immediately following the
+ initial byte.
+
+LLL... Length length. The initial byte (and potentially a CIE number
+ in the unlikely case described above) is followed by the length of
+ the FDE payload (excluding the initial byte, address, the length
+ itself and with the original CIE link stripped off). The length is
+ itself LLL+1 bytes long.
+
+Overall outline:
+
+Byte Uleb Variable Addr.len Variable
+01CCCLLL [CIE] Length Address Payload
+
+
+FDE Reference
+~~~~~~~~~~~~~
+
+Initial byte format
+00CCCLLL
+
+CCC... exactly the same as in the previous case.
+
+LLL... Length-1 of FDE number that follows the initial byte or the
+ CIE ULEB, if present.
+
+Overall outline:
+
+Byte Uleb Variable Addr.len
+00CCCLLL [CIE] FDE num Address
+
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/cfi_compress-0.1/src/cfi_compress new/cfi_compress-0.1/src/cfi_compress
--- old/cfi_compress-0.1/src/cfi_compress 2008-10-17 18:14:43.000000000 +0200
+++ new/cfi_compress-0.1/src/cfi_compress 2008-11-06 21:06:31.000000000 +0100
@@ -12,7 +12,7 @@
keep_temp_files = False
def add_to_list_dict(data, dict, max):
- """Finf or add the data with hash h to a dictionary of lists.
+ """Find or add the data with hash h to a dictionary of lists.
D is string of actual data
DICT is the dictionary of lists of (data, num) tuples.
@@ -37,6 +37,14 @@
return 0
def gen_varlen_number(number):
+ """Produce a variable length-integer.
+
+ Thsi function produces a variable length integer representation of
+ the given NUMBER. It returns a tuple consisting of an integer and
+ a string. The latter is the number in binary form which is
+ suitable to be written to a file. The former is the length of
+ such representataion (in bytes).
+ """
s = number
data = pack("B", (number & 0xff))
z = number >> 8;
@@ -55,8 +63,13 @@
class DebugFrameProcessing:
+ """Class holding data structures and methods required to compress
+ individual .debug_frame sections.
+ """
def __init__(self):
+ """Initialization of instances of this class.
+ """
self.cie_next_num = 1
self.fde_next_num = 1
self.cie_dict = {}
@@ -88,14 +101,21 @@
def process_cie(self, pos, size):
"""Process input CIE in inf at position POS which is SIZE long
- The current inf pointer must be right after the CIE ID
- SIZE id the length of the CIE excluding its length as it is
- stored in the file and the CIE ID
+ The current position in the inf file must be right after the
+ CIE ID. SIZE is the length of the CIE excluding its length as
+ it is stored in the file and the CIE ID.
"""
if verbose:
print "Processing a CIE"
data = self.inf.read(size)
+
+ vb = data[0]
+ v_pack = unpack("B", vb)
+ if v_pack[0] != 1:
+ die ("Bad DWARF version of a CIE entry (only DWARF 2 is " +
+ "currently supported.")
+
num = add_to_list_dict(data, self.cie_dict, self.cie_next_num);
if (num == 0):
self.write_compressed_cie (data, size)
@@ -107,6 +127,16 @@
def write_new_fde(self, cid, addr, data, size):
+ """Write a compressed new FDE entry.
+
+ DATA is the payload starting with the length (as defined by
+ DWARF specs), SIZE is the FDE size which should be written to
+ output. CID is the number of associated CIE (in the order in
+ which unique CIEs have been encountered - and which is also
+ written out) and ADDR is the address in text where the region
+ described by this FDE starts.
+ """
+
if verbose:
print (" writing a new FDE %d (for CIE %d, addr 0x%x)"
% (self.fde_next_num, cid, addr))
@@ -127,6 +157,13 @@
self.outf.write(data)
def write_fde_ref(self, cid, num, addr):
+ """Write a reference to a previous FDE entry.
+
+ CID and ADDR have the same meaning as when calling
+ write_new_fde. NUm is the number of FDE being references in
+ the order of encounter.
+ """
+
if verbose:
print (" writing an FDE reference to %d (for CIE %d, addr 0x%x)"
% (num, cid, addr))
@@ -292,7 +329,7 @@
""" % compressed_unwind_section_name
def main():
- "The mainfunction parsing command line and driving appropriate compression"
+ "The main function parsing command line and driving appropriate compression"
global verbose, keep_temp_files
if (len(sys.argv) < 2):
die("You need to specify at least one input file.")
@@ -333,6 +370,5 @@
-
if __name__ == '__main__':
main()
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/cfi_compress-0.1/src/cfi_uncompress new/cfi_compress-0.1/src/cfi_uncompress
--- old/cfi_compress-0.1/src/cfi_uncompress 2008-10-17 17:51:04.000000000 +0200
+++ new/cfi_compress-0.1/src/cfi_uncompress 2008-11-06 21:05:54.000000000 +0100
@@ -10,6 +10,12 @@
verbose = False
def parse_varlen_number(ls):
+ """"Convert a variable-length integer into an ordinary integer.
+
+ LS is string read froma file that was previously generated by
+ gen_varlen_number() in cfi_compress.py, it is converted to an
+ ordinary python integer and returned.
+ """
l = 0
while len(ls) > 0:
c = ls[0]
@@ -21,14 +27,27 @@
class DebugFrameDecopression:
+ """Class holding structures and methosds necessary do uncompress
+ individual compressed .debug_frame sections.
+ """
def __init__(self):
+ "Initialization of instances of this class"
+
self.cie_num_to_offset = {}
self.fde_num_to_data = {}
self.next_cie_num = 1
self.next_fde_num = 1
def decompress_cie(self, b):
+ """Decompresses a CIE occurring in the input.
+
+ B is the leading byte indicatig there is a CIE entry and its
+ length as described in the compressed format specification.
+ The position in the input file must be immediately after this
+ header byte.
+ """
+
if verbose:
print "Decompressing a CIE number %d" % self.next_cie_num
assert (b & 0x40) != 0
@@ -51,6 +70,13 @@
print " length: 0x%x" % (length + address_size)
def decompress_new_fde(self, hdr_b):
+ """Decompress a new FDE occurring in the input.
+
+ B is the leading byte as described by the format
+ specification. The position in the input file must be
+ immediatly following this byte.
+ """
+
if verbose:
print "Decompressing a new FDE number %d" % self.next_fde_num
sc = (hdr_b & 0x3f) >> 3
@@ -81,6 +107,13 @@
self.cie_num_to_offset[cie], addr))
def decompress_fde_ref(self, hdr_b):
+ """Decompress an FDE reference occurring in the input.
+
+ B is the leading byte as described by the format
+ specification. The position in the input file must be
+ immediatly following this byte.
+ """
+
if verbose:
print "Decompressing an FDE reference"
sc = (hdr_b & 0x3f) >> 3
@@ -109,6 +142,9 @@
def process_file(self, inf, outf):
+ """The main loop processing a file, identifying the type of entries
+ and calling appropriate decmpression functions. """
+
inf_pos = 0
outf_pos = 0
try:
@@ -150,6 +186,8 @@
def skip_cies_at_the_end(ref):
+ "Skip all CIEs in REF and trigger an assert if EOF is not reached."
+
if verbose:
print ("Skipping CIEs at the end of the reference file (pos: 0x%x)"
% ref.tell())
@@ -170,6 +208,18 @@
def check_skip_cie(ref_data, ref_pos, known_cies, cie_num_to_offset,
cie_offset_to_offset):
+ """Skip a CIE.
+
+ REF_DATA is a string containing CIE data (excluding CIE
+ id). REF_POS is the position of of the CIE (including the id),
+ KNOWN_CIES is a list of all previous encountered unique CIEs,
+ CIE_NUM_TO_OFFSET is a dictionary mapping CIE numbers (as they
+ occured) to offsets of their first occurence, CIE_OFFSET_TO_OFFSET
+ maps an offset of a reoccuring CIE to the offset of its first
+ occurence. This function checks that the CIE in REF_DATA is a
+ known one and triggers an assert otherwise and adds new
+ appropriate entries to the dictionaries.
+ """
id = -1
i = 0
for past in known_cies:
@@ -187,6 +237,16 @@
def compare_information(tst, ref):
+ """Inteligently compare two files.
+
+ REF is a reference file (presumably with the original debug_frame
+ section) and TST is the file being tested (presumably containing a
+ decompressed info). This function checks they are the same except
+ that reocurring CIEs might be missing in TST, provided that those
+ FDEs which referenced them reference the appropriate first
+ occurance.
+ """
+
cie_offset_to_offset = {}
cie_num_to_offset = {}
known_cies = []
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/cfi_compress-0.1/src/idicore/idicore.py new/cfi_compress-0.1/src/idicore/idicore.py
--- old/cfi_compress-0.1/src/idicore/idicore.py 2008-10-17 17:49:40.000000000 +0200
+++ new/cfi_compress-0.1/src/idicore/idicore.py 2008-12-01 22:12:27.000000000 +0100
@@ -20,6 +20,8 @@
idstr_elf_32 = "ELF 32-bit LSB"
idstr_elf_64 = "ELF 64-bit LSB"
+idstr_elf_32_msb = "ELF 32-bit MSB"
+idstr_elf_64_msb = "ELF 64-bit MSB"
cie_id = -1
compressed_unwind_section_name = ".debug_c_frame"
@@ -94,7 +96,7 @@
def write_byte(f, b):
"""Write a single (unsigned) byte B to file F"""
- assert (b > 0) and (b < 256)
+ assert (b >= 0) and (b < 256)
p_b = pack ("B", b)
f.write(p_b)
@@ -166,12 +168,13 @@
def identify_elf_file(elfname):
output, input = popen2.popen2("file -b \"%s\"" % elfname);
idstr = output.readline()
- if idstr.find(idstr_elf_32) == 0:
+ if (idstr.find(idstr_elf_32) == 0) or (idstr.find(idstr_elf_32_msb) == 0):
switch_to_32()
- elif idstr.find(idstr_elf_64) == 0:
+ elif ((idstr.find(idstr_elf_64) == 0) or
+ (idstr.find(idstr_elf_64_msb) == 0)):
switch_to_64()
else:
- die("File %s is neither 32-bit nor 64-bit LSB ELF file.\n" % elfname);
+ die("File %s is neither 32-bit nor 64-bit ELF file.\n" % elfname);
output.close()
input.close()
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org