Implemented a small kernel debugger add-on that triggers a redraw of the
entire screen when exiting the kernel debugger. It sets up a thread that sends a message to the (currently hardcoded) desktop message looper. The desktop then does mark the whole screen dirty which causes a full redraw. Since interrupts need to be enabled I went with an asynchronous thread and releasing a request sem in the add-ons' exit hook. Added the add-on to the image as it shouldn't hurt to have it for now. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24025 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -145,7 +145,8 @@ AddFilesToHaikuImage beos system add-ons kernel busses scsi
|
|||||||
AddFilesToHaikuImage beos system add-ons kernel busses usb
|
AddFilesToHaikuImage beos system add-ons kernel busses usb
|
||||||
: <usb>uhci <usb>ehci ;
|
: <usb>uhci <usb>ehci ;
|
||||||
AddFilesToHaikuImage beos system add-ons kernel console : vga_text ;
|
AddFilesToHaikuImage beos system add-ons kernel console : vga_text ;
|
||||||
AddFilesToHaikuImage beos system add-ons kernel debugger : <kdebug>hangman ;
|
AddFilesToHaikuImage beos system add-ons kernel debugger
|
||||||
|
: <kdebug>hangman <kdebug>invalidate_on_exit ;
|
||||||
AddFilesToHaikuImage beos system add-ons kernel file_systems
|
AddFilesToHaikuImage beos system add-ons kernel file_systems
|
||||||
: $(BEOS_ADD_ONS_FILE_SYSTEMS) ;
|
: $(BEOS_ADD_ONS_FILE_SYSTEMS) ;
|
||||||
AddFilesToHaikuImage beos system add-ons kernel generic
|
AddFilesToHaikuImage beos system add-ons kernel generic
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
SubDir HAIKU_TOP src add-ons kernel debugger invalidate_on_exit ;
|
||||||
|
|
||||||
|
UsePrivateHeaders kernel ;
|
||||||
|
|
||||||
|
KernelAddon <kdebug>invalidate_on_exit :
|
||||||
|
invalidate_on_exit.cpp
|
||||||
|
;
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2008, Michael Lotz, [email protected]
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#include <debug.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
|
||||||
|
static sem_id sRequestSem = -1;
|
||||||
|
|
||||||
|
|
||||||
|
static int32
|
||||||
|
invalidate_loop(void *data)
|
||||||
|
{
|
||||||
|
while (true) {
|
||||||
|
if (acquire_sem(sRequestSem) != B_OK)
|
||||||
|
break;
|
||||||
|
|
||||||
|
uint32 message[3];
|
||||||
|
message[0] = sizeof(message); // size
|
||||||
|
message[1] = 'KDLE'; // message code
|
||||||
|
message[2] = 0; // flags
|
||||||
|
|
||||||
|
// where "d:0:baron' stands for desktop x of user y which both
|
||||||
|
// currently are hardcoded and where '_PTL' is the port link code
|
||||||
|
write_port(find_port("d:0:baron"), '_PTL', &message, sizeof(message));
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
exit_debugger()
|
||||||
|
{
|
||||||
|
release_sem_etc(sRequestSem, 1, B_DO_NOT_RESCHEDULE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static status_t
|
||||||
|
std_ops(int32 op, ...)
|
||||||
|
{
|
||||||
|
if (op == B_MODULE_INIT) {
|
||||||
|
sRequestSem = create_sem(0, "invalidate_loop_request");
|
||||||
|
if (sRequestSem < B_OK)
|
||||||
|
return sRequestSem;
|
||||||
|
|
||||||
|
thread_id thread = spawn_kernel_thread(&invalidate_loop,
|
||||||
|
"invalidate_loop", B_NORMAL_PRIORITY, NULL);
|
||||||
|
if (thread < B_OK)
|
||||||
|
return thread;
|
||||||
|
|
||||||
|
send_signal_etc(thread, SIGCONT, B_DO_NOT_RESCHEDULE);
|
||||||
|
return B_OK;
|
||||||
|
} else if (op == B_MODULE_UNINIT) {
|
||||||
|
// deleting the sem will also cause the thread to exit
|
||||||
|
delete_sem(sRequestSem);
|
||||||
|
sRequestSem = -1;
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
return B_BAD_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static struct debugger_module_info sModuleInfo = {
|
||||||
|
{
|
||||||
|
"debugger/invalidate_on_exit/v1",
|
||||||
|
B_KEEP_LOADED,
|
||||||
|
&std_ops
|
||||||
|
},
|
||||||
|
|
||||||
|
NULL,
|
||||||
|
exit_debugger
|
||||||
|
};
|
||||||
|
|
||||||
|
module_info *modules[] = {
|
||||||
|
(module_info *)&sModuleInfo,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
@@ -633,6 +633,17 @@ Desktop::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ToDo: Remove this again. It is a message sent by the
|
||||||
|
// invalidate_on_exit kernel debugger add-on to trigger a redraw
|
||||||
|
// after exiting a kernel debugger session.
|
||||||
|
case 'KDLE':
|
||||||
|
{
|
||||||
|
BRegion dirty;
|
||||||
|
dirty.Include(fVirtualScreen.Frame());
|
||||||
|
MarkDirty(dirty);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
printf("Desktop %d:%s received unexpected code %ld\n", 0, "baron", code);
|
printf("Desktop %d:%s received unexpected code %ld\n", 0, "baron", code);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user