• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Data Formatters - XCode 2.0
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Data Formatters - XCode 2.0


  • Subject: Re: Data Formatters - XCode 2.0
  • From: Jim Ingham <email@hidden>
  • Date: Tue, 24 May 2005 13:56:47 -0700

Since you're telling the data formatter that VAR is a "string", gdb assumes that the signature of the function you have provided is:

char *string_summary (const string str, int identifier)

but you are actually providing a function that takes a reference. So the function is not going to get the right value. You might try writing a function that takes in a pointer to a string, and then make your plist entry be:

    <key>string</key>
    <dict>
        <key>SummaryString</key>
        <string>{(char *)string_summary(&amp;$VAR, $ID)}:s</string>
    </dict>

Jim

On May 24, 2005, at 8:45 AM, Wade Girard wrote:

I am trying to make a Data formatter plugin for one of our data types. It is a string class that we use, similar to a C++ string.

The plugin is being called, but is apparently not working correctly.

As an example I am also trying to do it using a C++ string. I KNOW THAT I CAN SIMPLY TYPE {$VAR.c_str()}:s IN THE SUMMARY FIELD FOR A C ++ STRING!!! Please don't tell me to try this.

Our string type also has a c_str() method, but is returning unicode and can't be displayed properly this way.

So, after all that, here is what I am trying to do, assuming I am using a C++ string

//==========PLIST SNIPPET==========
    <key>string</key>
    <dict>
        <key>SummaryString</key>
        <string>{(char *)string_summary($VAR, $ID)}:s</string>
    </dict>
//==========PLIST SNIPPET==========

//==========CODE SNIPPET==========

char* string_summary(const string &str, int identifier)
{
char *result = NULL;
if ( NULL != _pbxgdb_plugin_functions )
{
// if I replace str in the formatter with s1, this string IS displayed
std::string s1 = "This is a c++ string";
result = _pbxgdb_plugin_functions->message(identifier, "<% s>", str.c_str());
}
return result;
}


//==========CODE SNIPPET==========

When I run in the debugger, all I get in the summary field is "out of scope", but the variable name is not grayed. If I replace str with s1, then the string "This is a C++ string" will always be displayed.

Am I totally missing the mark here? Why doesn't Apple provide an example of how to do this?

Any guidance would be appreciated.

-Wade Girard

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Data Formatters - XCode 2.0 (From: Wade Girard <email@hidden>)

  • Prev by Date: Rudimentary MPW simulation with Xcode script
  • Next by Date: Re: Data Formatters - XCode 2.0
  • Previous by thread: Re: Data Formatters - XCode 2.0
  • Next by thread: Re: Data Formatters - XCode 2.0
  • Index(es):
    • Date
    • Thread