static void test_c64_vice_init(void**) { int count = 0; assert_true(PluginHandler_addPlugin(OBJECT_DIR, "c64_vice_plugin")); assert_non_null(PluginHandler_getBackendPlugins(&count)[0]); }
static void test_lldb(void** state) { (void)state; // we only do the LLDB test on Mac for now #ifdef __APPLE__ PluginData* pluginData; Session* session; int count = 0; assert_true(PluginHandler_addPlugin(OBJECT_DIR, "lldb_plugin")); assert_non_null(pluginData = PluginHandler_getBackendPlugins(&count)[0]); session = Session_createLocal((PDBackendPlugin*)pluginData->plugin, OBJECT_DIR "/crashing_native"); assert_non_null(session); // I hate to do this but there is really no good way to deal with this otherwise (at least currently) Time_sleepMs(800); Session_update(session); Session_update(session); // Expect that we have a crash here and thus are in PDDebugState_stopException state assert_int_equal(session->state, PDDebugState_StopException); // Request locals location. PDWriter* writer = session->currentWriter; PDReader* reader = session->reader; PDWrite_event_begin(writer, PDEventType_GetCallstack); PDWrite_u8(writer, "dummy", 0); PDWrite_event_end(writer); Session_update(session); PDBinaryWriter_finalize(session->currentWriter); PDBinaryReader_initStream(reader, PDBinaryWriter_getData(session->currentWriter), PDBinaryWriter_getSize(session->currentWriter)); uint32_t event; bool foundCallstack = false; while ((event = PDRead_get_event(reader)) != 0) { switch (event) { case PDEventType_SetCallstack: { foundCallstack = true; break; } } } assert_true(foundCallstack); #endif }
static void test_c64_vice_connect(void**) { int count = 0; PluginData* pluginData; pluginData = PluginHandler_getBackendPlugins(&count)[0]; // Lanuch C64 VICE // TODO: Fix hardcoded path #ifdef PRODBG_MAC //const char* viceLaunchPath = "../../vice/x64.app/Contents/MacOS/x64"; const char* viceLaunchPath = "/Applications/VICE/x64.app/Contents/MacOS/x64"; #elif PRODBG_WIN const char* viceLaunchPath = "..\\..\\vice\\x64.exe"; #else // Not supported on Linux yet const char* viceLaunchPath = 0; #endif assert_non_null(viceLaunchPath); //const char* argv[] = { viceLaunchPath, "-remotemonitor", "-console", "examples/c64_vice/test.prg", 0 }; const char* argv[] = { viceLaunchPath, "-remotemonitor", "-console", 0 }; s_viceHandle = Process_spawn(viceLaunchPath, argv); assert_non_null(s_viceHandle); // Wait 3 sec for VICE to launch Time_sleepMs(3000); // TODO: Non hard-coded path s_session = Session_createLocal((PDBackendPlugin*)pluginData->plugin, 0); // make sure we attach to VICE PDWriter* writer = s_session->currentWriter; PDWrite_eventBegin(writer, PDEventType_menuEvent); PDWrite_u32(writer, "menu_id", 0); PDWrite_eventEnd(writer); Session_update(s_session); // We haven't setup vice at this point so no connect assert_int_not_equal(s_session->state, PDDebugState_noTarget); }
static void test_c64_vice_fail_connect(void**) { int count = 0; PluginData* pluginData; pluginData = PluginHandler_getBackendPlugins(&count)[0]; s_session = Session_createLocal((PDBackendPlugin*)pluginData->plugin, 0); Session_update(s_session); // We haven't setup vice at this point so no connect assert_int_equal(s_session->state, PDDebugState_noTarget); Session_destroy(s_session); s_session = 0; }