}
return NULL;
}
-
+#if defined(OSD_QT)
+#include "../debugger/debugger_thread.h"
+#endif
#ifdef _MSC_VER
unsigned __stdcall debugger_thread(void *lpx)
#else
}
p->osd->sleep(10);
}
+
uint32_t prog_addr_mask = cpu->get_debug_prog_addr_mask();
uint32_t data_addr_mask = cpu->get_debug_data_addr_mask();
uint32_t dump_addr = 0;
void EMU::initialize_debugger()
{
now_debugging = false;
+ hDebugger = NULL;
}
void EMU::release_debugger()
class OSD;
#ifdef USE_DEBUGGER
+#if defined(OSD_QT)
+class CSP_DebuggerThread;
+#endif
typedef struct {
OSD *osd;
VM *vm;
//emu->open_debugger(no);
VM *vm = emu->get_vm();
- if(emu->now_debugging) this->OnCloseDebugger();
+ if((emu->now_debugging ) || (emu->hDebugger != NULL)) this->OnCloseDebugger();
if(!(emu->now_debugging && emu->debugger_thread_param.cpu_index == no)) {
//emu->close_debugger();
if(vm->get_cpu(no) != NULL && vm->get_cpu(no)->get_debugger() != NULL) {
-
+ QString windowName = QString::fromUtf8(vm->get_cpu(no)->get_device_name());
+ windowName = QString::fromUtf8("Debugger ") + windowName;
emu->hDebugger = new CSP_Debugger(this);
QString objNameStr = QString("EmuDebugThread");
emu->hDebugger->setObjectName(objNameStr);
emu->hDebugger->debugger_thread_param.cpu_index = no;
emu->stop_record_sound();
emu->stop_record_video();
- emu->now_debugging = true;
+ //emu->now_debugging = true;
connect(this, SIGNAL(quit_debugger_thread()), emu->hDebugger, SLOT(doExit()));
connect(this, SIGNAL(destroyed()), emu->hDebugger, SLOT(do_destroy_thread()));
//connect(this, SIGNAL(quit_debugger_thread()), emu->hDebugger, SLOT(close()));
connect(emu->hDebugger, SIGNAL(sig_put_string(QString)), emu->hDebugger, SLOT(put_string(QString)));
emu->hDebugger->show();
emu->hDebugger->run();
+ emu->hDebugger->setWindowTitle(windowName);
}
}
}
set(s_qt_debugger_headers
qt_debugger.h
- debugger_thread.h
)
if(USE_QT_5)
add_library(qt_debugger
qt_debugger.cpp
- debugger_thread.cpp
${s_qt_debugger_headers_MOC}
)
void CSP_DebuggerThread::quit_debugger()
{
-#if defined(USE_DEBUGGER)
- debugger->now_going = false;
- d_params->request_terminate = true;
- try {
- debugger->now_debugging = debugger->now_going = debugger->now_suspended = false;
- } catch(...) {
- }
- d_params->running = false;
+#if defined(USE_DEBUGGER)
+ emu->close_debugger();
// release console
#endif
emit quit_debugger_thread();
extern void *debugger_thread(void *p);
#endif
-void CSP_DebuggerThread::run()
+void CSP_DebuggerThread::run_debugger(void)
{
- QString str = QString::fromUtf8(_T("Debugger CPU #")) + QString::number(cpu_index);
- emit sig_set_title(str);
-
- pausing = false;
-#if defined(USE_DEBUGGER)
- d_params->running = true;
- d_params->request_terminate = false;
- dasm_addr = cpu->get_next_pc();
- debugger->now_going = false;
- debugger->now_debugging = true;
- debugger_thread((void *)d_params);
-#endif
- //this->quit();
+// emu->open_debugger(cpu_index);
}
CSP_DebuggerThread::CSP_DebuggerThread(QObject *parent, void *th) : QThread(parent)
cpu_index = d_params->cpu_index;
debugger = (DEBUGGER *)cpu->get_debugger();
#endif
- connect(this, SIGNAL(started()), this, SLOT(run()));
+ //connect(this, SIGNAL(started()), this, SLOT(run()));
+ QString str = QString::fromUtf8(_T("Debugger CPU #")) + QString::number(cpu_index);
+ emit sig_set_title(str);
+
+ pausing = false;
+#if defined(USE_DEBUGGER)
+ d_params->running = true;
+ d_params->request_terminate = false;
+ dasm_addr = cpu->get_next_pc();
+ //debugger->now_going = false;
+ //debugger->now_debugging = true;
+ emu->open_debugger(cpu_index);
+ //debugger_thread((void *)d_params);
+#endif
+ //this->exec();
+ //this->quit();
}
CSP_DebuggerThread::~CSP_DebuggerThread()
{
+ emu->close_debugger();
}
CSP_DebuggerThread(QObject *parent, void *th);
~CSP_DebuggerThread();
public slots:
- void run();
+ void run_debugger();
void quit_debugger();
signals:
int quit_debugger_thread();
#include <fcntl.h>
#include <QObject>
#include <QMetaObject>
+#include <QApplication>
#include "qt_debugger.h"
void CSP_Debugger::run(void)
{
connect(text_command, SIGNAL(editingFinished()), this, SLOT(call_debugger()));
- connect(this, SIGNAL(sig_finished()), this, SLOT(close()));
- connect(this, SIGNAL(destroyed()), this, SLOT(doExit()));
connect(parent_object, SIGNAL(quit_debugger_thread()), this, SLOT(close()));
#if defined(USE_DEBUGGER)
- main_thread = new CSP_DebuggerThread(NULL, &debugger_thread_param);
OSD *osd = debugger_thread_param.osd;
- main_thread->setObjectName(QString::fromUtf8("Debugger"));
- main_thread->moveToThread(main_thread);
+ connect(osd, SIGNAL(sig_close_console()), this, SLOT(do_destroy_thread()));
connect(this, SIGNAL(sig_call_debugger(QString)), osd, SLOT(do_set_input_string(QString)));
connect(osd, SIGNAL(sig_put_string_debugger(QString)), this, SLOT(put_string(QString)));
-
- connect(main_thread, SIGNAL(finished()), this, SLOT(doExit()));
- connect(main_thread, SIGNAL(quit_debugger_thread()), this, SLOT(doExit()));
- connect(this, SIGNAL(sig_close_debugger()), main_thread, SLOT(quit_debugger()));
- main_thread->start();
+ if(emu != NULL) {
+ emu->open_debugger(debugger_thread_param.cpu_index);
+ } else {
+ QString mes = QApplication::translate("Debugger", "Emulator still not start\nPlease wait.", 0);
+ put_string(mes);
+ }
#endif
}
void CSP_Debugger::closeEvent(QCloseEvent *event)
{
//emit sig_close_debugger();
- event->ignore();
+ //event->ignore();
+#if 1
+ debugger_thread_param.request_terminate = true;
+ if(emu != NULL) {
+ debugger_thread_t *d_params = &debugger_thread_param;
+ DEVICE *cpu = d_params->vm->get_cpu(d_params->cpu_index);
+ uint32_t cpu_index = d_params->cpu_index;
+ DEBUGGER *debugger = (DEBUGGER *)cpu->get_debugger();
+ if(emu->is_debugger_enabled(cpu_index)) {
+ emu->close_debugger();
+ // debugger->now_debugging = false;
+ }
+ }
+#endif
+ event->accept();
}
void CSP_Debugger::do_destroy_thread(void)
{
-#if defined(USE_DEBUGGER)
- if(main_thread != NULL) {
- if(main_thread->isRunning()) {
- main_thread->quit_debugger();
- main_thread->terminate();
- }
- delete main_thread;
- }
- main_thread = NULL;
-#endif
this->close();
}
CSP_Debugger::~CSP_Debugger()
{
#if defined(USE_DEBUGGER)
- if(main_thread != NULL) {
- if(main_thread->isRunning()) {
- main_thread->quit_debugger();
- main_thread->terminate();
- }
- delete main_thread;
- }
+ if(emu != NULL) emu->close_debugger();
#endif
}
void sig_call_debugger(QString);
void sig_close_debugger(void);
void sig_stop_debugger(void);
+ void sig_run_debugger(void);
};
QT_END_NAMESPACE
int sig_update_device_node_name(int id, const _TCHAR *name);
int sig_enable_mouse(void);
int sig_disable_mouse(void);
+ int sig_close_console(void);
};
QT_END_NAMESPACE
//DebugSemaphore->release(DebugSemaphore->available());
console_cmd_str.clear();
osd_console_opened = false;
+ emit sig_close_console();
}
unsigned int OSD_BASE::get_console_code_page()
{
// draw screen
screen_mutex->lock();
- lock_vm();
+ //lock_vm();
if(vm_screen_buffer.width != vm_screen_width || vm_screen_buffer.height != vm_screen_height) {
//emit sig_movie_set_width(vm_screen_width);
//emit sig_movie_set_height(vm_screen_height);
initialize_screen_buffer(&vm_screen_buffer, vm_screen_width, vm_screen_height, 0);
}
this->vm_draw_screen();
- unlock_vm();
+ //unlock_vm();
screen_mutex->unlock();
// screen size was changed in vm->draw_screen()
if(vm_screen_buffer.width != vm_screen_width || vm_screen_buffer.height != vm_screen_height) {
void VM::close_tape(int drv)
{
- emu->lock_vm();
if(drec != NULL) drec->close_tape();
- emu->unlock_vm();
}
bool VM::is_tape_inserted(int drv)