wxRuby Documentation Home

# Wx::DebugReport

DebugReport is used to generate a debug report, containing information about
the program current state. It is usually used from
App::OnFatalException as shown in the
sample.

A DebugReport object contains one or more files. A few of them can be created by the
class itself but more can be created from the outside and then added to the
report. Also note that several virtual functions may be overridden to further
customize the class behaviour.

Once a report is fully assembled, it can simply be left in the temporary
directory so that the user can email it to the developers (in which case you
should still use DebugReportCompress to
compress it in a single file) or uploaded to a Web server using
DebugReportUpload (setting up the Web server
to accept uploads is your responsibility, of course). Other handlers, for example for
automatically emailing the report, can be defined as well but are not currently
included in Widgets.

## Example of use

DebugReport report; DebugReportPreviewStd preview; report.AddCurrentContext(); // could also use AddAll() report.AddCurrentDump(); // to do both at once if ( preview.Show(report) ) report.Process();

## Derived from

No base class

## Data structures

This enum is used for functions that report either the current state
or the state during the last (fatal) exception:

enum DebugReport::Context { Context_Current, Context_Exception };

## Methods

- DebugReport.new
- DebugReport#add_all
- DebugReport#add_context
- DebugReport#add_current_context
- DebugReport#add_current_dump
- DebugReport#add_dump
- DebugReport#add_exception_context
- DebugReport#add_exception_dump
- DebugReport#add_file
- DebugReport#add_text
- DebugReport#do_add_custom_context
- DebugReport#do_add_exception_info
- DebugReport#do_add_loaded_modules
- DebugReport#do_add_system_info
- DebugReport#get_directory
- DebugReport#get_file
- DebugReport#get_files_count
- DebugReport#get_report_name
- DebugReport#is_ok
- DebugReport#process
- DebugReport#remove_file
- DebugReport#reset

### DebugReport.new

destructor()

The destructor normally destroys the temporary directory created in the constructor
with all the files it contains. Call Reset to
prevent this from happening.

### DebugReport#add_all

add_all(%(arg-type)Context% context = Context_Exception)

Adds all available information to the report. Currently this includes a
text (XML) file describing the process context and, under Win32, a minidump
file.

### DebugReport#add_context

Boolean add_context(%(arg-type)Context% ctx)

Add an XML file containing the current or exception context and the
stack trace.

### DebugReport#add_current_context

Boolean add_current_context()

The same as add_context.

### DebugReport#add_current_dump

Boolean add_current_dump()

The same as add_dump.

### DebugReport#add_dump

Boolean add_dump(%(arg-type)Context% ctx)

Adds the minidump file to the debug report.

Minidumps are only available under recent Win32 versions (`dbghlp32.dll`
can be installed under older systems to make minidumps available).

### DebugReport#add_exception_context

Boolean add_exception_context()

The same as add_context.

### DebugReport#add_exception_dump

Boolean add_exception_dump()

The same as add_dump.

### DebugReport#add_file

add_file(%(arg-type)String% filename, String description)

Add another file to the report. If filename is an absolute path, it is
copied to a file in the debug report directory with the same name. Otherwise
the file should already exist in this directory

description only exists to be displayed to the user in the report summary
shown by DebugReportPreview.

#### See also

get_directory,

add_text

### DebugReport#add_text

Boolean add_text(%(arg-type)String% filename, String text, String description)

This is a convenient wrapper around add_file. It
creates the file with the given name and writes text to it, then
adds the file to the report. The filename shouldn’t contain the path.

Returns if file could be added successfully, if an IO error
occurred.

### DebugReport#do_add_custom_context

do_add_custom_context(%(arg-type)XmlNode% nodeRoot)

This function may be overridden to add arbitrary custom context to the XML
context file created by add_context. By
default, it does nothing.

### DebugReport#do_add_exception_info

Boolean do_add_exception_info(%(arg-type)XmlNode% nodeContext)

This function may be overridden to modify the contents of the exception tag in
the XML context file.

### DebugReport#do_add_loaded_modules

Boolean do_add_loaded_modules(%(arg-type)XmlNode% nodeModules)

This function may be overridden to modify the contents of the modules tag in
the XML context file.

### DebugReport#do_add_system_info

Boolean do_add_system_info(%(arg-type)XmlNode% nodeSystemInfo)

This function may be overridden to modify the contents of the system tag in
the XML context file.

### DebugReport#get_directory

String get_directory()

Returns the name of the temporary directory used for the files in this report.

This method should be used to construct the full name of the files which you
wish to add to the report using add_file.

### DebugReport#get_file

Boolean get_file(%(arg-type)Integer% n, String name, String desc)

Retrieves the name (relative to
get_directory) and the description of the
file with the given index. If n is greater than or equal to the number of
filse, is returned.

### DebugReport#get_files_count

Integer get_files_count()

Gets the current number files in this report.

### DebugReport#get_report_name

String get_report_name()

Gets the name used as a base name for various files, by default
App::GetAppName is used.

### DebugReport#is_ok

Boolean is_ok()

Returns if the object was successfully initialized. If this method returns
the report can’t be used.

### DebugReport#process

Boolean process()

Processes this report: the base class simply notifies the user that the
report has been generated. This is usually not enough — instead you
should override this method to do something more useful to you.

### DebugReport#remove_file

remove_file(%(arg-type)String% name)

Removes the file from report: this is used by
DebugReportPreview to allow the user to
remove files potentially containing private information from the report.

### DebugReport#reset

reset()

Resets the directory name we use. The object can’t be used any more after
this as it becomes uninitialized and invalid.

[This page automatically generated from the Textile source at 2023-06-09 00:45:30 +0000]