debugging instrumentation for Cortex lockup bug (some weeks old already)

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22029 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Marcus Overhagen 2007-08-21 18:44:55 +00:00
parent 9b60051929
commit 31cf24c13e
4 changed files with 46 additions and 18 deletions

View File

@ -74,6 +74,13 @@ void find_media_addon_server_port()
}
static void check(int code)
{
static int rep = 0;
if(code == 0x204 && rep++ == 200)
debugger("scheisse!");
}
status_t
request_data::SendReply(status_t result, reply_data *reply, int replysize) const
{
@ -138,6 +145,7 @@ status_t QueryAddonServer(int32 msgcode, request_data *request, int requestsize,
status_t SendToPort(port_id sendport, int32 msgcode, command_data *msg, int size)
{
status_t rv;
check(msgcode);
rv = write_port_etc(sendport, msgcode, msg, size, B_RELATIVE_TIMEOUT, TIMEOUT);
if (rv != B_OK) {
ERROR("SendToPort: write_port failed, msgcode 0x%lx, port %ld, error %#lx (%s)\n", msgcode, sendport, rv, strerror(rv));
@ -150,6 +158,7 @@ status_t SendToPort(port_id sendport, int32 msgcode, command_data *msg, int size
} else {
return rv;
}
check(msgcode);
rv = write_port_etc(sendport, msgcode, msg, size, B_RELATIVE_TIMEOUT, TIMEOUT);
if (rv != B_OK) {
ERROR("SendToPort: retrying write_port failed, msgcode 0x%lx, port %ld, error %#lx (%s)\n", msgcode, sendport, rv, strerror(rv));
@ -167,6 +176,7 @@ status_t QueryPort(port_id requestport, int32 msgcode, request_data *request, in
request->reply_port = _PortPool->GetPort();
check(msgcode);
rv = write_port_etc(requestport, msgcode, request, requestsize, B_RELATIVE_TIMEOUT, TIMEOUT);
if (rv != B_OK) {
@ -181,6 +191,7 @@ status_t QueryPort(port_id requestport, int32 msgcode, request_data *request, in
_PortPool->PutPort(request->reply_port);
return rv;
}
check(msgcode);
rv = write_port_etc(requestport, msgcode, request, requestsize, B_RELATIVE_TIMEOUT, TIMEOUT);
if (rv != B_OK) {
ERROR("QueryPort: retrying write_port failed, msgcode 0x%lx, port %ld, error %#lx (%s)\n", msgcode, requestport, rv, strerror(rv));

View File

@ -26,7 +26,7 @@
* THE SOFTWARE.
*
*/
//#define DEBUG 7
#include <MediaRoster.h>
#include <MediaNode.h>
#include <TimeSource.h>
@ -47,6 +47,15 @@
using std::nothrow;
using std::nothrow_t;
#undef TRACE
//#define TRACE_MEDIA_NODE
#ifdef TRACE_MEDIA_NODE
#define TRACE printf
#else
#define TRACE(x...)
#endif
// don't rename this one, it's used and exported for binary compatibility
int32 BMediaNode::_m_changeTag = 0;
@ -347,7 +356,7 @@ BMediaNode::WaitForMessage(bigtime_t waitUntil,
uint32 flags,
void *_reserved_)
{
PRINT(6, "CALLED BMediaNode::WaitForMessage()\n");
TRACE("entering: BMediaNode::WaitForMessage()\n");
// This function waits until either real time specified by
// waitUntil or a message is received on the control port.
@ -364,10 +373,10 @@ BMediaNode::WaitForMessage(bigtime_t waitUntil,
return size; // return the error code
}
PRINT(7, "BMediaNode::WaitForMessage %#lx, node %ld, this %p\n", message, fNodeID, this);
TRACE("BMediaNode::WaitForMessage request is: %#lx, node %ld, this %p\n", message, fNodeID, this);
if (message > NODE_MESSAGE_START && message < NODE_MESSAGE_END) {
PRINT(4, "BMediaNode::WaitForMessage calling BMediaNode\n");
TRACE("BMediaNode::WaitForMessage calling BMediaNode\n");
if (B_OK == BMediaNode::HandleMessage(message, data, size))
return B_OK;
}
@ -375,7 +384,7 @@ BMediaNode::WaitForMessage(bigtime_t waitUntil,
if (message > PRODUCER_MESSAGE_START && message < PRODUCER_MESSAGE_END) {
if (!fProducerThis)
fProducerThis = dynamic_cast<BBufferProducer *>(this);
PRINT(4, "BMediaNode::WaitForMessage calling BBufferProducer %p\n", fProducerThis);
TRACE("BMediaNode::WaitForMessage calling BBufferProducer %p\n", fProducerThis);
if (fProducerThis && B_OK == fProducerThis->BBufferProducer::HandleMessage(message, data, size))
return B_OK;
}
@ -383,7 +392,7 @@ BMediaNode::WaitForMessage(bigtime_t waitUntil,
if (message > CONSUMER_MESSAGE_START && message < CONSUMER_MESSAGE_END) {
if (!fConsumerThis)
fConsumerThis = dynamic_cast<BBufferConsumer *>(this);
PRINT(4, "BMediaNode::WaitForMessage calling BBufferConsumer %p\n", fConsumerThis);
TRACE("BMediaNode::WaitForMessage calling BBufferConsumer %p\n", fConsumerThis);
if (fConsumerThis && B_OK == fConsumerThis->BBufferConsumer::HandleMessage(message, data, size))
return B_OK;
}
@ -391,7 +400,7 @@ BMediaNode::WaitForMessage(bigtime_t waitUntil,
if (message > FILEINTERFACE_MESSAGE_START && message < FILEINTERFACE_MESSAGE_END) {
if (!fFileInterfaceThis)
fFileInterfaceThis = dynamic_cast<BFileInterface *>(this);
PRINT(4, "BMediaNode::WaitForMessage calling BFileInterface %p\n", fFileInterfaceThis);
TRACE("BMediaNode::WaitForMessage calling BFileInterface %p\n", fFileInterfaceThis);
if (fFileInterfaceThis && B_OK == fFileInterfaceThis->BFileInterface::HandleMessage(message, data, size))
return B_OK;
}
@ -399,7 +408,7 @@ BMediaNode::WaitForMessage(bigtime_t waitUntil,
if (message > CONTROLLABLE_MESSAGE_START && message < CONTROLLABLE_MESSAGE_END) {
if (!fControllableThis)
fControllableThis = dynamic_cast<BControllable *>(this);
PRINT(4, "BMediaNode::WaitForMessage calling BControllable %p\n", fControllableThis);
TRACE("BMediaNode::WaitForMessage calling BControllable %p\n", fControllableThis);
if (fControllableThis && B_OK == fControllableThis->BControllable::HandleMessage(message, data, size))
return B_OK;
}
@ -407,12 +416,12 @@ BMediaNode::WaitForMessage(bigtime_t waitUntil,
if (message > TIMESOURCE_MESSAGE_START && message < TIMESOURCE_MESSAGE_END) {
if (!fTimeSourceThis)
fTimeSourceThis = dynamic_cast<BTimeSource *>(this);
PRINT(4, "BMediaNode::WaitForMessage calling BTimeSource %p\n", fTimeSourceThis);
TRACE("BMediaNode::WaitForMessage calling BTimeSource %p\n", fTimeSourceThis);
if (fTimeSourceThis && B_OK == fTimeSourceThis->BTimeSource::HandleMessage(message, data, size))
return B_OK;
}
PRINT(4, "BMediaNode::WaitForMessage calling default\n");
TRACE("BMediaNode::WaitForMessage calling default HandleMessage\n");
if (B_OK == HandleMessage(message, data, size))
return B_OK;
@ -522,7 +531,7 @@ BMediaNode::HandleMessage(int32 message,
const void *data,
size_t size)
{
PRINT(4, "BMediaNode::HandleMessage %#lx, node %ld\n", message, fNodeID);
TRACE("BMediaNode::HandleMessage %#lx, node %ld\n", message, fNodeID);
switch (message) {
case NODE_FINAL_RELEASE:
{
@ -546,7 +555,7 @@ BMediaNode::HandleMessage(int32 message,
case NODE_START:
{
const node_start_command *command = static_cast<const node_start_command *>(data);
printf("NODE_START, node %ld\n", fNodeID);
TRACE("BMediaNode::HandleMessage NODE_START, node %ld\n", fNodeID);
Start(command->performance_time);
return B_OK;
}
@ -554,7 +563,7 @@ BMediaNode::HandleMessage(int32 message,
case NODE_STOP:
{
const node_stop_command *command = static_cast<const node_stop_command *>(data);
printf("NODE_STOP, node %ld\n", fNodeID);
TRACE("BMediaNode::HandleMessage NODE_STOP, node %ld\n", fNodeID);
Stop(command->performance_time, command->immediate);
return B_OK;
}
@ -562,7 +571,7 @@ BMediaNode::HandleMessage(int32 message,
case NODE_SEEK:
{
const node_seek_command *command = static_cast<const node_seek_command *>(data);
printf("NODE_SEEK, node %ld\n", fNodeID);
TRACE("BMediaNode::HandleMessage NODE_SEEK, node %ld\n", fNodeID);
Seek(command->media_time, command->performance_time);
return B_OK;
}
@ -570,6 +579,7 @@ BMediaNode::HandleMessage(int32 message,
case NODE_SET_RUN_MODE:
{
const node_set_run_mode_command *command = static_cast<const node_set_run_mode_command *>(data);
TRACE("BMediaNode::HandleMessage NODE_SET_RUN_MODE, node %ld\n", fNodeID);
// when changing this, also change PRODUCER_SET_RUN_MODE_DELAY
fRunMode = command->mode;
SetRunMode(fRunMode);
@ -579,12 +589,14 @@ BMediaNode::HandleMessage(int32 message,
case NODE_TIME_WARP:
{
const node_time_warp_command *command = static_cast<const node_time_warp_command *>(data);
TRACE("BMediaNode::HandleMessage NODE_TIME_WARP, node %ld\n", fNodeID);
TimeWarp(command->at_real_time, command->to_performance_time);
return B_OK;
}
case NODE_PREROLL:
{
TRACE("BMediaNode::HandleMessage NODE_PREROLL, node %ld\n", fNodeID);
Preroll();
return B_OK;
}
@ -593,7 +605,7 @@ BMediaNode::HandleMessage(int32 message,
{
const node_set_timesource_command *command = static_cast<const node_set_timesource_command *>(data);
TRACE("NODE_SET_TIMESOURCE, node %ld, timesource %ld enter\n", fNodeID, command->timesource_id);
TRACE("BMediaNode::HandleMessage NODE_SET_TIMESOURCE, node %ld, timesource %ld enter\n", fNodeID, command->timesource_id);
fTimeSourceID = command->timesource_id;
@ -613,7 +625,7 @@ BMediaNode::HandleMessage(int32 message,
// any derived class
SetTimeSource(fTimeSource);
TRACE("NODE_SET_TIMESOURCE, node %ld, timesource %ld leave\n", fNodeID, command->timesource_id);
TRACE("BMediaNode::HandleMessage NODE_SET_TIMESOURCE, node %ld, timesource %ld leave\n", fNodeID, command->timesource_id);
return B_OK;
}
@ -621,6 +633,7 @@ BMediaNode::HandleMessage(int32 message,
case NODE_GET_TIMESOURCE:
{
const node_get_timesource_request *request = static_cast<const node_get_timesource_request *>(data);
TRACE("BMediaNode::HandleMessage NODE_GET_TIMESOURCE, node %ld\n", fNodeID);
node_get_timesource_reply reply;
reply.timesource_id = fTimeSourceID;
request->SendReply(B_OK, &reply, sizeof(reply));
@ -630,6 +643,7 @@ BMediaNode::HandleMessage(int32 message,
case NODE_REQUEST_COMPLETED:
{
const node_request_completed_command *command = static_cast<const node_request_completed_command *>(data);
TRACE("BMediaNode::HandleMessage NODE_REQUEST_COMPLETED, node %ld\n", fNodeID);
RequestCompleted(command->info);
return B_OK;
}

View File

@ -30,6 +30,7 @@
/* to comply with the license above, do not remove the following line */
char __dont_remove_copyright_from_binary[] = "Copyright (c) 2002-2006 Marcus Overhagen <Marcus@Overhagen.de>";
//#define DEBUG 7
#include <MediaRoster.h>
#include <Locker.h>
#include <Message.h>
@ -1204,7 +1205,7 @@ status_t
BMediaRoster::SetRunModeNode(const media_node & node,
BMediaNode::run_mode mode)
{
CALLED();
TRACE("BMediaRoster::SetRunModeNode, node %ld, mode %d\n", node.node, mode);
if (IS_INVALID_NODE(node))
return B_MEDIA_BAD_NODE;
@ -1243,7 +1244,7 @@ BMediaRoster::SetProducerRunModeDelay(const media_node & node,
bigtime_t delay,
BMediaNode::run_mode mode)
{
CALLED();
TRACE("BMediaRoster::SetProducerRunModeDelay, node %ld, delay %Ld, mode %d\n", node.node, delay, mode);
if (IS_INVALID_NODE(node))
return B_MEDIA_BAD_NODE;
if ((node.kind & B_BUFFER_PRODUCER) == 0)

View File

@ -477,6 +477,8 @@ BTimeSource::AddMe(BMediaNode *node)
cmd.node = node->Node();
SendToPort(fControlPort, TIMESOURCE_ADD_SLAVE_NODE, &cmd, sizeof(cmd));
} else {
if (this == dynamic_cast<BTimeSource *>(node))
debugger("fuck you!");
DirectAddMe(node->Node());
}
return B_OK;