• 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
Debugging strings in XCode
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Debugging strings in XCode


  • Subject: Debugging strings in XCode
  • From: VersaCAD Mac <email@hidden>
  • Date: Wed, 12 Nov 2003 15:08:28 -0800

I'm in the process of converting an application to OS X using Carbon.
I was using PB but switched to XCode when Panther was released.
(Haven't decided yet if that was a good or bad decision).

I was having problems with debugging strings in PB and so I thought
XCode might be better.  Basically I found that XCode works just as bad
as PB for this.

I'm hoping I'm doing something really stupid and there is a simple way
to fix this.

I have a variable defined as   Str255 stg;
where Str255 is defined by     typedef unsigned char Str255[256];

I'm not yet using Unicode strings and this string is a C string and not
a Pascal string.

When I debug the code the variable show up as:

variable   Type     value
stg        Str255   [-1]

I'm not sure why it shows with a value of [-1].  When I click the
expand arrow to the left of stg it thinks that the string is an array
from 0 to 255 (which it is) of unsigned char[256] (which it is not).
Basically it thinks its an array of arrays rather than an array of
unsigned char.

If I Control click on the 0 index under stg and select View Variable as
Expression then I get the following in the Expressions dialog

Expression     Value
(stg)[0]       [256]

If I click the expand arrow to the left of stg I then see the
characters that make up my string.

This is a very painful way to see the characters in a string.  Not to
mention what I really wanted was just to see the string as a string.
Something like:

variable    Type      value
stg         Str255    "My String"

If I go to the Console mode I can type
set print null-stop
print stg
and it prints:
$1 = "My String"
which is exactly what I want but that's a real pain every time I want
to look at a string.

I've got to believe that debugging strings is common and I'm doing
something stupid here.  What am I doing wrong?

Thanks,
Mike
_______________________________________________
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.

  • Follow-Ups:
    • Re: Debugging strings in XCode
      • From: Hugh Sontag <email@hidden>
  • Prev by Date: Re: Distributed Builds preference pane
  • Next by Date: XCode and CppUnit template TestCaller<>
  • Previous by thread: Re: Distributed Builds preference pane
  • Next by thread: Re: Debugging strings in XCode
  • Index(es):
    • Date
    • Thread