Package winappdbg :: Module crash :: Class CrashContainer
[hide private]
[frames] | no frames]

Class CrashContainer

source code


Old crash dump persistencer using a DBM database. Doesn't support duplicate crashes.


Warning: DBM database support is provided for backwards compatibility with older versions of WinAppDbg. New applications should not use this class. Also, DBM databases in Python suffer from multiple problems that can easily be avoided by switching to a SQL database.

See Also: If you really must use a DBM database, try the standard shelve module instead: http://docs.python.org/library/shelve.html

Nested Classes [hide private]
  __CrashContainerIterator
Iterator of Crash objects.
Instance Methods [hide private]
 
__init__(self, filename=None, allowRepeatedKeys=False)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
remove_key(self, key)
Removes the given key from the set of known keys.
source code
str or buffer
marshall_key(self, key)
Marshalls a Crash key to be used in the database.
source code
Crash key.
unmarshall_key(self, key)
Unmarshalls a Crash key read from the database.
source code
str
marshall_value(self, value, storeMemoryMap=False)
Marshalls a Crash object to be used in the database.
source code
Crash
unmarshall_value(self, value)
Unmarshalls a Crash object read from the database.
source code
int
__len__(self)
Returns: Count of known keys.
source code
bool
__bool__(self)
Returns: False if there are no known keys.
source code
bool
__contains__(self, crash)
Returns: True if a Crash object with the same key is in the container.
source code
bool
has_key(self, key)
Returns: True if the key is present in the set of known keys.
source code
iterator
iterkeys(self)
Returns: Iterator of known Crash keys.
source code
 
__del__(self)
Class destructor.
source code
iterator
__iter__(self)
Returns: Iterator of the contained Crash objects.
source code
iterator
itervalues(self)
Returns: Iterator of the contained Crash objects.
source code
 
add(self, crash)
Adds a new crash to the container.
source code
 
__delitem__(self, key)
Removes a crash from the container.
source code
 
remove(self, crash)
Removes a crash from the container.
source code
Crash object.
get(self, key)
Retrieves a crash from the container.
source code
Crash object.
__getitem__(self, key)
Retrieves a crash from the container.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
    Marshalling configuration
bool optimizeKeys = False
Ignored by the current implementation.
bool optimizeValues = True
True to optimize the marshalling of keys, False otherwise.
bool compressKeys = False
True to compress keys when marshalling, False to leave them uncompressed.
bool compressValues = True
True to compress values when marshalling, False to leave them uncompressed.
bool escapeKeys = False
True to escape keys when marshalling, False to leave them uncompressed.
bool escapeValues = False
True to escape values when marshalling, False to leave them uncompressed.
bool binaryKeys = False
True to marshall keys to binary format (the Python buffer type), False to use text marshalled keys (str type).
bool binaryValues = False
True to marshall values to binary format (the Python buffer type), False to use text marshalled values (str type).
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, filename=None, allowRepeatedKeys=False)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
  • filename (str) - (Optional) File name for crash database. If no filename is specified, the container is volatile.

    Volatile containers are stored only in memory and destroyed when they go out of scope.

  • allowRepeatedKeys (bool) - Currently not supported, always use False.
Overrides: object.__init__

remove_key(self, key)

source code 

Removes the given key from the set of known keys.

Parameters:
  • key (Crash key.) - Key to remove.

marshall_key(self, key)

source code 

Marshalls a Crash key to be used in the database.

Parameters:
  • key (Crash key.) - Key to convert.
Returns: str or buffer
Converted key.

See Also: __init__

unmarshall_key(self, key)

source code 

Unmarshalls a Crash key read from the database.

Parameters:
  • key (str or buffer) - Key to convert.
Returns: Crash key.
Converted key.

marshall_value(self, value, storeMemoryMap=False)

source code 

Marshalls a Crash object to be used in the database. By default the memoryMap member is NOT stored here.

Parameters:
  • value (Crash) - Object to convert.
  • storeMemoryMap (bool) - True to store the memory map, False otherwise.
Returns: str
Converted object.

Warning: Setting the storeMemoryMap argument to True can lead to a severe performance penalty!

unmarshall_value(self, value)

source code 

Unmarshalls a Crash object read from the database.

Parameters:
  • value (str) - Object to convert.
Returns: Crash
Converted object.

__len__(self)
(Length operator)

source code 
Returns: int
Count of known keys.

__bool__(self)

source code 
Returns: bool
False if there are no known keys.

__contains__(self, crash)
(In operator)

source code 
Parameters:
  • crash (Crash) - Crash object.
Returns: bool
True if a Crash object with the same key is in the container.

has_key(self, key)

source code 
Parameters:
  • key (Crash key.) - Key to find.
Returns: bool
True if the key is present in the set of known keys.

iterkeys(self)

source code 
Returns: iterator
Iterator of known Crash keys.

__del__(self)
(Destructor)

source code 

Class destructor. Closes the database when this object is destroyed.

__iter__(self)

source code 
Returns: iterator
Iterator of the contained Crash objects.

See Also: itervalues

itervalues(self)

source code 
Returns: iterator
Iterator of the contained Crash objects.

Warning: A copy of each object is returned, so any changes made to them will be lost.

To preserve changes do the following:

  1. Keep a reference to the object.
  2. Delete the object from the set.
  3. Modify the object and add it again.

add(self, crash)

source code 

Adds a new crash to the container. If the crash appears to be already known, it's ignored.

Parameters:
  • crash (Crash) - Crash object to add.

See Also: Crash.key

__delitem__(self, key)
(Index deletion operator)

source code 

Removes a crash from the container.

Parameters:
  • key (Crash unique key.) - Key of the crash to get.

remove(self, crash)

source code 

Removes a crash from the container.

Parameters:
  • crash (Crash) - Crash object to remove.

get(self, key)

source code 

Retrieves a crash from the container.

Parameters:
  • key (Crash unique key.) - Key of the crash to get.
Returns: Crash object.
Crash matching the given key.

See Also: iterkeys

Warning: A copy of each object is returned, so any changes made to them will be lost.

To preserve changes do the following:

  1. Keep a reference to the object.
  2. Delete the object from the set.
  3. Modify the object and add it again.

__getitem__(self, key)
(Indexing operator)

source code 

Retrieves a crash from the container.

Parameters:
  • key (Crash unique key.) - Key of the crash to get.
Returns: Crash object.
Crash matching the given key.

See Also: iterkeys

Warning: A copy of each object is returned, so any changes made to them will be lost.

To preserve changes do the following:

  1. Keep a reference to the object.
  2. Delete the object from the set.
  3. Modify the object and add it again.


Class Variable Details [hide private]

optimizeKeys

Ignored by the current implementation.

Up to WinAppDbg 1.4 this setting caused the database keys to be optimized when pickled with the standard pickle module.

But with a DBM database backend that causes inconsistencies, since the same key can be serialized into multiple optimized pickles, thus losing uniqueness.

Type:
bool
Value:
False

optimizeValues

True to optimize the marshalling of keys, False otherwise. Only used with the pickle module, ignored when using the more secure cerealizer module.
Type:
bool
Value:
True