Expand the family of debug print functions for displaying DOH types. Provide gdb support for calling these. Document improved debugging experience.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12221 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
a202bf9818
commit
d1e6643161
13 changed files with 421 additions and 47 deletions
|
|
@ -284,6 +284,41 @@ static String *format_filename(const_String_or_char_ptr filename) {
|
|||
return formatted_filename;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Swig_stringify_with_location()
|
||||
*
|
||||
* Return a string representation of any DOH object with line and file location
|
||||
* information in the appropriate error message format. The string representation
|
||||
* is enclosed within [] brackets after the line and file information.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
String *Swig_stringify_with_location(DOH *object) {
|
||||
String *str = NewStringEmpty();
|
||||
|
||||
if (!init_fmt)
|
||||
Swig_error_msg_format(DEFAULT_ERROR_MSG_FORMAT);
|
||||
|
||||
if (object) {
|
||||
int line = Getline(object);
|
||||
String *formatted_filename = format_filename(Getfile(object));
|
||||
if (line > 0) {
|
||||
Printf(str, diag_line_fmt, formatted_filename, line);
|
||||
} else {
|
||||
Printf(str, diag_eof_fmt, formatted_filename);
|
||||
}
|
||||
if (Len(object) == 0) {
|
||||
Printf(str, "[EMPTY]");
|
||||
} else {
|
||||
Printf(str, "[%s]", object);
|
||||
}
|
||||
Delete(formatted_filename);
|
||||
} else {
|
||||
Printf(str, "[NULL]");
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Swig_diagnostic()
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue