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:
William S Fulton 2010-09-15 20:17:11 +00:00
commit d1e6643161
13 changed files with 421 additions and 47 deletions

View file

@ -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()
*

View file

@ -527,7 +527,6 @@ String *Swig_string_schemify(String *s) {
return ns;
}
/* -----------------------------------------------------------------------------
* Swig_string_typecode()
*

View file

@ -319,7 +319,6 @@ extern int ParmList_is_compactdefargs(ParmList *p);
extern String *Swig_string_lower(String *s);
extern String *Swig_string_upper(String *s);
extern String *Swig_string_title(String *s);
extern void Swig_init(void);
extern int Swig_value_wrapper_mode(int mode);
@ -334,6 +333,7 @@ extern int ParmList_is_compactdefargs(ParmList *p);
extern int Swig_warn_count(void);
extern void Swig_error_msg_format(ErrorMessageFormat format);
extern void Swig_diagnostic(const_String_or_char_ptr filename, int line, const char *fmt, ...);
extern String *Swig_stringify_with_location(DOH *object);
/* --- C Wrappers --- */
extern String *Swig_cparm_name(Parm *p, int i);
@ -408,6 +408,8 @@ extern int ParmList_is_compactdefargs(ParmList *p);
extern void Wrapper_director_protected_mode_set(int);
extern void Wrapper_all_protected_mode_set(int);
extern void Language_replace_special_variables(String *method, String *tm, Parm *parm);
extern void Swig_print(DOH *object, int count);
extern void Swig_print_with_location(DOH *object, int count);
/* -- template init -- */