Debugging a crash
Debugging a crash
- Subject: Debugging a crash
- From: Mark Dawson <email@hidden>
- Date: Wed, 1 Dec 2004 16:00:44 -0800
I'm new to Cocoa, and need some guidance to help debug a crash in the VideoHardwareInfo test application (its probably more of a CoreFoundation question than a Cocoa one):
The code crashes in the CFGetNumberValue() CF call (EXEC_BAD_ACCESS), _CFNumberGetValue (final stack crawl call).
I have two displays and the call crashes the second time through the loop (i==1). The code executes the i==0 pass fine. My guess is that
IORegistryEntryCreateCFProperty is returning a bad value; however, I'm not sure how to tell (via the debugger), nor how to protect the code against it. Any suggestions?
Thanks!
mark
------------
-(long**)vsArray
...
// Now we iterate through them
for(i = 0; i < dspCount; i++)
{
// Get the service port for the display
dspPorts[i] = CGDisplayIOServicePort(displays[i]);
// Ask IOKit for the VRAM size property
typeCode = IORegistryEntryCreateCFProperty(dspPorts[i],
CFSTR(kIOFBMemorySizeKey),
kCFAllocatorDefault,
kNilOptions);
// Ensure we have valid data from IOKit
if(typeCode && CFGetTypeID(typeCode) == CFNumberGetTypeID())
{
// If so, convert the CFNumber into a plain unsigned long
** crash ** -> CFNumberGetValue(typeCode, kCFNumberSInt32Type, vsArray[i]);
if(typeCode)
CFRelease(typeCode);
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden