void CVAddModule( mod_entry *obj, section *sect ) /******************************************************/ // called just before publics have been assigned addresses between p1 & p2 { unsigned_32 sig; cv_sst_module mod; unsigned_32 size; byte namelen; sect = sect; DEBUG(( DBG_OLD, "CVAddModule(%s): numsegs=%d pubsize=%d", obj->name, obj->d.cv->numsegs, obj->d.cv->pubsize )); if( obj->d.cv->pubsize > 0 ) { GenSubSection( sstPublicSym, obj->d.cv->pubsize ); sig = 1; DumpInfo( CVSECT_MISC, &sig, sizeof( unsigned_32 ) ); } namelen = strlen( obj->name ); size = sizeof( cv_sst_module ) + namelen + 1 + ( obj->d.cv->numsegs - 1 ) * sizeof( cv_seginfo ); // begin padding required ??? size = ROUND_UP( size, 4 ); // end padding required ??? GenSubSection( sstModule, size ); mod.ovlNumber = 0; mod.iLib = 0; mod.cSeg = obj->d.cv->numsegs; mod.Style = CV_DEBUG_STYLE; DumpInfo( CVSECT_MODULE, &mod, sizeof( cv_sst_module ) - sizeof( cv_seginfo ) ); obj->d.cv->segloc = SectAddrs[CVSECT_MODULE]; SectAddrs[CVSECT_MODULE] += sizeof( cv_seginfo ) * obj->d.cv->numsegs; DumpInfo( CVSECT_MODULE, &namelen, 1 ); DumpInfo( CVSECT_MODULE, obj->name, namelen ); DEBUG(( DBG_OLD, "CVAddModule(%s): exit", obj->name )); }
int main(int argc, char *argv[]) { if (argc == 2) { // device specified LocalDevice* ld = LocalDevice::GetLocalDevice(atoi(argv[0])); if (ld == NULL) return LocalDeviceError(ENODEV); DumpInfo(ld); } else if (argc == 1) { // show all devices LocalDevice* ld = NULL; printf("Listing %ld Bluetooth Local Devices ...\n", LocalDevice::GetLocalDeviceCount()); for (uint32 index = 0 ; index < LocalDevice::GetLocalDeviceCount() ; index++) { ld = LocalDevice::GetLocalDevice(); if (ld == NULL) return LocalDeviceError(ENODEV); DumpInfo(ld); } return B_OK; } else { fprintf(stderr,"Usage: bt_dev_info [device]\n"); return B_ERROR; } }
void CVGenGlobal( symbol * sym, section *sect ) /****************************************************/ // called during symbol address calculation (between pass 1 & pass 2) // also called by loadpe between passes { s_pub16 pub16; s_pub32 pub32; unsigned size; unsigned pad; unsigned_32 buf; byte namelen; sect = sect; if( sym->info & SYM_STATIC ) return; namelen = strlen( sym->name ); size = namelen + 1; if( ( sym->p.seg == NULL ) || IS_SYM_IMPORTED( sym ) || sym->p.seg->is32bit ) { size += sizeof( s_pub32 ); pub32.common.length = ROUND_UP( size, 4 ); pad = pub32.common.length - size; pub32.common.length -= 2; pub32.common.code = S_PUB32; pub32.f.offset = sym->addr.off; pub32.f.segment = GetCVSegment( sym->p.seg->u.leader ); pub32.f.type = 0; DumpInfo( CVSECT_MISC, &pub32, sizeof( s_pub32 ) ); } else { size += sizeof( s_pub16 ); pub16.common.length = ROUND_UP( size, 4 ); pad = pub16.common.length - size; pub16.common.length -= 2; pub16.common.code = S_PUB16; pub16.f.offset = sym->addr.off; pub16.f.segment = GetCVSegment( sym->p.seg->u.leader ); pub16.f.type = 0; DumpInfo( CVSECT_MISC, &pub16, sizeof( s_pub16 ) ); } DumpInfo( CVSECT_MISC, &namelen, 1 ); DumpInfo( CVSECT_MISC, sym->name, namelen ); if( pad > 0 ) { buf = 0; DumpInfo( CVSECT_MISC, &buf, pad ); } }
static void GenSubSection( sst sect, unsigned_32 size ) /*****************************************************/ // generate a subsection entry { cv_directory_entry entry; entry.subsection = sect; if( CurrMod == NULL ) { entry.iMod = 0xFFFF; } else { entry.iMod = CurrMod->d.cv->modidx; } entry.cb = size; if( sect == sstModule ) { entry.lfo = SectAddrs[CVSECT_MODULE] - CVBase; DumpInfo( CVSECT_MODDIR, &entry, sizeof( cv_directory_entry ) ); } else { entry.lfo = SectAddrs[CVSECT_MISC] - CVBase; DumpInfo( CVSECT_DIRECTORY, &entry, sizeof( cv_directory_entry ) ); } }
//----------------------------------------------------------------------------- // main // //----------------------------------------------------------------------------- int main( int argc, char* argv[] ) { char bspPath[MAX_PATH]; // set the valve library printer SpewOutputFunc( OutputFunc ); CommandLine()->CreateCmdLine( argc, argv ); Msg( "\nXBSPINFO - Valve Xbox 360 BSP Info ( Build: %s %s )\n", __DATE__, __TIME__ ); Msg( "( C ) Copyright 1996-2006, Valve Corporation, All rights reserved.\n\n" ); if ( argc < 2 || CommandLine()->FindParm( "?" ) || CommandLine()->FindParm( "-h" ) || CommandLine()->FindParm( "-help" ) ) { Usage(); } if ( argc >= 2 && argv[1][0] != '-' ) { strcpy( bspPath, argv[1] ); } else { Usage(); } g_bQuiet = CommandLine()->FindParm( "-q" ) != 0; g_bAsPercent = CommandLine()->FindParm( "-p" ) != 0 || CommandLine()->FindParm( "-percent" ) != 0; g_bAsBytes = CommandLine()->FindParm( "-b" ) != 0 || CommandLine()->FindParm( "-bytes" ) != 0; g_bSortByOffset = CommandLine()->FindParm( "-so" ) != 0; g_bSortBySize = CommandLine()->FindParm( "-ss" ) != 0; g_bFriendlyNames = CommandLine()->FindParm( "-names" ) != 0; void *pBSPBuffer; int bspSize; if ( LoadBSPFile( bspPath, &pBSPBuffer, &bspSize ) ) { const char *pZipName = CommandLine()->ParmValue( "-extract", "" ); if ( pZipName && pZipName[0] ) { ExtractZip( pZipName, pBSPBuffer ); } else { DumpInfo( bspPath, pBSPBuffer, bspSize ); } free( pBSPBuffer ); } return ( 0 ); }
int main(int argc, char *argv[]) { mainThread = find_thread(NULL); if (argc == 2) { // device specified LocalDevice* device = LocalDevice::GetLocalDevice(atoi(argv[0])); if (device == NULL) return LocalDeviceError(ENODEV); DumpInfo(device); } else if (argc == 1) { // show all devices LocalDevice* device = NULL; printf("Performing discovery for %ld Bluetooth Local Devices ...\n", LocalDevice::GetLocalDeviceCount()); for (uint32 index = 0 ; index < LocalDevice::GetLocalDeviceCount() ; index++) { device = LocalDevice::GetLocalDevice(); if (device == NULL) { LocalDeviceError(ENODEV); continue; } DumpInfo(device); } return B_OK; } else { fprintf(stderr,"Usage: bt_dev_info [device]\n"); return B_ERROR; } }
int main(int argc, char* argv[]) { bool verbose = false; BString devname = ""; for (int i = 1; i < argc; i++) { if (argv[i][0] == '-') { if (argv[i][1] == 'v') verbose = true; else { printf("Usage: listusb [-v] [device]\n\n"); printf("-v: Show more detailed information including " "interfaces, configurations, etc.\n\n"); printf("If a device is not specified, " "all devices found on the bus will be listed\n"); return 1; } } else devname = argv[i]; } if (devname.Length() > 0) { BUSBDevice device(devname.String()); if (device.InitCheck() < B_OK) { printf("Cannot open USB device: %s\n", devname.String()); return 1; } else { DumpInfo(device, verbose); return 0; } } else { DumpRoster roster(verbose); roster.Start(); roster.Stop(); } return 0; }
/* ----------------------------- MNI Header ----------------------------------- @NAME : main @INPUT : @OUTPUT : none @RETURNS : none @DESCRIPTION: Sets up a new MINC file so that it can contain image data. Creates the dimensions, and the image, time, time-width, image-max, and image-min variables. @METHOD : none @GLOBALS : ncopts @CALLS : GetArgs CreateDims MINC library NetCDF library @CREATED : June 3, 1993 by MW @MODIFIED : ---------------------------------------------------------------------------- */ int main (int argc, char *argv[]) { char *TimeStamp; /* to be put in the history attribute */ nc_type NCType; Boolean Signed; long NumFrames; /* lengths of the various image dimensions */ long NumSlices; long Height; long Width; int ChildCDF; int ParentCDF; /* NumDim will be the number of image dimensions actually created in * the MINC file; DimIDs and DimNames will hold the ID's and names * of these dimensions. There will be 2 dimensions if both NumFrames * and NumSlices are zero; 3 dimensions if either one but not both is * zero; and 4 dimensions if neither are zero. (Height and Width must * always be non-zero.) */ int NumDim; int DimIDs [MAX_IMAGE_DIM]; char *DimNames [MAX_IMAGE_DIM]; int NumExclude; int Exclude[MAX_NC_DIMS]; ErrMsg = (char *) calloc (256, sizeof (char)); TimeStamp = time_stamp (argc, argv); GetArgs (&argc, argv, &NumFrames, &NumSlices, &Height, &Width, &NCType, &Signed); #ifdef DEBUG printf ("main: Parent file: %s; new file: %s\n\n", gParentFile, gChildFile); #endif ncopts = 0; ERROR_CHECK (OpenFiles (gParentFile, gChildFile, &ParentCDF, &ChildCDF)); ERROR_CHECK (CreateDims (ChildCDF, NumFrames, NumSlices, Height, Width, gOrientation, &NumDim, DimIDs, DimNames)); ERROR_CHECK (CreateDimVars (ParentCDF, ChildCDF, NumDim, DimIDs, DimNames, &NumExclude, Exclude)); ERROR_CHECK (CreateImageVars (ChildCDF, NumDim, DimIDs, NCType, Signed, gValidRange)); #ifdef DEBUG printf ("--------------------------------------------------------------\n"); printf ("State of %s immediately before entering CopyOthers:\n",gParentFile); DumpInfo (ParentCDF); printf ("--------------------------------------------------------------\n"); printf ("State of %s immediately before entering CopyOthers:\n", gChildFile); DumpInfo (ChildCDF); #endif /* * Now, copy everything else of possible interest from the parent file * (but only if it exists!) to the child file. */ if (ParentCDF != -1) { FinishExclusionLists (ParentCDF, NumDim, DimNames, &NumExclude, Exclude); ERROR_CHECK (CopyOthers (ParentCDF, ChildCDF, NumExclude, Exclude, TimeStamp)); } if (gImageVal != DBL_MAX) ERROR_CHECK (FillImage (ChildCDF, NumDim, DimIDs, gImageVal)); ncclose (ChildCDF); if (ParentCDF != -1) { ncclose (ParentCDF); } return (0); }
//===================================================================================== LRESULT APIENTRY DebuggerDialog(HWND hDlg, unsigned message, LONG wParam, LONG lParam) { #ifndef _XBOX int i; int thingToDump; char temp[300]; hWndDlg = hDlg; switch(message) { case WM_INITDIALOG: myDialogWnd = hDlg; sprintf(temp,"%s Debug %s",project_name, FILE_VERSION) ; SetWindowText(myDialogWnd, temp ); SendDlgItemMessage(hDlg, IDC_LOG_COMBINERS, BM_SETCHECK, logCombiners ? BST_CHECKED : BST_UNCHECKED, 0); SendDlgItemMessage(hDlg, IDC_LOG_TRIANGLES, BM_SETCHECK, logTriangles ? BST_CHECKED : BST_UNCHECKED, 0); SendDlgItemMessage(hDlg, IDC_LOG_TEXTURE_BUFFER, BM_SETCHECK, logTextureBuffer ? BST_CHECKED : BST_UNCHECKED, 0); SendDlgItemMessage(hDlg, IDC_LOG_VTX, BM_SETCHECK, logVertex ? BST_CHECKED : BST_UNCHECKED, 0); SendDlgItemMessage(hDlg, IDC_LOG_TO_SCREEN, BM_SETCHECK, logToScreen ? BST_CHECKED : BST_UNCHECKED, 0); SendDlgItemMessage(hDlg, IDC_LOG_TO_FILE, BM_SETCHECK, logToFile ? BST_CHECKED : BST_UNCHECKED, 0); SendDlgItemMessage(hDlg, IDC_LOG_MATRIX, BM_SETCHECK, logMatrix ? BST_CHECKED : BST_UNCHECKED, 0); SendDlgItemMessage(hDlg, IDC_ENABLE_TEXTURE, BM_SETCHECK, debuggerEnableTexture ? BST_CHECKED : BST_UNCHECKED, 0); SendDlgItemMessage(hDlg, IDC_ZBUFFER, BM_SETCHECK, debuggerEnableZBuffer ? BST_CHECKED : BST_UNCHECKED, 0); SendDlgItemMessage(hDlg, IDC_CULLFACE, BM_SETCHECK, debuggerEnableCullFace ? BST_CHECKED : BST_UNCHECKED, 0); SendDlgItemMessage(hDlg, IDC_TEST_TRIS, BM_SETCHECK, debuggerEnableTestTris ? BST_CHECKED : BST_UNCHECKED, 0); SendDlgItemMessage(hDlg, IDC_ALPHA_TEST, BM_SETCHECK, debuggerEnableAlphaTest ? BST_CHECKED : BST_UNCHECKED, 0); SendDlgItemMessage(hDlg, IDC_LOG_WARNING, BM_SETCHECK, logWarning ? BST_CHECKED : BST_UNCHECKED, 0); SendDlgItemMessage(hDlg, IDC_LOG_TEXTURES, BM_SETCHECK, logTextures ? BST_CHECKED : BST_UNCHECKED, 0); SendDlgItemMessage(hDlg, IDC_LOG_UCODE, BM_SETCHECK, logUcodes ? BST_CHECKED : BST_UNCHECKED, 0); SendDlgItemMessage(hDlg, IDC_LOG_MICROCODE, BM_SETCHECK, logMicrocode ? BST_CHECKED : BST_UNCHECKED, 0); SendDlgItemMessage(hDlg, IDC_CONT_W_UNKNOWN, BM_SETCHECK, debuggerContinueWithUnknown ? BST_CHECKED : BST_UNCHECKED, 0); SendDlgItemMessage(hDlg, IDC_LOG_FOG, BM_SETCHECK, logFog ? BST_CHECKED : BST_UNCHECKED, 0); SendDlgItemMessage(hDlg, IDC_DETAILS, BM_SETCHECK, logDetails ? BST_CHECKED : BST_UNCHECKED, 0); SendDlgItemMessage(hDlg, IDC_WINFRAME, BM_SETCHECK, options.bWinFrameMode ? BST_CHECKED : BST_UNCHECKED, 0); SetDlgItemText(hDlg, IDC_MSG, ""); SetDlgItemText(hDlg, IDC_BREAK_AT_COUNT, ""); SetDlgItemText(hDlg, IDC_BREAK_AT_MUX, ""); for( i=0; i<numberOfNextOthers; i++ ) { SendDlgItemMessage(hDlg, IDC_NEXT_EVENT_TYPE, CB_INSERTSTRING, i, (LPARAM) otherNexts[i]); } SendDlgItemMessage(hDlg, IDC_NEXT_EVENT_TYPE, CB_SETCURSEL, NEXT_FLUSH_TRI, 0); for( i=0; i<numberOfThingsToDump; i++ ) { SendDlgItemMessage(hDlg, IDC_THING_TO_DUMP, CB_INSERTSTRING, i, (LPARAM) thingsToDump[i]); } SendDlgItemMessage(hDlg, IDC_THING_TO_DUMP, CB_SETCURSEL, DUMP_CUR_TEXTURE_RGBA, 0); SetLogToFile(logToFile); msgBuf[0] = '\0'; return(TRUE); case WM_COMMAND: switch(LOWORD(wParam)) { case IDC_LOG_COMBINERS: logCombiners = (SendDlgItemMessage(hDlg, IDC_LOG_COMBINERS, BM_GETCHECK, 0, 0) == BST_CHECKED); return(TRUE); break; case IDC_LOG_TRIANGLES: logTriangles = (SendDlgItemMessage(hDlg, IDC_LOG_TRIANGLES, BM_GETCHECK, 0, 0) == BST_CHECKED); return(TRUE); break; case IDC_LOG_TEXTURE_BUFFER: logTextureBuffer = (SendDlgItemMessage(hDlg, IDC_LOG_TEXTURE_BUFFER, BM_GETCHECK, 0, 0) == BST_CHECKED); return(TRUE); break; case IDC_LOG_VTX: logVertex = (SendDlgItemMessage(hDlg, IDC_LOG_VTX, BM_GETCHECK, 0, 0) == BST_CHECKED); return(TRUE); break; case IDC_LOG_TO_SCREEN: logToScreen = (SendDlgItemMessage(hDlg, IDC_LOG_TO_SCREEN, BM_GETCHECK, 0, 0) == BST_CHECKED); return(TRUE); break; case IDC_LOG_TO_FILE: logToFile = (SendDlgItemMessage(hDlg, IDC_LOG_TO_FILE, BM_GETCHECK, 0, 0) == BST_CHECKED); SetLogToFile(logToFile); return(TRUE); break; case IDC_LOG_MATRIX: logMatrix = (SendDlgItemMessage(hDlg, IDC_LOG_MATRIX, BM_GETCHECK, 0, 0) == BST_CHECKED); return(TRUE); break; case IDC_ENABLE_TEXTURE: debuggerEnableTexture = (SendDlgItemMessage(hDlg, IDC_ENABLE_TEXTURE, BM_GETCHECK, 0, 0) == BST_CHECKED); return(TRUE); break; case IDC_ZBUFFER: debuggerEnableZBuffer = (SendDlgItemMessage(hDlg, IDC_ZBUFFER, BM_GETCHECK, 0, 0) == BST_CHECKED); return(TRUE); break; case IDC_CULLFACE: debuggerEnableCullFace = (SendDlgItemMessage(hDlg, IDC_CULLFACE, BM_GETCHECK, 0, 0) == BST_CHECKED); return(TRUE); break; case IDC_TEST_TRIS: debuggerEnableTestTris = (SendDlgItemMessage(hDlg, IDC_TEST_TRIS, BM_GETCHECK, 0, 0) == BST_CHECKED); return(TRUE); break; case IDC_ALPHA_TEST: debuggerEnableAlphaTest = (SendDlgItemMessage(hDlg, IDC_ALPHA_TEST, BM_GETCHECK, 0, 0) == BST_CHECKED); if( !debuggerEnableAlphaTest && CRender::g_pRender ) CRender::g_pRender->SetAlphaTestEnable(FALSE); return(TRUE); break; case IDC_LOG_WARNING: logWarning = (SendDlgItemMessage(hDlg, IDC_LOG_WARNING, BM_GETCHECK, 0, 0) == BST_CHECKED); return(TRUE); break; case IDC_LOG_FOG: logFog = (SendDlgItemMessage(hDlg, IDC_LOG_FOG, BM_GETCHECK, 0, 0) == BST_CHECKED); return(TRUE); break; case IDC_DETAILS: logDetails = (SendDlgItemMessage(hDlg, IDC_DETAILS, BM_GETCHECK, 0, 0) == BST_CHECKED); return(TRUE); break; case IDC_WINFRAME: options.bWinFrameMode = (SendDlgItemMessage(hDlg, IDC_WINFRAME, BM_GETCHECK, 0, 0) == BST_CHECKED); return(TRUE); break; case IDC_LOG_TEXTURES: logTextures = (SendDlgItemMessage(hDlg, IDC_LOG_TEXTURES, BM_GETCHECK, 0, 0) == BST_CHECKED); return(TRUE); break; case IDC_LOG_UCODE: logUcodes = (SendDlgItemMessage(hDlg, IDC_LOG_UCODE, BM_GETCHECK, 0, 0) == BST_CHECKED); return(TRUE); break; case IDC_LOG_MICROCODE: logMicrocode = (SendDlgItemMessage(hDlg, IDC_LOG_MICROCODE, BM_GETCHECK, 0, 0) == BST_CHECKED); return(TRUE); break; case IDC_CONT_W_UNKNOWN: debuggerContinueWithUnknown = (SendDlgItemMessage(hDlg, IDC_CONT_W_UNKNOWN, BM_GETCHECK, 0, 0) == BST_CHECKED); return(TRUE); break; case IDC_CLEAR: msgBuf[0] = '\0'; SetDlgItemText(hDlg, IDC_MSG, ""); break; case IDOK: EndDialog(hDlg, TRUE); return(TRUE); case IDCANCEL: EndDialog(hDlg, TRUE); return(TRUE); } if( !status.bGameIsRunning ) { return(TRUE); } switch(LOWORD(wParam)) { case IDC_PAUSE: debuggerPause = true; break; case IDC_GO: pauseAtNext = false; debuggerPause = false; logTriangles = FALSE; logVertex = FALSE; logMatrix = FALSE; logTextures = FALSE; logUcodes = FALSE; logMicrocode = FALSE; SendDlgItemMessage(hDlg, IDC_LOG_TRIANGLES, BM_SETCHECK, BST_UNCHECKED, 0); SendDlgItemMessage(hDlg, IDC_LOG_VTX, BM_SETCHECK, BST_UNCHECKED, 0); SendDlgItemMessage(hDlg, IDC_LOG_TEXTURES, BM_SETCHECK, BST_UNCHECKED, 0); SendDlgItemMessage(hDlg, IDC_LOG_UCODE, BM_SETCHECK, BST_UNCHECKED, 0); break; case IDC_NEXT: //Next one of the others debuggerPause = false; pauseAtNext = true; eventToPause = SendDlgItemMessage(hDlg, IDC_NEXT_EVENT_TYPE, CB_GETCURSEL, 0, 0); { char text[30]; GetDlgItemText(hDlg,IDC_BREAK_AT_COUNT, text, 29); if( strlen(text)>0 ) { countToPause = atoi(text); } else { countToPause = 0; } if( countToPause > 0x1000 ) countToPause=0; debuggerPauseCount = countToPause; } break; case IDC_DUMP: thingToDump = SendDlgItemMessage(hDlg, IDC_THING_TO_DUMP, CB_GETCURSEL, 0, 0); DumpInfo(thingToDump); break; case IDC_UPDATE_SCREEN: CGraphicsContext::Get()->UpdateFrame(); break; case IDC_CLEAR_BREAKPOINT: break; case IDC_SET_BREAKPOINT: break; case IDC_DROP_TEXTURE: gTextureManager.RecycleAllTextures(); break; case IDC_DROP_COMBINER: debuggerDropCombiners = true; debuggerDropGeneralCombiners = true; debuggerDropDecodedMux = true; debuggerDropCombinerInfos = true; break; } return(TRUE); break; case WM_CLOSE: EndDialog(hDlg, TRUE); pauseAtNext = false; debuggerPause = false; logTriangles = FALSE; logVertex = FALSE; logMatrix = FALSE; //debuggerWinOpened = false; return(TRUE); break; } #endif return(FALSE); }
bool PyrGC::ListSanity() { bool found; if (StackDepth() < 0) { fprintf(stderr, "stack underflow %d\n", (int)StackDepth()); return false; } //postfl("PyrGC::ListSanity\n"); for (int i=0; i<kNumGCSets; ++i) { PyrObjectHdr *obj; GCSet* set = mSets + i; // check black marker obj = &set->mBlack; if (!IsMarker(obj)) { //debugf("set %d black marker color wrong %d %p\n", i, obj->gc_color, obj); fprintf(stderr, "set %d black marker color wrong %d %p\n", i, obj->gc_color, obj); setPostFile(stderr); DumpBackTrace(mVMGlobals); dumpBadObject((PyrObject*)obj); return false; } // check white marker obj = &set->mWhite; if (!IsMarker(obj)) { //debugf("set %d white marker color wrong %d %p\n", i, obj->gc_color, obj); fprintf(stderr, "set %d white marker color wrong %d %p\n", i, obj->gc_color, obj); setPostFile(stderr); DumpBackTrace(mVMGlobals); dumpBadObject((PyrObject*)obj); return false; } // check free pointer between white and black marker if (set->mFree != &set->mBlack) { obj = set->mWhite.next; found = false; while (!IsMarker(obj)) { if (obj == set->mFree) { found = true; break; } obj = obj->next; } if (!found) { //debugf("set %d free pointer not between white and black\n", i); fprintf(stderr, "set %d free pointer not between white and black\n", i); fprintf(stderr, "set->mFree %p\n", set->mFree); fprintf(stderr, "set->mWhite %p\n", &set->mWhite); fprintf(stderr, "set->mBlack %p\n", &set->mBlack); setPostFile(stderr); DumpBackTrace(mVMGlobals); dumpBadObject((PyrObject*)set->mFree); fprintf(stderr, "black %d white %d grey %d\n", mBlackColor, mWhiteColor, mGreyColor); obj = &set->mWhite; int count = 0; do { if (obj == set->mFree) fprintf(stderr, "%4d %p %3d %d FREE\n", count, obj, obj->gc_color, obj->obj_sizeclass); else if (obj == &set->mWhite) fprintf(stderr, "%4d %p %3d %d WHITE\n", count, obj, obj->gc_color, obj->obj_sizeclass); else if (obj == &set->mBlack) fprintf(stderr, "%4d %p %3d %d BLACK\n", count, obj, obj->gc_color, obj->obj_sizeclass); else fprintf(stderr, "%4d %p %3d %d\n", count, obj, obj->gc_color, obj->obj_sizeclass); obj = obj->next; count++; } while (obj != &set->mWhite); return false; } } // scan black list obj = set->mBlack.next; while (!IsMarker(obj)) { if (obj->gc_color != mBlackColor) { //debugf("set %d black list obj color wrong %d (%d, %d, %d) %p\n", // i, obj->gc_color, mBlackColor, mGreyColor, mWhiteColor, obj); fprintf(stderr, "set %d black list obj color wrong %d (%d, %d, %d) %p\n", i, obj->gc_color, mBlackColor, mGreyColor, mWhiteColor, obj); setPostFile(stderr); DumpBackTrace(mVMGlobals); dumpBadObject((PyrObject*)obj); return false; } if (GetGCSet(obj) != set) { //debugf("set %d black obj gcset wrong %d %p\n", i, obj->obj_sizeclass, obj); fprintf(stderr, "set %d black obj gcset wrong %d %p\n", i, obj->obj_sizeclass, obj); setPostFile(stderr); dumpBadObject((PyrObject*)obj); return false; } if (obj->next->prev != obj) { fprintf(stderr, "set %d black obj->next->prev != obj\n", i); setPostFile(stderr); DumpBackTrace(mVMGlobals); dumpBadObject((PyrObject*)obj); } // scan for refs to white. if (!BlackToWhiteCheck((PyrObject*)obj)) return false; obj = obj->next; } // scan white list obj = set->mWhite.next; while (obj != set->mFree) { if (obj->gc_color != mWhiteColor) { //debugf("set %d white list obj color wrong %d (%d, %d, %d) %p\n", // i, obj->gc_color, mBlackColor, mGreyColor, mWhiteColor, obj); //debugf("hmmm free %p black %p\n", set->mFree, set->black); fprintf(stderr, "set %d white list obj color wrong %d (%d, %d, %d) %p\n", i, obj->gc_color, mBlackColor, mGreyColor, mWhiteColor, obj); fprintf(stderr, "hmmm free %p black %p\n", set->mFree, &set->mBlack); setPostFile(stderr); DumpBackTrace(mVMGlobals); dumpBadObject((PyrObject*)obj); return false; } if (GetGCSet(obj) != set) { //debugf("set %d white obj gcset wrong %d %p\n", i, obj->obj_sizeclass, obj); fprintf(stderr, "set %d white obj gcset wrong %d %p\n", i, obj->obj_sizeclass, obj); setPostFile(stderr); DumpBackTrace(mVMGlobals); dumpBadObject((PyrObject*)obj); return false; } if (obj->next->prev != obj) { fprintf(stderr, "set %d white obj->next->prev != obj\n", i); setPostFile(stderr); DumpBackTrace(mVMGlobals); dumpBadObject((PyrObject*)obj); } obj = obj->next; } // mark all free list items free obj = set->mFree; while (!IsMarker(obj)) { /*if (obj->gc_color == mGreyColor) { //debugf("grey obj on free list\n"); fprintf(stderr, "grey obj on free list\n"); return false; }*/ //post("FREE\n"); //dumpObject((PyrObject*)(PyrObject*)obj); obj->gc_color = mFreeColor; if (GetGCSet(obj) != set) { //debugf("set %d free obj gcset wrong %d %p\n", i, obj->obj_sizeclass, obj); fprintf(stderr, "set %d free obj gcset wrong %d %p\n", i, obj->obj_sizeclass, obj); //dumpObject((PyrObject*)obj); return false; } if (obj->next->prev != obj) { fprintf(stderr, "set %d free obj->next->prev != obj\n", i); //dumpObject((PyrObject*)obj); } obj = obj->next; } } int numgrey = 0; PyrObjectHdr *grey = mGrey.next; while (!IsMarker(grey)) { numgrey++; if (!IsGrey(grey)) { fprintf(stderr, "sc Object on grey list not grey %d %d %d\n", grey->gc_color, mGreyColor, numgrey); fprintf(stderr, "%p <- %p -> %p grey %p process %p\n", mGrey.prev, &mGrey, mGrey.next, grey, mProcess); return false; } grey = grey->next; } if (numgrey != mNumGrey) { fprintf(stderr, "grey count off %d %d\n", numgrey, mNumGrey); DumpInfo(); fprintf(stderr, "."); return false; } return true; }
VOID TryConnectPort(char *port_name) { DWORD Status = 0; HANDLE Port = 0; int i; UNICODE_STRING PortName; OBJECT_ATTRIBUTES ObjectAttributes; WORD Name [BUF_SIZE] = {0}; int dwx = 0; char * port_name_save = port_name; /* * Convert the port's name to Unicode. */ for ( PortName.Length = 0; ( *port_name && (PortName.Length < BUF_SIZE) ); ) { Name[PortName.Length++] = (WORD) *port_name++; } Name[PortName.Length] = 0; PortName.Length = PortName.Length * sizeof (WORD); PortName.MaximumLength = PortName.Length + sizeof (WORD); PortName.Buffer = (PWSTR) Name; /* * Prepare the port object attributes. */ ObjectAttributes.Length = sizeof (OBJECT_ATTRIBUTES); ObjectAttributes.RootDirectory = NULL; ObjectAttributes.ObjectName = NULL /*& PortName */; ObjectAttributes.Attributes = OBJ_CASE_INSENSITIVE; ObjectAttributes.SecurityDescriptor = NULL; ObjectAttributes.SecurityQualityOfService = NULL; /* * Try to issue a connection request. */ Port = 0; Status = ConnectPort( & Port, /* & PortHandle */ & PortName, /* & PortName */ & ObjectAttributes, /* & PortAttributes */ NULL, /* & SecurityQos */ NULL, /* & SectionInfo */ NULL, /* & MapInfo */ NULL, /* & MaxMessageSize */ LPC_CONNECT_FLAG5 /* & ConnectInfoLength */ ); if (Status == STATUS_SUCCESS) { DumpInfo( Name, Status, "connected", Port ); /* Hot waiting */ for (dwx=0; dwx<MAXARG; ++dwx) { YieldExecution(); } if (FALSE == CloseHandle(Port)) { printf( "Could not close the port handle %08X.\n", Port ); } return; } printf( "Connection to port \"%s\" failed (Status = %08X).\n", port_name_save, Status ); }
VOID TryCreatePort(char *port_name) { DWORD Status = 0; HANDLE Port = 0; int i; UNICODE_STRING PortName; OBJECT_ATTRIBUTES ObjectAttributes; WORD Name [BUF_SIZE] = {0}; int dwx = 0; char * port_name_save = port_name; /* * Convert the port's name to Unicode. */ for ( PortName.Length = 0; ( *port_name && (PortName.Length < BUF_SIZE) ); ) { Name[PortName.Length++] = (WORD) *port_name++; } Name[PortName.Length] = 0; PortName.Length = PortName.Length * sizeof (WORD); PortName.MaximumLength = PortName.Length + sizeof (WORD); PortName.Buffer = (PWSTR) Name; /* * Prepare the port object attributes. */ ObjectAttributes.Length = sizeof (OBJECT_ATTRIBUTES); ObjectAttributes.RootDirectory = NULL; ObjectAttributes.ObjectName = & PortName; ObjectAttributes.Attributes = 0; //OBJ_CASE_INSENSITIVE --> STATUS_INVALID_PARAMETER ==> case sensitive!; ObjectAttributes.SecurityDescriptor = NULL; ObjectAttributes.SecurityQualityOfService = NULL; /* * Try to issue a connection request. */ Port = 0; Status = CreatePort( & Port, & ObjectAttributes, 0, /* ACCESS_MASK? */ 0, /* Unknown3 */ LPC_CONNECT_FLAG5 ); if (Status == STATUS_SUCCESS) { DumpInfo( Name, Status, "created", Port ); /* Hot waiting */ for (dwx=0; dwx<MAXARG; ++dwx) { YieldExecution(); } if (FALSE == CloseHandle(Port)) { printf( "Could not close the port handle %08X.\n", Port ); } return; } printf( "Creating port \"%s\" failed (Status = %08X).\n", port_name_save, Status ); }
virtual status_t DeviceAdded(BUSBDevice* device) { DumpInfo(*device, fVerbose); return B_OK; }