Using custom data formatters in the debugger
Using custom data formatters in the debugger
- Subject: Using custom data formatters in the debugger
- From: Mark Lentczner <email@hidden>
- Date: Tue, 9 Dec 2003 13:26:35 -0800
This new feature is documented in various places:
Xcode Help > Debugging > Viewing Variables and Expressions > Using
custom data formatters...
Release Notes > Debugging > New Features
and in the unlikely header file DataFormatterPlugin.h which is located
at
/Developer/Applications/Xcode.app/Contents/PlugIns/
GDBMIDebugging.pbplugin/Contents/Headers/DataFormatterPlugin.h
I am trying to use the advanced feature where you build a bundle that
gets automatically loaded and you can supply custom formatting
functions. I can see that Xcode is loading the bundle as my custom
format strings in the bundle appear in the debugger variable window
when an appropriate class appears, and I can tell that the code has
been loaded by looking at what shared libraries gdb has loaded. Yet,
it doesn't work: My format string is just grayed out in the variables
window and my function doesn't appear to be called. (Nor does the
function appear in gdb's symbol tables, but that is perhaps because
Xcode doesn't really link in the code...)
My test data formatter is this:
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
~ ~ ~ ~ ~ ~ ~ ~ ~
#include "DataFormatterPlugin.h"
#include "path.hpp";
using namespace Wheat;
// the class Path is in the namespace Wheat
_pbxgdb_plugin_function_list *_pbxgdb_plugin_functions = NULL;
char *
fmtPath(int id, const Path& p)
{
return _pbxgdb_plugin_functions->message(id, "path<%s>",
p.isValid() ? "valid" : "invalid");
}
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
~ ~ ~ ~ ~ ~ ~ ~ ~
Then, type Path has this value format string:
{fmtPath($ID, $VAR)}
If I put a simpler value format string, such as "n=%numSegments%"
(where numSegments is a member of class Path), that displays fine. So
it seems clear that the format string is attached to the correct class,
and works if it doesn't have to call my custom formatting function.
It also works if I put in a formatting string that calls a member that
is part of the class, such as "{$VAR.isValid()}". However, in that case
if I call something that returns a "const char *", such as
"{$VAR.debugName()}", it displays the address, not the string contents.
Has anyone gotten a loaded bundle of data formatters to work?
Has anyone gotten a custom expression to display as a string?
Is there a chance that this doesn't work because my class is in a
namespace?
Any help would be appreciated.
- Mark
Mark Lentczner
email@hidden
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.