1

I'm having a hard-time debugging a local variable. I'm running gcc 4.2, XCode 3.2.4, base SDK Mac OS 10.5, and Objective-C++ in Debug-Mode.

Here's the issue. I'm working on trying to understand some code and it goes like this:

#define MAX4D 500

...

NSMutableArray *viewerPix[ MAX4D ];

When I hover over it during debug (pause on the line before and after) I get this

Unable to access variable "viewerPix"
Unable to access variable "viewerPix"
Unable to access variable "viewerPix"
...

repeated until I kill the application. What would cause this? I've tried setting it to a lower number... but to no avail. Even after I actually set the C-Array:

viewerPix[0] = [[NSMutableArray alloc] initWithCapacity:0];

I still get the same repeated error message.

However, if I don't mouse-over the value (or debug) it "appears" to run fine, even doing stuff like:

[viewerPix[0] addObject: dcmPix];
if( [viewerPix[0] count] != [loadList count])...

but if I debug after those steps, it crashes just like before. Here are my build settings:

STRIPFLAGS =
ALTERNATE_GROUP = $(INSTALL_GROUP)
ALTERNATE_OWNER = $(INSTALL_OWNER)
ALTERNATE_MODE = $(INSTALL_MODE_FLAG)
ALTERNATE_PERMISSIONS_FILES =
DEPLOYMENT_LOCATION = NO
DEPLOYMENT_POSTPROCESSING = NO
INSTALL_GROUP = $(GROUP)
INSTALL_OWNER = $(USER)
INSTALL_MODE_FLAG = u+w,go-w,a+rX
DSTROOT = /tmp/$(PROJECT_NAME).dst
INSTALL_PATH = $(HOME)/Applications
SKIP_INSTALL = NO
COPY_PHASE_STRIP = NO
STRIP_INSTALLED_PRODUCT =
STRIP_STYLE = debugging
SEPARATE_STRIP = NO

GCC_FAST_OBJC_DISPATCH = YES
GCC_AUTO_VECTORIZATION = NO
GCC_OBJC_CALL_CXX_CDTORS = YES
GCC_ENABLE_SSE3_EXTENSIONS = NO
GCC_ENABLE_SSE41_EXTENSIONS = NO
GCC_ENABLE_SSE42_EXTENSIONS = NO
GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS = NO
GCC_STRICT_ALIASING = NO
GCC_FEEDBACK_DIRECTED_OPTIMIZATION = Off
GCC_ENABLE_FIX_AND_CONTINUE = NO
GCC_GENERATE_DEBUGGING_SYMBOLS = YES
GCC_DYNAMIC_NO_PIC = NO
GCC_GENERATE_TEST_COVERAGE_FILES = NO
GCC_INLINES_ARE_PRIVATE_EXTERN = YES
GCC_MODEL_TUNING = G5
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO
GCC_ENABLE_KERNEL_DEVELOPMENT = NO
GCC_DEBUGGING_SYMBOLS = default
GCC_REUSE_STRINGS = YES
GCC_NO_COMMON_BLOCKS = NO
GCC_ENABLE_OBJC_GC = unsupported
GCC_OPTIMIZATION_LEVEL = 0
GCC_FAST_MATH = NO
GCC_ENABLE_SYMBOL_SEPARATION = YES
GCC_THREADSAFE_STATICS = YES
GCC_SYMBOLS_PRIVATE_EXTERN = NO
GCC_UNROLL_LOOPS = NO
GCC_MODEL_PPC64 = NO

I don't know what else to say. Let me know what more information is needed, because I'm at a loss. There's also no 'build' tab when I get-info on the .mm file. Just General, Target, Comments (some helps I checked said to remove file-specific tags).

Should I initialize that c-array to nil? I can't just do.. array[500] = {nil}; right? that's C#?

I was using LLVM and Clang 1.5, but I switched to GCC 4.2 since I wasn't getting any local symbols. Am I missing something??

2 Answers 2

1

If the optimizer is on, that can effectively eliminate local variables.

However, why a C array of mutable ObjC arrays? That seems odd.

Sign up to request clarification or add additional context in comments.

1 Comment

yes, yes it is. I don't have time to refactor all of OsiriX's code, so I'm doing the best I can. It's a port from OS9 C program.
0

check Product->Scheme->Edit Scheme->Run xxx, Build Configuration is Debug, if that is Release happened you see.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.