Debugger (and some friends): 64 bit fixes

This commit is contained in:
Ingo Weinhold
2012-08-05 23:58:25 +02:00
parent aed3510485
commit 7483c98dec
37 changed files with 313 additions and 277 deletions
@@ -1,5 +1,5 @@
/* /*
* Copyright 2009, Ingo Weinhold, [email protected]. * Copyright 2009-2012, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -144,7 +144,7 @@ BField*
Int32TableColumn::PrepareField(const BVariant& value) const Int32TableColumn::PrepareField(const BVariant& value) const
{ {
char buffer[16]; char buffer[16];
snprintf(buffer, sizeof(buffer), "%ld", value.ToInt32()); snprintf(buffer, sizeof(buffer), "%" B_PRId32, value.ToInt32());
return StringTableColumn::PrepareField( return StringTableColumn::PrepareField(
BVariant(buffer, B_VARIANT_DONT_COPY_DATA)); BVariant(buffer, B_VARIANT_DONT_COPY_DATA));
} }
@@ -174,7 +174,7 @@ BField*
Int64TableColumn::PrepareField(const BVariant& value) const Int64TableColumn::PrepareField(const BVariant& value) const
{ {
char buffer[32]; char buffer[32];
snprintf(buffer, sizeof(buffer), "%lld", value.ToInt64()); snprintf(buffer, sizeof(buffer), "%" B_PRId64, value.ToInt64());
return StringTableColumn::PrepareField( return StringTableColumn::PrepareField(
BVariant(buffer, B_VARIANT_DONT_COPY_DATA)); BVariant(buffer, B_VARIANT_DONT_COPY_DATA));
} }
+7 -5
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2009, Ingo Weinhold, [email protected]. * Copyright 2009-2012, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef TIME_UTILS_H #ifndef TIME_UTILS_H
@@ -65,8 +65,9 @@ format_bigtime(bigtime_t time, char* buffer, size_t bufferSize)
decomposed_bigtime decomposed; decomposed_bigtime decomposed;
decompose_time(time, decomposed); decompose_time(time, decomposed);
snprintf(buffer, bufferSize, "%02lld:%02d:%02d:%06d", decomposed.hours, snprintf(buffer, bufferSize, "%02" B_PRId64 ":%02d:%02d:%06d",
decomposed.minutes, decomposed.seconds, decomposed.micros); decomposed.hours, decomposed.minutes, decomposed.seconds,
decomposed.micros);
return buffer; return buffer;
} }
@@ -86,8 +87,9 @@ format_nanotime(nanotime_t time, char* buffer, size_t bufferSize)
decomposed_nanotime decomposed; decomposed_nanotime decomposed;
decompose_time(time, decomposed); decompose_time(time, decomposed);
snprintf(buffer, bufferSize, "%02lld:%02d:%02d:%09d", decomposed.hours, snprintf(buffer, bufferSize, "%02" B_PRId64 ":%02d:%02d:%09d",
decomposed.minutes, decomposed.seconds, decomposed.nanos); decomposed.hours, decomposed.minutes, decomposed.seconds,
decomposed.nanos);
return buffer; return buffer;
} }
+3 -3
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2009, Ingo Weinhold, [email protected]. * Copyright 2009-2012, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -499,7 +499,7 @@ BreakpointManager::_UpdateBreakpointInstallation(Breakpoint* breakpoint)
if (error != B_OK) if (error != B_OK)
return error; return error;
TRACE_CONTROL("BREAKPOINT at %#llx installed: %s\n", TRACE_CONTROL("BREAKPOINT at %#" B_PRIx64 " installed: %s\n",
breakpoint->Address(), strerror(error)); breakpoint->Address(), strerror(error));
breakpoint->SetInstalled(true); breakpoint->SetInstalled(true);
@@ -507,7 +507,7 @@ BreakpointManager::_UpdateBreakpointInstallation(Breakpoint* breakpoint)
// uninstall // uninstall
fDebuggerInterface->UninstallBreakpoint(breakpoint->Address()); fDebuggerInterface->UninstallBreakpoint(breakpoint->Address());
TRACE_CONTROL("BREAKPOINT at %#llx uninstalled\n", TRACE_CONTROL("BREAKPOINT at %#" B_PRIx64 " uninstalled\n",
breakpoint->Address()); breakpoint->Address());
breakpoint->SetInstalled(false); breakpoint->SetInstalled(false);
+10 -11
View File
@@ -240,14 +240,14 @@ get_debugged_program(const Options& options, DebuggedProgramInfo& _info)
status_t error = get_thread_info(thread, &threadInfo); status_t error = get_thread_info(thread, &threadInfo);
if (error != B_OK) { if (error != B_OK) {
// TODO: Notify the user! // TODO: Notify the user!
fprintf(stderr, "Error: Failed to get info for thread \"%ld\": " fprintf(stderr, "Error: Failed to get info for thread \"%" B_PRId32
"%s\n", thread, strerror(error)); "\": %s\n", thread, strerror(error));
return false; return false;
} }
team = threadInfo.team; team = threadInfo.team;
} }
printf("team: %ld, thread: %ld\n", team, thread); printf("team: %" B_PRId32 ", thread: %" B_PRId32 "\n", team, thread);
_info.team = team; _info.team = team;
_info.thread = thread; _info.thread = thread;
@@ -289,13 +289,13 @@ start_team_debugger(team_id teamID, SettingsManager* settingsManager,
error = debugger->Init(teamID, threadID, stopInMain); error = debugger->Init(teamID, threadID, stopInMain);
if (error != B_OK) { if (error != B_OK) {
printf("Error: debugger for team %ld failed to init: %s!\n", printf("Error: debugger for team %" B_PRId32 " failed to init: %s!\n",
teamID, strerror(error)); teamID, strerror(error));
delete debugger; delete debugger;
return NULL; return NULL;
} else } else
printf("debugger for team %ld created and initialized successfully!\n", printf("debugger for team %" B_PRId32 " created and initialized "
teamID); "successfully!\n", teamID);
return debugger; return debugger;
} }
@@ -458,7 +458,8 @@ Debugger::ArgvReceived(int32 argc, char** argv)
TeamDebugger* debugger = _FindTeamDebugger(programInfo.team); TeamDebugger* debugger = _FindTeamDebugger(programInfo.team);
if (debugger != NULL) { if (debugger != NULL) {
printf("There's already a debugger for team: %ld\n", programInfo.team); printf("There's already a debugger for team: %" B_PRId32 "\n",
programInfo.team);
debugger->Activate(); debugger->Activate();
return; return;
} }
@@ -471,8 +472,7 @@ Debugger::ArgvReceived(int32 argc, char** argv)
void void
Debugger::TeamDebuggerStarted(TeamDebugger* debugger) Debugger::TeamDebuggerStarted(TeamDebugger* debugger)
{ {
printf("debugger for team %ld started...\n", printf("debugger for team %" B_PRId32 " started...\n", debugger->TeamID());
debugger->TeamID());
// Note: see TeamDebuggerQuit() note about locking // Note: see TeamDebuggerQuit() note about locking
AutoLocker<Debugger> locker(this); AutoLocker<Debugger> locker(this);
@@ -489,8 +489,7 @@ Debugger::TeamDebuggerQuit(TeamDebugger* debugger)
// way around. If we even need to do that, we'll have to introduce a // way around. If we even need to do that, we'll have to introduce a
// separate lock to protect the list. // separate lock to protect the list.
printf("debugger for team %ld quit.\n", printf("debugger for team %" B_PRId32 " quit.\n", debugger->TeamID());
debugger->TeamID());
AutoLocker<Debugger> locker(this); AutoLocker<Debugger> locker(this);
fTeamDebuggers.RemoveItem(debugger); fTeamDebuggers.RemoveItem(debugger);
+46 -43
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2009, Ingo Weinhold, [email protected]. * Copyright 2009-2012, Ingo Weinhold, [email protected].
* Copyright 2010-2011, Rene Gollent, [email protected]. * Copyright 2010-2011, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -363,7 +363,8 @@ TeamDebugger::Init(team_id teamID, thread_id threadID, bool stopInMain)
// create the debug event listener // create the debug event listener
char buffer[128]; char buffer[128];
snprintf(buffer, sizeof(buffer), "team %ld debug listener", fTeamID); snprintf(buffer, sizeof(buffer), "team %" B_PRId32 " debug listener",
fTeamID);
fDebugEventListener = spawn_thread(_DebugEventListenerEntry, buffer, fDebugEventListener = spawn_thread(_DebugEventListenerEntry, buffer,
B_NORMAL_PRIORITY, this); B_NORMAL_PRIORITY, this);
if (fDebugEventListener < 0) if (fDebugEventListener < 0)
@@ -842,8 +843,8 @@ TeamDebugger::_DebugEventListener()
// TODO: Error handling! // TODO: Error handling!
if (event->Team() != fTeamID) { if (event->Team() != fTeamID) {
TRACE_EVENTS("TeamDebugger for team %ld: received event from team " TRACE_EVENTS("TeamDebugger for team %" B_PRId32 ": received event "
"%ld!\n", fTeamID, event->Team()); "from team %" B_PRId32 "!\n", fTeamID, event->Team());
continue; continue;
} }
@@ -862,7 +863,7 @@ TeamDebugger::_DebugEventListener()
void void
TeamDebugger::_HandleDebuggerMessage(DebugEvent* event) TeamDebugger::_HandleDebuggerMessage(DebugEvent* event)
{ {
TRACE_EVENTS("TeamDebugger::_HandleDebuggerMessage(): %ld\n", TRACE_EVENTS("TeamDebugger::_HandleDebuggerMessage(): %" B_PRId32 "\n",
event->EventType()); event->EventType());
bool handled = false; bool handled = false;
@@ -872,8 +873,8 @@ TeamDebugger::_HandleDebuggerMessage(DebugEvent* event)
switch (event->EventType()) { switch (event->EventType()) {
case B_DEBUGGER_MESSAGE_THREAD_DEBUGGED: case B_DEBUGGER_MESSAGE_THREAD_DEBUGGED:
TRACE_EVENTS("B_DEBUGGER_MESSAGE_THREAD_DEBUGGED: thread: %ld\n", TRACE_EVENTS("B_DEBUGGER_MESSAGE_THREAD_DEBUGGED: thread: %"
event->Thread()); B_PRId32 "\n", event->Thread());
if (handler != NULL) { if (handler != NULL) {
handled = handler->HandleThreadDebugged( handled = handler->HandleThreadDebugged(
@@ -881,8 +882,8 @@ TeamDebugger::_HandleDebuggerMessage(DebugEvent* event)
} }
break; break;
case B_DEBUGGER_MESSAGE_DEBUGGER_CALL: case B_DEBUGGER_MESSAGE_DEBUGGER_CALL:
TRACE_EVENTS("B_DEBUGGER_MESSAGE_DEBUGGER_CALL: thread: %ld\n", TRACE_EVENTS("B_DEBUGGER_MESSAGE_DEBUGGER_CALL: thread: %" B_PRId32
event->Thread()); "\n", event->Thread());
if (handler != NULL) { if (handler != NULL) {
handled = handler->HandleDebuggerCall( handled = handler->HandleDebuggerCall(
@@ -890,8 +891,8 @@ TeamDebugger::_HandleDebuggerMessage(DebugEvent* event)
} }
break; break;
case B_DEBUGGER_MESSAGE_BREAKPOINT_HIT: case B_DEBUGGER_MESSAGE_BREAKPOINT_HIT:
TRACE_EVENTS("B_DEBUGGER_MESSAGE_BREAKPOINT_HIT: thread: %ld\n", TRACE_EVENTS("B_DEBUGGER_MESSAGE_BREAKPOINT_HIT: thread: %" B_PRId32
event->Thread()); "\n", event->Thread());
if (handler != NULL) { if (handler != NULL) {
handled = handler->HandleBreakpointHit( handled = handler->HandleBreakpointHit(
@@ -899,8 +900,8 @@ TeamDebugger::_HandleDebuggerMessage(DebugEvent* event)
} }
break; break;
case B_DEBUGGER_MESSAGE_WATCHPOINT_HIT: case B_DEBUGGER_MESSAGE_WATCHPOINT_HIT:
TRACE_EVENTS("B_DEBUGGER_MESSAGE_WATCHPOINT_HIT: thread: %ld\n", TRACE_EVENTS("B_DEBUGGER_MESSAGE_WATCHPOINT_HIT: thread: %" B_PRId32
event->Thread()); "\n", event->Thread());
if (handler != NULL) { if (handler != NULL) {
handled = handler->HandleWatchpointHit( handled = handler->HandleWatchpointHit(
@@ -908,8 +909,8 @@ TeamDebugger::_HandleDebuggerMessage(DebugEvent* event)
} }
break; break;
case B_DEBUGGER_MESSAGE_SINGLE_STEP: case B_DEBUGGER_MESSAGE_SINGLE_STEP:
TRACE_EVENTS("B_DEBUGGER_MESSAGE_SINGLE_STEP: thread: %ld\n", TRACE_EVENTS("B_DEBUGGER_MESSAGE_SINGLE_STEP: thread: %" B_PRId32
event->Thread()); "\n", event->Thread());
if (handler != NULL) { if (handler != NULL) {
handled = handler->HandleSingleStep( handled = handler->HandleSingleStep(
@@ -917,8 +918,8 @@ TeamDebugger::_HandleDebuggerMessage(DebugEvent* event)
} }
break; break;
case B_DEBUGGER_MESSAGE_EXCEPTION_OCCURRED: case B_DEBUGGER_MESSAGE_EXCEPTION_OCCURRED:
TRACE_EVENTS("B_DEBUGGER_MESSAGE_EXCEPTION_OCCURRED: thread: %ld\n", TRACE_EVENTS("B_DEBUGGER_MESSAGE_EXCEPTION_OCCURRED: thread: %"
event->Thread()); B_PRId32 "\n", event->Thread());
if (handler != NULL) { if (handler != NULL) {
handled = handler->HandleExceptionOccurred( handled = handler->HandleExceptionOccurred(
@@ -930,11 +931,11 @@ TeamDebugger::_HandleDebuggerMessage(DebugEvent* event)
// break; // break;
case B_DEBUGGER_MESSAGE_TEAM_DELETED: case B_DEBUGGER_MESSAGE_TEAM_DELETED:
// TODO: Handle! // TODO: Handle!
TRACE_EVENTS("B_DEBUGGER_MESSAGE_TEAM_DELETED: team: %ld\n", TRACE_EVENTS("B_DEBUGGER_MESSAGE_TEAM_DELETED: team: %" B_PRId32
event->Team()); "\n", event->Team());
break; break;
case B_DEBUGGER_MESSAGE_TEAM_EXEC: case B_DEBUGGER_MESSAGE_TEAM_EXEC:
TRACE_EVENTS("B_DEBUGGER_MESSAGE_TEAM_EXEC: team: %ld\n", TRACE_EVENTS("B_DEBUGGER_MESSAGE_TEAM_EXEC: team: %" B_PRId32 "\n",
event->Team()); event->Team());
// TODO: Handle! // TODO: Handle!
break; break;
@@ -942,8 +943,8 @@ TeamDebugger::_HandleDebuggerMessage(DebugEvent* event)
{ {
ThreadCreatedEvent* threadEvent ThreadCreatedEvent* threadEvent
= dynamic_cast<ThreadCreatedEvent*>(event); = dynamic_cast<ThreadCreatedEvent*>(event);
TRACE_EVENTS("B_DEBUGGER_MESSAGE_THREAD_CREATED: thread: %ld\n", TRACE_EVENTS("B_DEBUGGER_MESSAGE_THREAD_CREATED: thread: %" B_PRId32
threadEvent->NewThread()); "\n", threadEvent->NewThread());
handled = _HandleThreadCreated(threadEvent); handled = _HandleThreadCreated(threadEvent);
break; break;
} }
@@ -951,8 +952,8 @@ TeamDebugger::_HandleDebuggerMessage(DebugEvent* event)
{ {
ThreadRenamedEvent* threadEvent ThreadRenamedEvent* threadEvent
= dynamic_cast<ThreadRenamedEvent*>(event); = dynamic_cast<ThreadRenamedEvent*>(event);
TRACE_EVENTS("DEBUGGER_MESSAGE_THREAD_RENAMED: thread: %ld " TRACE_EVENTS("DEBUGGER_MESSAGE_THREAD_RENAMED: thread: %" B_PRId32
"(\"%s\")\n", " (\"%s\")\n",
threadEvent->RenamedThread(), threadEvent->NewName()); threadEvent->RenamedThread(), threadEvent->NewName());
handled = _HandleThreadRenamed(threadEvent); handled = _HandleThreadRenamed(threadEvent);
break; break;
@@ -962,13 +963,13 @@ TeamDebugger::_HandleDebuggerMessage(DebugEvent* event)
ThreadPriorityChangedEvent* threadEvent ThreadPriorityChangedEvent* threadEvent
= dynamic_cast<ThreadPriorityChangedEvent*>(event); = dynamic_cast<ThreadPriorityChangedEvent*>(event);
TRACE_EVENTS("B_DEBUGGER_MESSAGE_THREAD_PRIORITY_CHANGED: thread:" TRACE_EVENTS("B_DEBUGGER_MESSAGE_THREAD_PRIORITY_CHANGED: thread:"
" %ld\n", threadEvent->ChangedThread()); " %" B_PRId32 "\n", threadEvent->ChangedThread());
handled = _HandleThreadPriorityChanged(threadEvent); handled = _HandleThreadPriorityChanged(threadEvent);
break; break;
} }
case B_DEBUGGER_MESSAGE_THREAD_DELETED: case B_DEBUGGER_MESSAGE_THREAD_DELETED:
TRACE_EVENTS("B_DEBUGGER_MESSAGE_THREAD_DELETED: thread: %ld\n", TRACE_EVENTS("B_DEBUGGER_MESSAGE_THREAD_DELETED: thread: %" B_PRId32
event->Thread()); "\n", event->Thread());
handled = _HandleThreadDeleted( handled = _HandleThreadDeleted(
dynamic_cast<ThreadDeletedEvent*>(event)); dynamic_cast<ThreadDeletedEvent*>(event));
break; break;
@@ -977,7 +978,7 @@ TeamDebugger::_HandleDebuggerMessage(DebugEvent* event)
ImageCreatedEvent* imageEvent ImageCreatedEvent* imageEvent
= dynamic_cast<ImageCreatedEvent*>(event); = dynamic_cast<ImageCreatedEvent*>(event);
TRACE_EVENTS("B_DEBUGGER_MESSAGE_IMAGE_CREATED: image: \"%s\" " TRACE_EVENTS("B_DEBUGGER_MESSAGE_IMAGE_CREATED: image: \"%s\" "
"(%ld)\n", imageEvent->GetImageInfo().Name().String(), "(%" B_PRId32 ")\n", imageEvent->GetImageInfo().Name().String(),
imageEvent->GetImageInfo().ImageID()); imageEvent->GetImageInfo().ImageID());
handled = _HandleImageCreated(imageEvent); handled = _HandleImageCreated(imageEvent);
break; break;
@@ -987,7 +988,7 @@ TeamDebugger::_HandleDebuggerMessage(DebugEvent* event)
ImageDeletedEvent* imageEvent ImageDeletedEvent* imageEvent
= dynamic_cast<ImageDeletedEvent*>(event); = dynamic_cast<ImageDeletedEvent*>(event);
TRACE_EVENTS("B_DEBUGGER_MESSAGE_IMAGE_DELETED: image: \"%s\" " TRACE_EVENTS("B_DEBUGGER_MESSAGE_IMAGE_DELETED: image: \"%s\" "
"(%ld)\n", imageEvent->GetImageInfo().Name().String(), "(%" B_PRId32 ")\n", imageEvent->GetImageInfo().Name().String(),
imageEvent->GetImageInfo().ImageID()); imageEvent->GetImageInfo().ImageID());
handled = _HandleImageDeleted(imageEvent); handled = _HandleImageDeleted(imageEvent);
break; break;
@@ -1000,8 +1001,8 @@ TeamDebugger::_HandleDebuggerMessage(DebugEvent* event)
// not interested // not interested
break; break;
default: default:
WARNING("TeamDebugger for team %ld: unknown event type: " WARNING("TeamDebugger for team %" B_PRId32 ": unknown event type: "
"%ld\n", fTeamID, event->EventType()); "%" B_PRId32 "\n", fTeamID, event->EventType());
break; break;
} }
@@ -1124,7 +1125,8 @@ TeamDebugger::_HandleImageDebugInfoChanged(image_id imageID)
void void
TeamDebugger::_HandleImageFileChanged(image_id imageID) TeamDebugger::_HandleImageFileChanged(image_id imageID)
{ {
TRACE_IMAGES("TeamDebugger::_HandleImageFileChanged(%ld)\n", imageID); TRACE_IMAGES("TeamDebugger::_HandleImageFileChanged(%" B_PRId32 ")\n",
imageID);
// TODO: Reload the debug info! // TODO: Reload the debug info!
} }
@@ -1132,8 +1134,8 @@ TeamDebugger::_HandleImageFileChanged(image_id imageID)
void void
TeamDebugger::_HandleSetUserBreakpoint(target_addr_t address, bool enabled) TeamDebugger::_HandleSetUserBreakpoint(target_addr_t address, bool enabled)
{ {
TRACE_CONTROL("TeamDebugger::_HandleSetUserBreakpoint(%#llx, %d)\n", TRACE_CONTROL("TeamDebugger::_HandleSetUserBreakpoint(%#" B_PRIx64
address, enabled); ", %d)\n", address, enabled);
// check whether there already is a breakpoint // check whether there already is a breakpoint
AutoLocker< ::Team> locker(fTeam); AutoLocker< ::Team> locker(fTeam);
@@ -1187,9 +1189,9 @@ TeamDebugger::_HandleSetUserBreakpoint(target_addr_t address, bool enabled)
target_addr_t relativeAddress = address - functionInstance->Address(); target_addr_t relativeAddress = address - functionInstance->Address();
TRACE_CONTROL(" relative address: %#llx, source location: " TRACE_CONTROL(" relative address: %#" B_PRIx64 ", source location: "
"(%ld, %ld)\n", relativeAddress, sourceLocation.Line(), "(%" B_PRId32 ", %" B_PRId32 ")\n", relativeAddress,
sourceLocation.Column()); sourceLocation.Line(), sourceLocation.Column());
// get function id // get function id
FunctionID* functionID = functionInstance->GetFunctionID(); FunctionID* functionID = functionInstance->GetFunctionID();
@@ -1212,8 +1214,8 @@ TeamDebugger::_HandleSetUserBreakpoint(target_addr_t address, bool enabled)
for (FunctionInstanceList::ConstIterator it for (FunctionInstanceList::ConstIterator it
= function->Instances().GetIterator(); = function->Instances().GetIterator();
FunctionInstance* instance = it.Next();) { FunctionInstance* instance = it.Next();) {
TRACE_CONTROL(" function instance %p: range: %#llx - %#llx\n", TRACE_CONTROL(" function instance %p: range: %#" B_PRIx64 " - %#"
instance, instance->Address(), B_PRIx64 "\n", instance, instance->Address(),
instance->Address() + instance->Size()); instance->Address() + instance->Size());
// get the breakpoint address for the instance // get the breakpoint address for the instance
@@ -1235,8 +1237,8 @@ TeamDebugger::_HandleSetUserBreakpoint(target_addr_t address, bool enabled)
} }
} }
TRACE_CONTROL(" breakpoint address using source info: %llx\n", TRACE_CONTROL(" breakpoint address using source info: %" B_PRIx64
instanceAddress); "\n", instanceAddress);
if (instanceAddress == 0) { if (instanceAddress == 0) {
// No source file (or we failed getting the statement), so try // No source file (or we failed getting the statement), so try
@@ -1246,7 +1248,7 @@ TeamDebugger::_HandleSetUserBreakpoint(target_addr_t address, bool enabled)
instanceAddress = instance->Address() + relativeAddress; instanceAddress = instance->Address() + relativeAddress;
} }
TRACE_CONTROL(" final breakpoint address: %llx\n", TRACE_CONTROL(" final breakpoint address: %" B_PRIx64 "\n",
instanceAddress); instanceAddress);
UserBreakpointInstance* breakpointInstance = new(std::nothrow) UserBreakpointInstance* breakpointInstance = new(std::nothrow)
@@ -1282,7 +1284,8 @@ TeamDebugger::_HandleSetUserBreakpoint(UserBreakpoint* breakpoint, bool enabled)
void void
TeamDebugger::_HandleClearUserBreakpoint(target_addr_t address) TeamDebugger::_HandleClearUserBreakpoint(target_addr_t address)
{ {
TRACE_CONTROL("TeamDebugger::_HandleClearUserBreakpoint(%#llx)\n", address); TRACE_CONTROL("TeamDebugger::_HandleClearUserBreakpoint(%#" B_PRIx64 ")\n",
address);
AutoLocker< ::Team> locker(fTeam); AutoLocker< ::Team> locker(fTeam);
+6 -6
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2010-2011, Rene Gollent, rene@gollent.com. * Copyright 2010-2011, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -117,7 +117,7 @@ ThreadHandler::HandleBreakpointHit(BreakpointHitEvent* event)
CpuState* cpuState = event->GetCpuState(); CpuState* cpuState = event->GetCpuState();
target_addr_t instructionPointer = cpuState->InstructionPointer(); target_addr_t instructionPointer = cpuState->InstructionPointer();
TRACE_EVENTS("ThreadHandler::HandleBreakpointHit(): ip: %llx\n", TRACE_EVENTS("ThreadHandler::HandleBreakpointHit(): ip: %" B_PRIx64 "\n",
instructionPointer); instructionPointer);
// check whether this is a temporary breakpoint we're waiting for // check whether this is a temporary breakpoint we're waiting for
@@ -265,7 +265,7 @@ ThreadHandler::HandleThreadAction(uint32 action)
StackFrame* frame = stackTrace->FrameAt(0); StackFrame* frame = stackTrace->FrameAt(0);
TRACE_CONTROL(" ip: %#llx\n", frame->InstructionPointer()); TRACE_CONTROL(" ip: %#" B_PRIx64 "\n", frame->InstructionPointer());
// When the thread is in a syscall, do the same for all step kinds: Stop it // When the thread is in a syscall, do the same for all step kinds: Stop it
// when it returns by means of a breakpoint. // when it returns by means of a breakpoint.
@@ -315,7 +315,7 @@ ThreadHandler::HandleThreadAction(uint32 action)
return; return;
} }
TRACE_CONTROL(" statement: %#llx - %#llx\n", TRACE_CONTROL(" statement: %#" B_PRIx64 " - %#" B_PRIx64 "\n",
fStepStatement->CoveringAddressRange().Start(), fStepStatement->CoveringAddressRange().Start(),
fStepStatement->CoveringAddressRange().End()); fStepStatement->CoveringAddressRange().End());
@@ -481,7 +481,7 @@ ThreadHandler::_DoStepOver(CpuState* cpuState)
} }
TRACE_CONTROL(" subroutine call -- installing breakpoint at address " TRACE_CONTROL(" subroutine call -- installing breakpoint at address "
"%#llx\n", info.Address() + info.Size()); "%#" B_PRIx64 "\n", info.Address() + info.Size());
if (_InstallTemporaryBreakpoint(info.Address() + info.Size()) != B_OK) if (_InstallTemporaryBreakpoint(info.Address() + info.Size()) != B_OK)
return false; return false;
@@ -633,7 +633,7 @@ ThreadHandler::_HandleBreakpointHitStep(CpuState* cpuState)
bool bool
ThreadHandler::_HandleSingleStepStep(CpuState* cpuState) ThreadHandler::_HandleSingleStepStep(CpuState* cpuState)
{ {
TRACE_CONTROL("ThreadHandler::_HandleSingleStepStep(): ip: %llx\n", TRACE_CONTROL("ThreadHandler::_HandleSingleStepStep(): ip: %" B_PRIx64 "\n",
cpuState->InstructionPointer()); cpuState->InstructionPointer());
switch (fStepMode) { switch (fStepMode) {
+3 -3
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef WORKER_H #ifndef WORKER_H
@@ -40,7 +40,7 @@ class JobKey {
public: public:
virtual ~JobKey(); virtual ~JobKey();
virtual uint32 HashValue() const = 0; virtual size_t HashValue() const = 0;
virtual bool operator==(const JobKey& other) const = 0; virtual bool operator==(const JobKey& other) const = 0;
}; };
@@ -54,7 +54,7 @@ public:
SimpleJobKey(void* object, uint32 type); SimpleJobKey(void* object, uint32 type);
SimpleJobKey(const SimpleJobKey& other); SimpleJobKey(const SimpleJobKey& other);
virtual uint32 HashValue() const; virtual size_t HashValue() const;
virtual bool operator==(const JobKey& other) const; virtual bool operator==(const JobKey& other) const;
@@ -1,5 +1,5 @@
/* /*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2011, Rene Gollent, rene@gollent.com. * Copyright 2011, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -250,11 +250,11 @@ status_t
ArchitectureX86::CreateCpuState(const void* cpuStateData, size_t size, ArchitectureX86::CreateCpuState(const void* cpuStateData, size_t size,
CpuState*& _state) CpuState*& _state)
{ {
if (size != sizeof(debug_cpu_state_x86)) if (size != sizeof(x86_debug_cpu_state))
return B_BAD_VALUE; return B_BAD_VALUE;
CpuStateX86* state = new(std::nothrow) CpuStateX86( CpuStateX86* state = new(std::nothrow) CpuStateX86(
*(const debug_cpu_state_x86*)cpuStateData); *(const x86_debug_cpu_state*)cpuStateData);
if (state == NULL) if (state == NULL)
return B_NO_MEMORY; return B_NO_MEMORY;
+2 -2
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2011, Rene Gollent, rene@gollent.com. * Copyright 2011, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -17,7 +17,7 @@ CpuStateX86::CpuStateX86()
} }
CpuStateX86::CpuStateX86(const debug_cpu_state_x86& state) CpuStateX86::CpuStateX86(const x86_debug_cpu_state& state)
: :
fSetRegisters(), fSetRegisters(),
fInterruptVector(0) fInterruptVector(0)
+2 -5
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2011, Rene Gollent, rene@gollent.com. * Copyright 2011, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -13,9 +13,6 @@
#include "CpuState.h" #include "CpuState.h"
typedef debug_cpu_state debug_cpu_state_x86;
// TODO: Should be defined by <debugger.h>!
enum { enum {
X86_REGISTER_EIP = 0, X86_REGISTER_EIP = 0,
X86_REGISTER_ESP, X86_REGISTER_ESP,
@@ -44,7 +41,7 @@ enum {
class CpuStateX86 : public CpuState { class CpuStateX86 : public CpuState {
public: public:
CpuStateX86(); CpuStateX86();
CpuStateX86(const debug_cpu_state_x86& state); CpuStateX86(const x86_debug_cpu_state& state);
virtual ~CpuStateX86(); virtual ~CpuStateX86();
virtual target_addr_t InstructionPointer() const; virtual target_addr_t InstructionPointer() const;
@@ -1,5 +1,5 @@
/* /*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2008, François Revol, revol@free.fr * Copyright 2008, François Revol, revol@free.fr
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -73,7 +73,7 @@ DisassemblerX86::GetNextInstruction(BString& line, target_addr_t& _address,
uint32 address = (uint32)ud_insn_off(fUdisData); uint32 address = (uint32)ud_insn_off(fUdisData);
char buffer[256]; char buffer[256];
snprintf(buffer, sizeof(buffer), "0x%08lx: %16.16s %s", address, snprintf(buffer, sizeof(buffer), "0x%08" B_PRIx32 ": %16.16s %s", address,
ud_insn_hex(fUdisData), ud_insn_asm(fUdisData)); ud_insn_hex(fUdisData), ud_insn_asm(fUdisData));
// TODO: Resolve symbols! // TODO: Resolve symbols!
@@ -1,5 +1,5 @@
/* /*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2012, Rene Gollent, rene@gollent.com. * Copyright 2012, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -290,7 +290,8 @@ status_t
DwarfImageDebugInfo::GetFunctions(BObjectList<FunctionDebugInfo>& functions) DwarfImageDebugInfo::GetFunctions(BObjectList<FunctionDebugInfo>& functions)
{ {
TRACE_IMAGES("DwarfImageDebugInfo::GetFunctions()\n"); TRACE_IMAGES("DwarfImageDebugInfo::GetFunctions()\n");
TRACE_IMAGES(" %ld compilation units\n", fFile->CountCompilationUnits()); TRACE_IMAGES(" %" B_PRId32 " compilation units\n",
fFile->CountCompilationUnits());
for (int32 i = 0; CompilationUnit* unit = fFile->CompilationUnitAt(i); for (int32 i = 0; CompilationUnit* unit = fFile->CompilationUnitAt(i);
i++) { i++) {
@@ -368,7 +369,7 @@ DwarfImageDebugInfo::GetFunctions(BObjectList<FunctionDebugInfo>& functions)
DwarfFunctionDebugInfo* function DwarfFunctionDebugInfo* function
= new(std::nothrow) DwarfFunctionDebugInfo(this, unit, = new(std::nothrow) DwarfFunctionDebugInfo(this, unit,
subprogramEntry, rangeList, name, file, subprogramEntry, rangeList, name, file,
SourceLocation(line, std::max(column, 0L))); SourceLocation(line, std::max(column, (int32)0)));
if (function == NULL || !functions.AddItem(function)) { if (function == NULL || !functions.AddItem(function)) {
delete function; delete function;
return B_NO_MEMORY; return B_NO_MEMORY;
@@ -568,9 +569,10 @@ DwarfImageDebugInfo::CreateFrame(Image* image,
for (int32 i = 0; i < registerCount; i++) { for (int32 i = 0; i < registerCount; i++) {
const Register* reg = registers + i; const Register* reg = registers + i;
BVariant value; BVariant value;
if (previousCpuState->GetRegisterValue(reg, value)) if (previousCpuState->GetRegisterValue(reg, value)) {
TRACE_CFI(" %3s: %#lx\n", reg->Name(), value.ToUInt32()); TRACE_CFI(" %3s: %#" B_PRIx32 "\n", reg->Name(),
else value.ToUInt32());
} else
TRACE_CFI(" %3s: undefined\n", reg->Name()); TRACE_CFI(" %3s: undefined\n", reg->Name());
} }
) )
@@ -649,8 +651,8 @@ status_t
DwarfImageDebugInfo::GetStatement(FunctionDebugInfo* _function, DwarfImageDebugInfo::GetStatement(FunctionDebugInfo* _function,
target_addr_t address, Statement*& _statement) target_addr_t address, Statement*& _statement)
{ {
TRACE_CODE("DwarfImageDebugInfo::GetStatement(function: %p, address: %#llx)\n", TRACE_CODE("DwarfImageDebugInfo::GetStatement(function: %p, address: %#"
_function, address); B_PRIx64 ")\n", _function, address);
DwarfFunctionDebugInfo* function DwarfFunctionDebugInfo* function
= dynamic_cast<DwarfFunctionDebugInfo*>(_function); = dynamic_cast<DwarfFunctionDebugInfo*>(_function);
@@ -719,7 +721,7 @@ DwarfImageDebugInfo::GetStatement(FunctionDebugInfo* _function,
if (state.isStatement) { if (state.isStatement) {
statementAddress = state.address; statementAddress = state.address;
statementLine = state.line - 1; statementLine = state.line - 1;
statementColumn = std::max(state.column - 1, 0L); statementColumn = std::max(state.column - 1, (int32)0);
} }
} }
@@ -741,8 +743,8 @@ DwarfImageDebugInfo::GetStatementAtSourceLocation(FunctionDebugInfo* _function,
target_addr_t functionEndAddress = functionStartAddress + function->Size(); target_addr_t functionEndAddress = functionStartAddress + function->Size();
TRACE_LINES2("DwarfImageDebugInfo::GetStatementAtSourceLocation(%p, " TRACE_LINES2("DwarfImageDebugInfo::GetStatementAtSourceLocation(%p, "
"(%ld, %ld)): function range: %#llx - %#llx\n", function, "(%" B_PRId32 ", %" B_PRId32 ")): function range: %#" B_PRIx64 " - %#"
sourceLocation.Line(), sourceLocation.Column(), B_PRIx64 "\n", function, sourceLocation.Line(), sourceLocation.Column(),
functionStartAddress, functionEndAddress); functionStartAddress, functionEndAddress);
AutoLocker<BLocker> locker(fLock); AutoLocker<BLocker> locker(fLock);
@@ -778,9 +780,10 @@ DwarfImageDebugInfo::GetStatementAtSourceLocation(FunctionDebugInfo* _function,
target_addr_t endAddress = state.address; target_addr_t endAddress = state.address;
if (statementAddress < endAddress) { if (statementAddress < endAddress) {
TRACE_LINES2(" statement: %#llx - %#llx, location: " TRACE_LINES2(" statement: %#" B_PRIx64 " - %#" B_PRIx64
"(%ld, %ld)\n", statementAddress, endAddress, statementLine, ", location: (%" B_PRId32 ", %" B_PRId32 ")\n",
statementColumn); statementAddress, endAddress, statementLine,
statementColumn);
} }
if (statementAddress < endAddress if (statementAddress < endAddress
@@ -812,7 +815,7 @@ DwarfImageDebugInfo::GetStatementAtSourceLocation(FunctionDebugInfo* _function,
if (state.isStatement) { if (state.isStatement) {
statementAddress = state.address; statementAddress = state.address;
statementLine = state.line - 1; statementLine = state.line - 1;
statementColumn = std::max(state.column - 1, 0L); statementColumn = std::max(state.column - 1, (int32)0);
} }
} }
@@ -902,8 +905,9 @@ DwarfImageDebugInfo::_AddSourceCodeInfo(CompilationUnit* unit,
int32 statementLine = -1; int32 statementLine = -1;
int32 statementColumn = -1; int32 statementColumn = -1;
while (program.GetNextRow(state)) { while (program.GetNextRow(state)) {
TRACE_LINES2(" %#llx (%ld, %ld, %ld) %d\n", state.address, TRACE_LINES2(" %#" B_PRIx64 " (%" B_PRId32 ", %" B_PRId32 ", %"
state.file, state.line, state.column, state.isStatement); B_PRId32 ") %d\n", state.address, state.file, state.line,
state.column, state.isStatement);
bool isOurFile = state.file == fileIndex; bool isOurFile = state.file == fileIndex;
@@ -917,9 +921,10 @@ DwarfImageDebugInfo::_AddSourceCodeInfo(CompilationUnit* unit,
if (error != B_OK) if (error != B_OK)
return error; return error;
TRACE_LINES2(" -> statement: %#llx - %#llx, source location: " TRACE_LINES2(" -> statement: %#" B_PRIx64 " - %#" B_PRIx64
"(%ld, %ld)\n", statementAddress, endAddress, statementLine, ", source location: (%" B_PRId32 ", %" B_PRId32 ")\n",
statementColumn); statementAddress, endAddress, statementLine,
statementColumn);
} }
statementAddress = 0; statementAddress = 0;
@@ -932,7 +937,7 @@ DwarfImageDebugInfo::_AddSourceCodeInfo(CompilationUnit* unit,
if (state.isStatement) { if (state.isStatement) {
statementAddress = state.address; statementAddress = state.address;
statementLine = state.line - 1; statementLine = state.line - 1;
statementColumn = std::max(state.column - 1, 0L); statementColumn = std::max(state.column - 1, (int32)0);
} }
} }
@@ -969,16 +974,16 @@ DwarfImageDebugInfo::_CreateLocalVariables(CompilationUnit* unit,
target_addr_t lowPC, const EntryListWrapper& variableEntries, target_addr_t lowPC, const EntryListWrapper& variableEntries,
const EntryListWrapper& blockEntries) const EntryListWrapper& blockEntries)
{ {
TRACE_LOCALS("DwarfImageDebugInfo::_CreateLocalVariables(): ip: %#llx, " TRACE_LOCALS("DwarfImageDebugInfo::_CreateLocalVariables(): ip: %#" B_PRIx64
"low PC: %#llx\n", instructionPointer, lowPC); ", low PC: %#" B_PRIx64 "\n", instructionPointer, lowPC);
// iterate through the variables and add the ones in scope // iterate through the variables and add the ones in scope
for (DebugInfoEntryList::ConstIterator it for (DebugInfoEntryList::ConstIterator it
= variableEntries.list.GetIterator(); = variableEntries.list.GetIterator();
DIEVariable* variableEntry = dynamic_cast<DIEVariable*>(it.Next());) { DIEVariable* variableEntry = dynamic_cast<DIEVariable*>(it.Next());) {
TRACE_LOCALS(" variableEntry %p, scope start: %llu\n", variableEntry, TRACE_LOCALS(" variableEntry %p, scope start: %" B_PRIu64 "\n",
variableEntry->StartScope()); variableEntry, variableEntry->StartScope());
// check the variable's scope // check the variable's scope
if (instructionPointer < lowPC + variableEntry->StartScope()) if (instructionPointer < lowPC + variableEntry->StartScope())
@@ -1,5 +1,5 @@
/* /*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -1304,7 +1304,8 @@ DwarfTypeFactory::_ResolveTypeByteSize(DIEType* typeEntry,
case DW_TAG_ptr_to_member_type: case DW_TAG_ptr_to_member_type:
_size = fTypeContext->GetCompilationUnit()->AddressSize(); _size = fTypeContext->GetCompilationUnit()->AddressSize();
TRACE_LOCALS(" pointer/reference type: size: %llu\n", _size); TRACE_LOCALS(" pointer/reference type: size: %" B_PRIu64 "\n",
_size);
return B_OK; return B_OK;
default: default:
@@ -1327,7 +1328,7 @@ DwarfTypeFactory::_ResolveTypeByteSize(DIEType* typeEntry,
_size = size.ToUInt64(); _size = size.ToUInt64();
TRACE_LOCALS(" -> size: %llu\n", _size); TRACE_LOCALS(" -> size: %" B_PRIu64 "\n", _size);
return B_OK; return B_OK;
} }
+8 -7
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -346,7 +346,8 @@ DwarfType::ResolveLocation(DwarfTypeContext* typeContext,
// TODO: Use bit size and bit offset, if specified! // TODO: Use bit size and bit offset, if specified!
_location.SetPieceAt(0, piece); _location.SetPieceAt(0, piece);
TRACE_LOCALS(" set single piece size to %llu\n", ByteSize()); TRACE_LOCALS(" set single piece size to %" B_PRIu64 "\n",
ByteSize());
} }
} }
@@ -670,8 +671,8 @@ DwarfCompoundType::ResolveDataMemberLocation(DataMember* _member,
bitSize = value.ToUInt64(); bitSize = value.ToUInt64();
} }
TRACE_LOCALS("bit field: byte size: %llu, bit offset/size: %llu/%llu\n", TRACE_LOCALS("bit field: byte size: %" B_PRIu64 ", bit offset/size: %"
byteSize, bitOffset, bitSize); B_PRIu64 "/%" B_PRIu64 "\n", byteSize, bitOffset, bitSize);
if (bitOffset + bitSize > byteSize * 8) if (bitOffset + bitSize > byteSize * 8)
return B_BAD_VALUE; return B_BAD_VALUE;
@@ -942,8 +943,8 @@ DwarfArrayType::ResolveElementLocation(const ArrayIndexPath& indexPath,
// doesn't have a stride and the previous dimension's element count is // doesn't have a stride and the previous dimension's element count is
// not known), we can only resolve the first element. // not known), we can only resolve the first element.
if (dimensionStride == 0 && index != 0) { if (dimensionStride == 0 && index != 0) {
WARNING("No dimension bit stride for dimension %ld and element " WARNING("No dimension bit stride for dimension %" B_PRId32 " and "
"index is not 0.\n", dimensionIndex); "element index is not 0.\n", dimensionIndex);
return B_BAD_VALUE; return B_BAD_VALUE;
} }
@@ -953,7 +954,7 @@ DwarfArrayType::ResolveElementLocation(const ArrayIndexPath& indexPath,
previousDimensionStride = dimensionStride; previousDimensionStride = dimensionStride;
} }
TRACE_LOCALS("total element bit offset: %lld\n", elementOffset); TRACE_LOCALS("total element bit offset: %" B_PRId64 "\n", elementOffset);
// create the value location object for the element // create the value location object for the element
ValueLocation* location = new(std::nothrow) ValueLocation( ValueLocation* location = new(std::nothrow) ValueLocation(
@@ -1,5 +1,5 @@
/* /*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2010, Rene Gollent, rene@gollent.com. * Copyright 2010, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -266,7 +266,7 @@ DebuggerInterface::Init()
// create debugger port // create debugger port
char buffer[128]; char buffer[128];
snprintf(buffer, sizeof(buffer), "team %ld debugger", fTeamID); snprintf(buffer, sizeof(buffer), "team %" B_PRId32 " debugger", fTeamID);
fDebuggerPort = create_port(100, buffer); fDebuggerPort = create_port(100, buffer);
if (fDebuggerPort < 0) if (fDebuggerPort < 0)
return fDebuggerPort; return fDebuggerPort;
@@ -719,8 +719,8 @@ DebuggerInterface::_CreateDebugEvent(int32 messageCode,
break; break;
} }
default: default:
printf("DebuggerInterface for team %ld: unknown message from " printf("DebuggerInterface for team %" B_PRId32 ": unknown message "
"kernel: %ld\n", fTeamID, messageCode); "from kernel: %" B_PRId32 "\n", fTeamID, messageCode);
// fall through... // fall through...
case B_DEBUGGER_MESSAGE_TEAM_CREATED: case B_DEBUGGER_MESSAGE_TEAM_CREATED:
case B_DEBUGGER_MESSAGE_PRE_SYSCALL: case B_DEBUGGER_MESSAGE_PRE_SYSCALL:
@@ -1,5 +1,5 @@
/* /*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -116,8 +116,10 @@ AbbreviationTable::_ParseAbbreviationEntry(DataReader& abbrevReader,
return B_NO_MEMORY; return B_NO_MEMORY;
fEntryTable.Insert(entry); fEntryTable.Insert(entry);
} else } else {
fprintf(stderr, "Duplicate abbreviation table entry %lu!\n", code); fprintf(stderr, "Duplicate abbreviation table entry %" B_PRIu32 "!\n",
code);
}
_nullEntry = false; _nullEntry = false;
return B_OK; return B_OK;
+6 -5
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -15,13 +15,14 @@ AttributeValue::ToString(char* buffer, size_t size)
{ {
switch (attributeClass) { switch (attributeClass) {
case ATTRIBUTE_CLASS_ADDRESS: case ATTRIBUTE_CLASS_ADDRESS:
snprintf(buffer, size, "%#llx", address); snprintf(buffer, size, "%#" B_PRIx64, address);
return buffer; return buffer;
case ATTRIBUTE_CLASS_BLOCK: case ATTRIBUTE_CLASS_BLOCK:
snprintf(buffer, size, "(%p, %#llx)", block.data, block.length); snprintf(buffer, size, "(%p, %#" B_PRIx64 ")", block.data,
block.length);
return buffer; return buffer;
case ATTRIBUTE_CLASS_CONSTANT: case ATTRIBUTE_CLASS_CONSTANT:
snprintf(buffer, size, "%#llx", constant); snprintf(buffer, size, "%#" B_PRIx64, constant);
return buffer; return buffer;
case ATTRIBUTE_CLASS_FLAG: case ATTRIBUTE_CLASS_FLAG:
snprintf(buffer, size, "%s", flag ? "true" : "false"); snprintf(buffer, size, "%s", flag ? "true" : "false");
@@ -30,7 +31,7 @@ AttributeValue::ToString(char* buffer, size_t size)
case ATTRIBUTE_CLASS_LOCLISTPTR: case ATTRIBUTE_CLASS_LOCLISTPTR:
case ATTRIBUTE_CLASS_MACPTR: case ATTRIBUTE_CLASS_MACPTR:
case ATTRIBUTE_CLASS_RANGELISTPTR: case ATTRIBUTE_CLASS_RANGELISTPTR:
snprintf(buffer, size, "%#llx", pointer); snprintf(buffer, size, "%#" B_PRIx64, pointer);
return buffer; return buffer;
case ATTRIBUTE_CLASS_REFERENCE: case ATTRIBUTE_CLASS_REFERENCE:
snprintf(buffer, size, "%p", reference); snprintf(buffer, size, "%p", reference);
+2 -2
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef DATA_READER_H #ifndef DATA_READER_H
@@ -100,7 +100,7 @@ public:
template<typename Type> template<typename Type>
Type Read(const Type& defaultValue) Type Read(const Type& defaultValue)
{ {
if (fSize < sizeof(Type)) { if (fSize < (off_t)sizeof(Type)) {
fOverflow = true; fOverflow = true;
fSize = 0; fSize = 0;
return defaultValue; return defaultValue;
@@ -1,5 +1,5 @@
/* /*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -267,7 +267,7 @@ status_t
DwarfExpressionEvaluator::_Evaluate(ValuePieceLocation* _piece) DwarfExpressionEvaluator::_Evaluate(ValuePieceLocation* _piece)
{ {
TRACE_EXPR_ONLY({ TRACE_EXPR_ONLY({
TRACE_EXPR("DwarfExpressionEvaluator::_Evaluate(%p, %lld)\n", TRACE_EXPR("DwarfExpressionEvaluator::_Evaluate(%p, %" B_PRIdOFF ")\n",
fDataReader.Data(), fDataReader.BytesRemaining()); fDataReader.Data(), fDataReader.BytesRemaining());
const uint8* data = (const uint8*)fDataReader.Data(); const uint8* data = (const uint8*)fDataReader.Data();
int32 count = fDataReader.BytesRemaining(); int32 count = fDataReader.BytesRemaining();
@@ -557,7 +557,7 @@ DwarfExpressionEvaluator::_Evaluate(ValuePieceLocation* _piece)
case DW_OP_fbreg: case DW_OP_fbreg:
{ {
int64 offset = fDataReader.ReadSignedLEB128(0); int64 offset = fDataReader.ReadSignedLEB128(0);
TRACE_EXPR(" DW_OP_fbreg(%lld)\n", offset); TRACE_EXPR(" DW_OP_fbreg(%" B_PRId64 ")\n", offset);
target_addr_t address; target_addr_t address;
if (!fContext->GetFrameBaseAddress(address)) { if (!fContext->GetFrameBaseAddress(address)) {
throw EvaluationException( throw EvaluationException(
@@ -644,8 +644,8 @@ DwarfExpressionEvaluator::_Evaluate(ValuePieceLocation* _piece)
} }
} else if (opcode >= DW_OP_breg0 && opcode <= DW_OP_breg31) { } else if (opcode >= DW_OP_breg0 && opcode <= DW_OP_breg31) {
int64 offset = fDataReader.ReadSignedLEB128(0); int64 offset = fDataReader.ReadSignedLEB128(0);
TRACE_EXPR(" DW_OP_breg%u(%lld)\n", opcode - DW_OP_breg0, TRACE_EXPR(" DW_OP_breg%u(%" B_PRId64 ")\n",
offset); opcode - DW_OP_breg0, offset);
_PushRegister(opcode - DW_OP_breg0, offset); _PushRegister(opcode - DW_OP_breg0, offset);
} else { } else {
WARNING("DwarfExpressionEvaluator::_Evaluate(): " WARNING("DwarfExpressionEvaluator::_Evaluate(): "
+100 -80
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2009-2010, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2012, Rene Gollent, rene@gollent.com. * Copyright 2012, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -134,7 +134,7 @@ public:
if (error != B_OK) if (error != B_OK)
return false; return false;
TRACE_EXPR(" -> frame base: %llx\n", fFrameBasePointer); TRACE_EXPR(" -> frame base: %" B_PRIx64 "\n", fFrameBasePointer);
_address = fFrameBasePointer; _address = fFrameBasePointer;
return true; return true;
@@ -420,9 +420,9 @@ DwarfFile::Load(const char* fileName)
break; break;
} }
TRACE_DIE("DWARF%d compilation unit: version %d, length: %lld, " TRACE_DIE("DWARF%d compilation unit: version %d, length: %" B_PRIu64
"abbrevOffset: %lld, address size: %d\n", dwarf64 ? 64 : 32, ", abbrevOffset: %" B_PRIdOFF ", address size: %d\n",
version, unitLength, abbrevOffset, addressSize); dwarf64 ? 64 : 32, version, unitLength, abbrevOffset, addressSize);
if (version != 2 && version != 3) { if (version != 2 && version != 3) {
WARNING("\"%s\": Unsupported compilation unit version: %d\n", WARNING("\"%s\": Unsupported compilation unit version: %d\n",
@@ -818,7 +818,7 @@ DwarfFile::_ParseCompilationUnit(CompilationUnit* unit)
unit->SetUnitEntry(unitEntry); unit->SetUnitEntry(unitEntry);
TRACE_DIE_ONLY( TRACE_DIE_ONLY(
TRACE_DIE("remaining bytes in unit: %lld\n", TRACE_DIE("remaining bytes in unit: %" B_PRIdOFF "\n",
dataReader.BytesRemaining()); dataReader.BytesRemaining());
if (dataReader.HasData()) { if (dataReader.HasData()) {
TRACE_DIE(" "); TRACE_DIE(" ");
@@ -853,7 +853,7 @@ DwarfFile::_ParseDebugInfoEntry(DataReader& dataReader,
// get the corresponding abbreviation entry // get the corresponding abbreviation entry
AbbreviationEntry abbreviationEntry; AbbreviationEntry abbreviationEntry;
if (!abbreviationTable->GetAbbreviationEntry(code, abbreviationEntry)) { if (!abbreviationTable->GetAbbreviationEntry(code, abbreviationEntry)) {
WARNING("No abbreviation entry for code %lu\n", code); WARNING("No abbreviation entry for code %" B_PRIu32 "\n", code);
return B_BAD_DATA; return B_BAD_DATA;
} }
@@ -861,17 +861,17 @@ DwarfFile::_ParseDebugInfoEntry(DataReader& dataReader,
status_t error = fDebugInfoFactory.CreateDebugInfoEntry( status_t error = fDebugInfoFactory.CreateDebugInfoEntry(
abbreviationEntry.Tag(), entry); abbreviationEntry.Tag(), entry);
if (error != B_OK) { if (error != B_OK) {
WARNING("Failed to generate entry for tag %lu, code %lu\n", WARNING("Failed to generate entry for tag %" B_PRIu32 ", code %"
abbreviationEntry.Tag(), code); B_PRIu32 "\n", abbreviationEntry.Tag(), code);
return error; return error;
} }
ObjectDeleter<DebugInfoEntry> entryDeleter(entry); ObjectDeleter<DebugInfoEntry> entryDeleter(entry);
TRACE_DIE("%*sentry %p at %lld: %lu, tag: %s (%lu), children: %d\n", TRACE_DIE("%*sentry %p at %" B_PRIdOFF ": %" B_PRIu32 ", tag: %s (%"
level * 2, "", entry, entryOffset, abbreviationEntry.Code(), B_PRIu32 "), children: %d\n", level * 2, "", entry, entryOffset,
get_entry_tag_name(abbreviationEntry.Tag()), abbreviationEntry.Tag(), abbreviationEntry.Code(), get_entry_tag_name(abbreviationEntry.Tag()),
abbreviationEntry.HasChildren()); abbreviationEntry.Tag(), abbreviationEntry.HasChildren());
error = fCurrentCompilationUnit->AddDebugInfoEntry(entry, entryOffset); error = fCurrentCompilationUnit->AddDebugInfoEntry(entry, entryOffset);
if (error != B_OK) if (error != B_OK)
@@ -943,7 +943,7 @@ DwarfFile::_FinishCompilationUnit(CompilationUnit* unit)
off_t offset; off_t offset;
unit->GetEntryAt(i, entry, offset); unit->GetEntryAt(i, entry, offset);
TRACE_DIE("entry %p at %lld\n", entry, offset); TRACE_DIE("entry %p at %" B_PRIdOFF "\n", entry, offset);
// seek the reader to the entry // seek the reader to the entry
dataReader.SeekAbsolute(offset); dataReader.SeekAbsolute(offset);
@@ -1069,7 +1069,8 @@ DwarfFile::_ParseEntryAttributes(DataReader& dataReader,
? (off_t)dataReader.Read<uint64>(0) ? (off_t)dataReader.Read<uint64>(0)
: (off_t)dataReader.Read<uint32>(0); : (off_t)dataReader.Read<uint32>(0);
if (offset >= fDebugStringSection->Size()) { if (offset >= fDebugStringSection->Size()) {
WARNING("Invalid DW_FORM_strp offset: %lld\n", offset); WARNING("Invalid DW_FORM_strp offset: %" B_PRIdOFF "\n",
offset);
return B_BAD_DATA; return B_BAD_DATA;
} }
attributeValue.SetToString( attributeValue.SetToString(
@@ -1106,7 +1107,8 @@ DwarfFile::_ParseEntryAttributes(DataReader& dataReader,
break; break;
case DW_FORM_indirect: case DW_FORM_indirect:
default: default:
WARNING("Unsupported attribute form: %lu\n", attributeForm); WARNING("Unsupported attribute form: %" B_PRIu32 "\n",
attributeForm);
return B_BAD_DATA; return B_BAD_DATA;
} }
@@ -1115,10 +1117,10 @@ DwarfFile::_ParseEntryAttributes(DataReader& dataReader,
uint8 attributeClass = get_attribute_class(attributeName, uint8 attributeClass = get_attribute_class(attributeName,
attributeForm); attributeForm);
if (attributeClass == ATTRIBUTE_CLASS_UNKNOWN) { if (attributeClass == ATTRIBUTE_CLASS_UNKNOWN) {
TRACE_DIE("skipping attribute with unrecognized class: %s (%#lx) " TRACE_DIE("skipping attribute with unrecognized class: %s (%#"
"%s (%#lx)\n", get_attribute_name_name(attributeName), B_PRIx32 ") %s (%#" B_PRIx32 ")\n",
attributeName, get_attribute_form_name(attributeForm), get_attribute_name_name(attributeName), attributeName,
attributeForm); get_attribute_form_name(attributeForm), attributeForm);
continue; continue;
} }
// attributeValue.attributeClass = attributeClass; // attributeValue.attributeClass = attributeClass;
@@ -1158,8 +1160,8 @@ DwarfFile::_ParseEntryAttributes(DataReader& dataReader,
if (attributeName == DW_AT_sibling) if (attributeName == DW_AT_sibling)
continue; continue;
WARNING("Failed to resolve reference: %s (%#lx) " WARNING("Failed to resolve reference: %s (%#" B_PRIx32
"%s (%#lx): value: %llu\n", ") %s (%#" B_PRIx32 "): value: %" B_PRIu64 "\n",
get_attribute_name_name(attributeName), get_attribute_name_name(attributeName),
attributeName, attributeName,
get_attribute_form_name(attributeForm), get_attribute_form_name(attributeForm),
@@ -1220,7 +1222,8 @@ DwarfFile::_ParseLineInfo(CompilationUnit* unit)
{ {
off_t offset = unit->UnitEntry()->StatementListOffset(); off_t offset = unit->UnitEntry()->StatementListOffset();
TRACE_LINES("DwarfFile::_ParseLineInfo(%p), offset: %lld\n", unit, offset); TRACE_LINES("DwarfFile::_ParseLineInfo(%p), offset: %" B_PRIdOFF "\n", unit,
offset);
DataReader dataReader((uint8*)fDebugLineSection->Data() + offset, DataReader dataReader((uint8*)fDebugLineSection->Data() + offset,
fDebugLineSection->Size() - offset, unit->AddressSize()); fDebugLineSection->Size() - offset, unit->AddressSize());
@@ -1268,9 +1271,9 @@ DwarfFile::_ParseLineInfo(CompilationUnit* unit)
if (version != 2 && version != 3) if (version != 2 && version != 3)
return B_UNSUPPORTED; return B_UNSUPPORTED;
TRACE_LINES(" unitLength: %llu\n", unitLength); TRACE_LINES(" unitLength: %" B_PRIu64 "\n", unitLength);
TRACE_LINES(" version: %u\n", version); TRACE_LINES(" version: %u\n", version);
TRACE_LINES(" headerLength: %llu\n", headerLength); TRACE_LINES(" headerLength: %" B_PRIu64 "\n", headerLength);
TRACE_LINES(" minInstructionLength: %u\n", minInstructionLength); TRACE_LINES(" minInstructionLength: %u\n", minInstructionLength);
TRACE_LINES(" defaultIsStatement: %d\n", defaultIsStatement); TRACE_LINES(" defaultIsStatement: %d\n", defaultIsStatement);
TRACE_LINES(" lineBase: %d\n", lineBase); TRACE_LINES(" lineBase: %d\n", lineBase);
@@ -1302,8 +1305,9 @@ DwarfFile::_ParseLineInfo(CompilationUnit* unit)
if (dataReader.HasOverflow()) if (dataReader.HasOverflow())
return B_BAD_DATA; return B_BAD_DATA;
TRACE_LINES(" \"%s\", dir index: %llu, mtime: %llu, length: %llu\n", TRACE_LINES(" \"%s\", dir index: %" B_PRIu64 ", mtime: %" B_PRIu64
file, dirIndex, modificationTime, fileLength); ", length: %" B_PRIu64 "\n", file, dirIndex, modificationTime,
fileLength);
if (!unit->AddFile(file, dirIndex)) if (!unit->AddFile(file, dirIndex))
return B_NO_MEMORY; return B_NO_MEMORY;
@@ -1343,7 +1347,7 @@ DwarfFile::_UnwindCallFrame(bool usingEHFrameSection, CompilationUnit* unit,
// the ones generated by GCC 4 aren't. // the ones generated by GCC 4 aren't.
} }
TRACE_CFI("DwarfFile::_UnwindCallFrame(%#llx)\n", location); TRACE_CFI("DwarfFile::_UnwindCallFrame(%#" B_PRIx64 ")\n", location);
DataReader dataReader((uint8*)currentFrameSection->Data(), DataReader dataReader((uint8*)currentFrameSection->Data(),
currentFrameSection->Size(), unit->AddressSize()); currentFrameSection->Size(), unit->AddressSize());
@@ -1426,8 +1430,9 @@ DwarfFile::_UnwindCallFrame(bool usingEHFrameSection, CompilationUnit* unit,
cieID = lengthOffset - cieID; cieID = lengthOffset - cieID;
} }
TRACE_CFI(" found fde: length: %llu (%lld), CIE offset: %#llx, " TRACE_CFI(" found fde: length: %" B_PRIu64 " (%" B_PRIdOFF
"location: %#llx, range: %#llx\n", length, remaining, cieID, "), CIE offset: %#" B_PRIx64 ", location: %#" B_PRIx64 ", "
"range: %#" B_PRIx64 "\n", length, remaining, cieID,
initialLocation, addressRange); initialLocation, addressRange);
CfaContext context(location, initialLocation); CfaContext context(location, initialLocation);
@@ -1505,11 +1510,11 @@ DwarfFile::_UnwindCallFrame(bool usingEHFrameSection, CompilationUnit* unit,
return B_BAD_VALUE; return B_BAD_VALUE;
} }
TRACE_CFI(" frame address: %#llx\n", frameAddress); TRACE_CFI(" frame address: %#" B_PRIx64 "\n", frameAddress);
// apply the register rules // apply the register rules
for (uint32 i = 0; i < registerCount; i++) { for (uint32 i = 0; i < registerCount; i++) {
TRACE_CFI(" reg %lu\n", i); TRACE_CFI(" reg %" B_PRIu32 "\n", i);
uint32 valueType = outputInterface->RegisterValueType(i); uint32 valueType = outputInterface->RegisterValueType(i);
if (valueType == 0) if (valueType == 0)
@@ -1532,8 +1537,8 @@ DwarfFile::_UnwindCallFrame(bool usingEHFrameSection, CompilationUnit* unit,
} }
case CFA_RULE_LOCATION_OFFSET: case CFA_RULE_LOCATION_OFFSET:
{ {
TRACE_CFI(" -> CFA_RULE_LOCATION_OFFSET: %lld\n", TRACE_CFI(" -> CFA_RULE_LOCATION_OFFSET: %"
rule->Offset()); B_PRId64 "\n", rule->Offset());
BVariant value; BVariant value;
if (inputInterface->ReadValueFromMemory( if (inputInterface->ReadValueFromMemory(
@@ -1642,8 +1647,8 @@ DwarfFile::_ParseCIE(ElfSection* debugFrameSection, bool usingEHFrameSection,
uint8 version = dataReader.Read<uint8>(0); uint8 version = dataReader.Read<uint8>(0);
if (version != 1) { if (version != 1) {
TRACE_CFI(" cie: length: %llu, offset: %#llx, version: %u " TRACE_CFI(" cie: length: %" B_PRIu64 ", offset: %#" B_PRIx64 ", "
"-- unsupported\n", length, cieOffset, version); "version: %u -- unsupported\n", length, (uint64)cieOffset, version);
return B_UNSUPPORTED; return B_UNSUPPORTED;
} }
@@ -1660,16 +1665,18 @@ DwarfFile::_ParseCIE(ElfSection* debugFrameSection, bool usingEHFrameSection,
context.SetDataAlignment(dataReader.ReadSignedLEB128(0)); context.SetDataAlignment(dataReader.ReadSignedLEB128(0));
context.SetReturnAddressRegister(dataReader.ReadUnsignedLEB128(0)); context.SetReturnAddressRegister(dataReader.ReadUnsignedLEB128(0));
TRACE_CFI(" cie: length: %llu, offset: %#llx, version: %u, augmentation: " TRACE_CFI(" cie: length: %" B_PRIu64 ", offset: %#" B_PRIx64 ", version: "
"\"%s\", aligment: code: %lu, data: %ld, return address reg: %lu\n", "%u, augmentation: \"%s\", aligment: code: %" B_PRIu32 ", data: %"
length, cieOffset, version, cieAugmentation.String(), B_PRId32 ", return address reg: %" B_PRIu32 "\n", length,
(uint64)cieOffset, version, cieAugmentation.String(),
context.CodeAlignment(), context.DataAlignment(), context.CodeAlignment(), context.DataAlignment(),
context.ReturnAddressRegister()); context.ReturnAddressRegister());
status_t error = cieAugmentation.Read(dataReader); status_t error = cieAugmentation.Read(dataReader);
if (error != B_OK) { if (error != B_OK) {
TRACE_CFI(" cie: length: %llu, version: %u, augmentation: \"%s\" " TRACE_CFI(" cie: length: %" B_PRIu64 ", version: %u, augmentation: "
"-- unsupported\n", length, version, cieAugmentation.String()); "\"%s\" -- unsupported\n", length, version,
cieAugmentation.String());
return error; return error;
} }
@@ -1690,7 +1697,7 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit,
CfaContext& context, DataReader& dataReader) CfaContext& context, DataReader& dataReader)
{ {
while (dataReader.BytesRemaining() > 0) { while (dataReader.BytesRemaining() > 0) {
TRACE_CFI(" [%2lld]", dataReader.BytesRemaining()); TRACE_CFI(" [%2" B_PRId64 "]", dataReader.BytesRemaining());
uint8 opcode = dataReader.Read<uint8>(0); uint8 opcode = dataReader.Read<uint8>(0);
if ((opcode >> 6) != 0) { if ((opcode >> 6) != 0) {
@@ -1699,7 +1706,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit,
switch (opcode >> 6) { switch (opcode >> 6) {
case DW_CFA_advance_loc: case DW_CFA_advance_loc:
{ {
TRACE_CFI(" DW_CFA_advance_loc: %#lx\n", operand); TRACE_CFI(" DW_CFA_advance_loc: %#" B_PRIx32 "\n",
operand);
target_addr_t location = context.Location() target_addr_t location = context.Location()
+ operand * context.CodeAlignment(); + operand * context.CodeAlignment();
@@ -1711,8 +1719,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit,
case DW_CFA_offset: case DW_CFA_offset:
{ {
uint64 offset = dataReader.ReadUnsignedLEB128(0); uint64 offset = dataReader.ReadUnsignedLEB128(0);
TRACE_CFI(" DW_CFA_offset: reg: %lu, offset: %llu\n", TRACE_CFI(" DW_CFA_offset: reg: %" B_PRIu32 ", offset: "
operand, offset); "%" B_PRIu64 "\n", operand, offset);
if (CfaRule* rule = context.RegisterRule(operand)) { if (CfaRule* rule = context.RegisterRule(operand)) {
rule->SetToLocationOffset( rule->SetToLocationOffset(
@@ -1722,7 +1730,7 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit,
} }
case DW_CFA_restore: case DW_CFA_restore:
{ {
TRACE_CFI(" DW_CFA_restore: %#lx\n", operand); TRACE_CFI(" DW_CFA_restore: %#" B_PRIx32 "\n", operand);
context.RestoreRegisterRule(operand); context.RestoreRegisterRule(operand);
break; break;
@@ -1739,7 +1747,7 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit,
{ {
target_addr_t location = dataReader.ReadAddress(0); target_addr_t location = dataReader.ReadAddress(0);
TRACE_CFI(" DW_CFA_set_loc: %#llx\n", location); TRACE_CFI(" DW_CFA_set_loc: %#" B_PRIx64 "\n", location);
if (location < context.Location()) if (location < context.Location())
return B_BAD_VALUE; return B_BAD_VALUE;
@@ -1752,7 +1760,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit,
{ {
uint32 delta = dataReader.Read<uint8>(0); uint32 delta = dataReader.Read<uint8>(0);
TRACE_CFI(" DW_CFA_advance_loc1: %#lx\n", delta); TRACE_CFI(" DW_CFA_advance_loc1: %#" B_PRIx32 "\n",
delta);
target_addr_t location = context.Location() target_addr_t location = context.Location()
+ delta * context.CodeAlignment(); + delta * context.CodeAlignment();
@@ -1765,7 +1774,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit,
{ {
uint32 delta = dataReader.Read<uint16>(0); uint32 delta = dataReader.Read<uint16>(0);
TRACE_CFI(" DW_CFA_advance_loc2: %#lx\n", delta); TRACE_CFI(" DW_CFA_advance_loc2: %#" B_PRIx32 "\n",
delta);
target_addr_t location = context.Location() target_addr_t location = context.Location()
+ delta * context.CodeAlignment(); + delta * context.CodeAlignment();
@@ -1778,7 +1788,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit,
{ {
uint32 delta = dataReader.Read<uint32>(0); uint32 delta = dataReader.Read<uint32>(0);
TRACE_CFI(" DW_CFA_advance_loc4: %#lx\n", delta); TRACE_CFI(" DW_CFA_advance_loc4: %#" B_PRIx32 "\n",
delta);
target_addr_t location = context.Location() target_addr_t location = context.Location()
+ delta * context.CodeAlignment(); + delta * context.CodeAlignment();
@@ -1792,8 +1803,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit,
uint32 reg = dataReader.ReadUnsignedLEB128(0); uint32 reg = dataReader.ReadUnsignedLEB128(0);
uint64 offset = dataReader.ReadUnsignedLEB128(0); uint64 offset = dataReader.ReadUnsignedLEB128(0);
TRACE_CFI(" DW_CFA_offset_extended: reg: %lu, " TRACE_CFI(" DW_CFA_offset_extended: reg: %" B_PRIu32 ", "
"offset: %llu\n", reg, offset); "offset: %" B_PRIu64 "\n", reg, offset);
if (CfaRule* rule = context.RegisterRule(reg)) { if (CfaRule* rule = context.RegisterRule(reg)) {
rule->SetToLocationOffset( rule->SetToLocationOffset(
@@ -1805,7 +1816,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit,
{ {
uint32 reg = dataReader.ReadUnsignedLEB128(0); uint32 reg = dataReader.ReadUnsignedLEB128(0);
TRACE_CFI(" DW_CFA_restore_extended: %#lx\n", reg); TRACE_CFI(" DW_CFA_restore_extended: %#" B_PRIx32 "\n",
reg);
context.RestoreRegisterRule(reg); context.RestoreRegisterRule(reg);
break; break;
@@ -1814,7 +1826,7 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit,
{ {
uint32 reg = dataReader.ReadUnsignedLEB128(0); uint32 reg = dataReader.ReadUnsignedLEB128(0);
TRACE_CFI(" DW_CFA_undefined: %lu\n", reg); TRACE_CFI(" DW_CFA_undefined: %" B_PRIu32 "\n", reg);
if (CfaRule* rule = context.RegisterRule(reg)) if (CfaRule* rule = context.RegisterRule(reg))
rule->SetToUndefined(); rule->SetToUndefined();
@@ -1824,7 +1836,7 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit,
{ {
uint32 reg = dataReader.ReadUnsignedLEB128(0); uint32 reg = dataReader.ReadUnsignedLEB128(0);
TRACE_CFI(" DW_CFA_same_value: %lu\n", reg); TRACE_CFI(" DW_CFA_same_value: %" B_PRIu32 "\n", reg);
if (CfaRule* rule = context.RegisterRule(reg)) if (CfaRule* rule = context.RegisterRule(reg))
rule->SetToSameValue(); rule->SetToSameValue();
@@ -1835,7 +1847,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit,
uint32 reg1 = dataReader.ReadUnsignedLEB128(0); uint32 reg1 = dataReader.ReadUnsignedLEB128(0);
uint32 reg2 = dataReader.ReadUnsignedLEB128(0); uint32 reg2 = dataReader.ReadUnsignedLEB128(0);
TRACE_CFI(" DW_CFA_register: reg1: %lu, reg2: %lu\n", reg1, reg2); TRACE_CFI(" DW_CFA_register: reg1: %" B_PRIu32 ", reg2: "
"%" B_PRIu32 "\n", reg1, reg2);
if (CfaRule* rule = context.RegisterRule(reg1)) if (CfaRule* rule = context.RegisterRule(reg1))
rule->SetToValueOffset(reg2); rule->SetToValueOffset(reg2);
@@ -1864,8 +1877,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit,
uint32 reg = dataReader.ReadUnsignedLEB128(0); uint32 reg = dataReader.ReadUnsignedLEB128(0);
uint64 offset = dataReader.ReadUnsignedLEB128(0); uint64 offset = dataReader.ReadUnsignedLEB128(0);
TRACE_CFI(" DW_CFA_def_cfa: reg: %lu, offset: %llu\n", TRACE_CFI(" DW_CFA_def_cfa: reg: %" B_PRIu32 ", offset: "
reg, offset); "%" B_PRIu64 "\n", reg, offset);
context.GetCfaCfaRule()->SetToRegisterOffset(reg, offset); context.GetCfaCfaRule()->SetToRegisterOffset(reg, offset);
break; break;
@@ -1874,7 +1887,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit,
{ {
uint32 reg = dataReader.ReadUnsignedLEB128(0); uint32 reg = dataReader.ReadUnsignedLEB128(0);
TRACE_CFI(" DW_CFA_def_cfa_register: %lu\n", reg); TRACE_CFI(" DW_CFA_def_cfa_register: %" B_PRIu32 "\n",
reg);
if (context.GetCfaCfaRule()->Type() if (context.GetCfaCfaRule()->Type()
!= CFA_CFA_RULE_REGISTER_OFFSET) { != CFA_CFA_RULE_REGISTER_OFFSET) {
@@ -1887,7 +1901,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit,
{ {
uint64 offset = dataReader.ReadUnsignedLEB128(0); uint64 offset = dataReader.ReadUnsignedLEB128(0);
TRACE_CFI(" DW_CFA_def_cfa_offset: %llu\n", offset); TRACE_CFI(" DW_CFA_def_cfa_offset: %" B_PRIu64 "\n",
offset);
if (context.GetCfaCfaRule()->Type() if (context.GetCfaCfaRule()->Type()
!= CFA_CFA_RULE_REGISTER_OFFSET) { != CFA_CFA_RULE_REGISTER_OFFSET) {
@@ -1902,8 +1917,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit,
uint8* block = (uint8*)dataReader.Data(); uint8* block = (uint8*)dataReader.Data();
dataReader.Skip(blockLength); dataReader.Skip(blockLength);
TRACE_CFI(" DW_CFA_def_cfa_expression: %p, %llu\n", TRACE_CFI(" DW_CFA_def_cfa_expression: %p, %" B_PRIu64
block, blockLength); "\n", block, blockLength);
context.GetCfaCfaRule()->SetToExpression(block, context.GetCfaCfaRule()->SetToExpression(block,
blockLength); blockLength);
@@ -1916,8 +1931,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit,
uint8* block = (uint8*)dataReader.Data(); uint8* block = (uint8*)dataReader.Data();
dataReader.Skip(blockLength); dataReader.Skip(blockLength);
TRACE_CFI(" DW_CFA_expression: reg: %lu, block: %p, " TRACE_CFI(" DW_CFA_expression: reg: %" B_PRIu32 ", "
"%llu\n", reg, block, blockLength); "block: %p, %" B_PRIu64 "\n", reg, block, blockLength);
if (CfaRule* rule = context.RegisterRule(reg)) if (CfaRule* rule = context.RegisterRule(reg))
rule->SetToLocationExpression(block, blockLength); rule->SetToLocationExpression(block, blockLength);
@@ -1928,8 +1943,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit,
uint32 reg = dataReader.ReadUnsignedLEB128(0); uint32 reg = dataReader.ReadUnsignedLEB128(0);
int64 offset = dataReader.ReadSignedLEB128(0); int64 offset = dataReader.ReadSignedLEB128(0);
TRACE_CFI(" DW_CFA_offset_extended: reg: %lu, " TRACE_CFI(" DW_CFA_offset_extended: reg: %" B_PRIu32 ", "
"offset: %lld\n", reg, offset); "offset: %" B_PRId64 "\n", reg, offset);
if (CfaRule* rule = context.RegisterRule(reg)) { if (CfaRule* rule = context.RegisterRule(reg)) {
rule->SetToLocationOffset( rule->SetToLocationOffset(
@@ -1942,8 +1957,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit,
uint32 reg = dataReader.ReadUnsignedLEB128(0); uint32 reg = dataReader.ReadUnsignedLEB128(0);
int64 offset = dataReader.ReadSignedLEB128(0); int64 offset = dataReader.ReadSignedLEB128(0);
TRACE_CFI(" DW_CFA_def_cfa_sf: reg: %lu, offset: %lld\n", TRACE_CFI(" DW_CFA_def_cfa_sf: reg: %" B_PRIu32 ", "
reg, offset); "offset: %" B_PRId64 "\n", reg, offset);
context.GetCfaCfaRule()->SetToRegisterOffset(reg, context.GetCfaCfaRule()->SetToRegisterOffset(reg,
offset * (int32)context.DataAlignment()); offset * (int32)context.DataAlignment());
@@ -1953,7 +1968,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit,
{ {
int64 offset = dataReader.ReadSignedLEB128(0); int64 offset = dataReader.ReadSignedLEB128(0);
TRACE_CFI(" DW_CFA_def_cfa_offset: %lld\n", offset); TRACE_CFI(" DW_CFA_def_cfa_offset: %" B_PRId64 "\n",
offset);
if (context.GetCfaCfaRule()->Type() if (context.GetCfaCfaRule()->Type()
!= CFA_CFA_RULE_REGISTER_OFFSET) { != CFA_CFA_RULE_REGISTER_OFFSET) {
@@ -1968,8 +1984,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit,
uint32 reg = dataReader.ReadUnsignedLEB128(0); uint32 reg = dataReader.ReadUnsignedLEB128(0);
uint64 offset = dataReader.ReadUnsignedLEB128(0); uint64 offset = dataReader.ReadUnsignedLEB128(0);
TRACE_CFI(" DW_CFA_val_offset: reg: %lu, offset: %llu\n", TRACE_CFI(" DW_CFA_val_offset: reg: %" B_PRIu32 ", "
reg, offset); "offset: %" B_PRIu64 "\n", reg, offset);
if (CfaRule* rule = context.RegisterRule(reg)) { if (CfaRule* rule = context.RegisterRule(reg)) {
rule->SetToValueOffset( rule->SetToValueOffset(
@@ -1982,8 +1998,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit,
uint32 reg = dataReader.ReadUnsignedLEB128(0); uint32 reg = dataReader.ReadUnsignedLEB128(0);
int64 offset = dataReader.ReadSignedLEB128(0); int64 offset = dataReader.ReadSignedLEB128(0);
TRACE_CFI(" DW_CFA_val_offset_sf: reg: %lu, " TRACE_CFI(" DW_CFA_val_offset_sf: reg: %" B_PRIu32 ", "
"offset: %lld\n", reg, offset); "offset: %" B_PRId64 "\n", reg, offset);
if (CfaRule* rule = context.RegisterRule(reg)) { if (CfaRule* rule = context.RegisterRule(reg)) {
rule->SetToValueOffset( rule->SetToValueOffset(
@@ -1998,8 +2014,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit,
uint8* block = (uint8*)dataReader.Data(); uint8* block = (uint8*)dataReader.Data();
dataReader.Skip(blockLength); dataReader.Skip(blockLength);
TRACE_CFI(" DW_CFA_val_expression: reg: %lu, block: %p, " TRACE_CFI(" DW_CFA_val_expression: reg: %" B_PRIu32 ", "
"%llu\n", reg, block, blockLength); "block: %p, %" B_PRIu64 "\n", reg, block, blockLength);
if (CfaRule* rule = context.RegisterRule(reg)) if (CfaRule* rule = context.RegisterRule(reg))
rule->SetToValueExpression(block, blockLength); rule->SetToValueExpression(block, blockLength);
@@ -2011,7 +2027,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit,
{ {
uint64 delta = dataReader.Read<uint64>(0); uint64 delta = dataReader.Read<uint64>(0);
TRACE_CFI(" DW_CFA_MIPS_advance_loc8: %#llx\n", delta); TRACE_CFI(" DW_CFA_MIPS_advance_loc8: %#" B_PRIx64 "\n",
delta);
target_addr_t location = context.Location() target_addr_t location = context.Location()
+ delta * context.CodeAlignment(); + delta * context.CodeAlignment();
@@ -2034,7 +2051,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit,
TRACE_CFI_ONLY(uint64 size =) TRACE_CFI_ONLY(uint64 size =)
dataReader.ReadUnsignedLEB128(0); dataReader.ReadUnsignedLEB128(0);
TRACE_CFI(" DW_CFA_GNU_args_size: %llu\n", size); TRACE_CFI(" DW_CFA_GNU_args_size: %" B_PRIu64 "\n",
size);
// TODO: Implement! // TODO: Implement!
break; break;
} }
@@ -2045,7 +2063,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit,
int64 offset = dataReader.ReadSignedLEB128(0); int64 offset = dataReader.ReadSignedLEB128(0);
TRACE_CFI(" DW_CFA_GNU_negative_offset_extended: " TRACE_CFI(" DW_CFA_GNU_negative_offset_extended: "
"reg: %lu, offset: %lld\n", reg, offset); "reg: %" B_PRIu32 ", offset: %" B_PRId64 "\n", reg,
offset);
if (CfaRule* rule = context.RegisterRule(reg)) { if (CfaRule* rule = context.RegisterRule(reg)) {
rule->SetToLocationOffset( rule->SetToLocationOffset(
@@ -2125,7 +2144,8 @@ DwarfFile::_ParsePublicTypesInfo(DataReader& dataReader, bool dwarf64)
return B_BAD_DATA; return B_BAD_DATA;
TRACE_PUBTYPES("DwarfFile::_ParsePublicTypesInfo(): compilation unit debug " TRACE_PUBTYPES("DwarfFile::_ParsePublicTypesInfo(): compilation unit debug "
"info: (%lld, %lld)\n", debugInfoOffset, debugInfoSize); "info: (%" B_PRIdOFF ", %" B_PRIdOFF ")\n", debugInfoOffset,
debugInfoSize);
while (dataReader.BytesRemaining() > 0) { while (dataReader.BytesRemaining() > 0) {
off_t entryOffset = dwarf64 off_t entryOffset = dwarf64
@@ -2136,7 +2156,7 @@ DwarfFile::_ParsePublicTypesInfo(DataReader& dataReader, bool dwarf64)
TRACE_PUBTYPES_ONLY(const char* name =) dataReader.ReadString(); TRACE_PUBTYPES_ONLY(const char* name =) dataReader.ReadString();
TRACE_PUBTYPES(" \"%s\" -> %lld\n", name, entryOffset); TRACE_PUBTYPES(" \"%s\" -> %" B_PRIdOFF "\n", name, entryOffset);
} }
return B_OK; return B_OK;
+4 -4
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -367,7 +367,7 @@ status_t
Team::GetStatementAtAddress(target_addr_t address, FunctionInstance*& _function, Team::GetStatementAtAddress(target_addr_t address, FunctionInstance*& _function,
Statement*& _statement) Statement*& _statement)
{ {
TRACE_CODE("Team::GetStatementAtAddress(%#llx)\n", address); TRACE_CODE("Team::GetStatementAtAddress(%#" B_PRIx64 ")\n", address);
// get the image at the address // get the image at the address
Image* image = ImageByAddress(address); Image* image = ImageByAddress(address);
@@ -422,8 +422,8 @@ status_t
Team::GetStatementAtSourceLocation(SourceCode* sourceCode, Team::GetStatementAtSourceLocation(SourceCode* sourceCode,
const SourceLocation& location, Statement*& _statement) const SourceLocation& location, Statement*& _statement)
{ {
TRACE_CODE("Team::GetStatementAtSourceLocation(%p, (%ld, %ld))\n", TRACE_CODE("Team::GetStatementAtSourceLocation(%p, (%" B_PRId32 ", %"
sourceCode, location.Line(), location.Column()); B_PRId32 "))\n", sourceCode, location.Line(), location.Column());
// If we're lucky the source code can provide us with a statement. // If we're lucky the source code can provide us with a statement.
if (DisassembledCode* code = dynamic_cast<DisassembledCode*>(sourceCode)) { if (DisassembledCode* code = dynamic_cast<DisassembledCode*>(sourceCode)) {
@@ -1,5 +1,5 @@
/* /*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -82,13 +82,13 @@ TypeComponent::Dump() const
printf("undefined"); printf("undefined");
break; break;
case TYPE_COMPONENT_BASE_TYPE: case TYPE_COMPONENT_BASE_TYPE:
printf("base %llu \"%s\"", index, name.String()); printf("base %" B_PRIu64 " \"%s\"", index, name.String());
break; break;
case TYPE_COMPONENT_DATA_MEMBER: case TYPE_COMPONENT_DATA_MEMBER:
printf("member %llu \"%s\"", index, name.String()); printf("member %" B_PRIu64 " \"%s\"", index, name.String());
break; break;
case TYPE_COMPONENT_ARRAY_ELEMENT: case TYPE_COMPONENT_ARRAY_ELEMENT:
printf("element %llu \"%s\"", index, name.String()); printf("element %" B_PRIu64 " \"%s\"", index, name.String());
break; break;
} }
} }
+1 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef TYPE_COMPONENT_PATH_H #ifndef TYPE_COMPONENT_PATH_H
+6 -6
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -240,7 +240,7 @@ void
ValueLocation::Dump() const ValueLocation::Dump() const
{ {
int32 count = fPieces.Size(); int32 count = fPieces.Size();
printf("ValueLocation: %s endian, %ld pieces:\n", printf("ValueLocation: %s endian, %" B_PRId32 " pieces:\n",
fBigEndian ? "big" : "little", count); fBigEndian ? "big" : "little", count);
for (int32 i = 0; i < count; i++) { for (int32 i = 0; i < count; i++) {
@@ -253,14 +253,14 @@ ValueLocation::Dump() const
printf(" unknown"); printf(" unknown");
break; break;
case VALUE_PIECE_LOCATION_MEMORY: case VALUE_PIECE_LOCATION_MEMORY:
printf(" address %#llx", piece.address); printf(" address %#" B_PRIx64, piece.address);
break; break;
case VALUE_PIECE_LOCATION_REGISTER: case VALUE_PIECE_LOCATION_REGISTER:
printf(" register %lu", piece.reg); printf(" register %" B_PRIu32, piece.reg);
break; break;
} }
printf(" size: %llu (%llu bits), offset: %llu bits\n", piece.size, printf(" size: %" B_PRIu64 " (%" B_PRIu64 " bits), offset: %" B_PRIu64
piece.bitSize, piece.bitOffset); " bits\n", piece.size, piece.bitSize, piece.bitOffset);
} }
} }
+1 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef VALUE_LOCATION_H #ifndef VALUE_LOCATION_H
@@ -161,7 +161,7 @@ MemoryView::Draw(BRect rect)
const char* blockAddress = currentAddress + (j const char* blockAddress = currentAddress + (j
* blockByteSize); * blockByteSize);
_GetNextHexBlock(buffer, _GetNextHexBlock(buffer,
std::min(hexBlockSize, sizeof(buffer)), std::min((size_t)hexBlockSize, sizeof(buffer)),
blockAddress); blockAddress);
DrawString(buffer, drawPoint); DrawString(buffer, drawPoint);
if (targetAddress >= blockAddress && targetAddress < if (targetAddress >= blockAddress && targetAddress <
@@ -1,5 +1,5 @@
/* /*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2011, Rene Gollent, rene@gollent.com. * Copyright 2011, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -96,12 +96,14 @@ private:
break; break;
case B_INT32_TYPE: case B_INT32_TYPE:
case B_UINT32_TYPE: case B_UINT32_TYPE:
snprintf(buffer, bufferSize, "0x%08lx", value.ToUInt32()); snprintf(buffer, bufferSize, "0x%08" B_PRIx32,
value.ToUInt32());
break; break;
case B_INT64_TYPE: case B_INT64_TYPE:
case B_UINT64_TYPE: case B_UINT64_TYPE:
default: default:
snprintf(buffer, bufferSize, "0x%016llx", value.ToUInt64()); snprintf(buffer, bufferSize, "0x%016" B_PRIx64,
value.ToUInt64());
break; break;
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2009, Rene Gollent, rene@gollent.com. * Copyright 2009, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -384,7 +384,7 @@ SourceView::BaseView::GetLineRange(BRect rect, int32& minLine,
int32 lineHeight = (int32)fFontInfo->lineHeight; int32 lineHeight = (int32)fFontInfo->lineHeight;
minLine = (int32)rect.top / lineHeight; minLine = (int32)rect.top / lineHeight;
maxLine = ((int32)ceilf(rect.bottom) + lineHeight - 1) / lineHeight; maxLine = ((int32)ceilf(rect.bottom) + lineHeight - 1) / lineHeight;
minLine = std::max(minLine, 0L); minLine = std::max(minLine, (int32)0);
maxLine = std::min(maxLine, fSourceCode->CountLines() - 1); maxLine = std::min(maxLine, fSourceCode->CountLines() - 1);
} }
@@ -1772,7 +1772,7 @@ SourceView::UserBreakpointChanged(UserBreakpoint* breakpoint)
bool bool
SourceView::ScrollToAddress(target_addr_t address) SourceView::ScrollToAddress(target_addr_t address)
{ {
TRACE_GUI("SourceView::ScrollToAddress(%#llx)\n", address); TRACE_GUI("SourceView::ScrollToAddress(%#" B_PRIx64 ")\n", address);
if (fSourceCode == NULL) if (fSourceCode == NULL)
return false; return false;
@@ -1794,7 +1794,7 @@ SourceView::ScrollToAddress(target_addr_t address)
bool bool
SourceView::ScrollToLine(uint32 line) SourceView::ScrollToLine(uint32 line)
{ {
TRACE_GUI("SourceView::ScrollToLine(%lu)\n", line); TRACE_GUI("SourceView::ScrollToLine(%" B_PRIu32 ")\n", line);
if (fSourceCode == NULL || line >= (uint32)fSourceCode->CountLines()) if (fSourceCode == NULL || line >= (uint32)fSourceCode->CountLines())
return false; return false;
@@ -1804,7 +1804,7 @@ SourceView::ScrollToLine(uint32 line)
BRect visible = Bounds(); BRect visible = Bounds();
TRACE_GUI("SourceView::ScrollToLine(%ld)\n", line); TRACE_GUI("SourceView::ScrollToLine(%" B_PRId32 ")\n", line);
TRACE_GUI(" visible: (%f, %f) - (%f, %f), line: %f - %f\n", visible.left, TRACE_GUI(" visible: (%f, %f) - (%f, %f), line: %f - %f\n", visible.left,
visible.top, visible.right, visible.bottom, top, bottom); visible.top, visible.right, visible.bottom, top, bottom);
@@ -1,5 +1,5 @@
/* /*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2011, Rene Gollent, rene@gollent.com. * Copyright 2011, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -95,7 +95,7 @@ public:
} }
char offset[32]; char offset[32];
snprintf(offset, sizeof(offset), " + %#llx", snprintf(offset, sizeof(offset), " + %#" B_PRIx64,
frame->InstructionPointer() - baseAddress); frame->InstructionPointer() - baseAddress);
name << offset; name << offset;
@@ -1,5 +1,5 @@
/* /*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2010-2012, Rene Gollent, rene@gollent.com. * Copyright 2010-2012, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -1191,7 +1191,8 @@ TeamWindow::_HandleStackTraceChanged(thread_id threadID)
void void
TeamWindow::_HandleImageDebugInfoChanged(image_id imageID) TeamWindow::_HandleImageDebugInfoChanged(image_id imageID)
{ {
TRACE_GUI("TeamWindow::_HandleImageDebugInfoChanged(%ld)\n", imageID); TRACE_GUI("TeamWindow::_HandleImageDebugInfoChanged(%" B_PRId32 ")\n",
imageID);
// We're only interested in the currently selected thread // We're only interested in the currently selected thread
if (fActiveImage == NULL || imageID != fActiveImage->ID()) if (fActiveImage == NULL || imageID != fActiveImage->ID())
@@ -1,5 +1,5 @@
/* /*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -23,7 +23,7 @@ BField*
TargetAddressTableColumn::PrepareField(const BVariant& value) const TargetAddressTableColumn::PrepareField(const BVariant& value) const
{ {
char buffer[64]; char buffer[64];
snprintf(buffer, sizeof(buffer), "%#llx", value.ToUInt64()); snprintf(buffer, sizeof(buffer), "%#" B_PRIx64, value.ToUInt64());
return StringTableColumn::PrepareField( return StringTableColumn::PrepareField(
BVariant(buffer, B_VARIANT_DONT_COPY_DATA)); BVariant(buffer, B_VARIANT_DONT_COPY_DATA));
+4 -3
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2012, Rene Gollent, rene@gollent.com. * Copyright 2012, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -130,11 +130,12 @@ IntegerFormatter::FormatValue(const BVariant& value, integer_format format,
snprintf(buffer, bufferSize, "%#x", (uint16)value.ToUInt64()); snprintf(buffer, bufferSize, "%#x", (uint16)value.ToUInt64());
break; break;
case INTEGER_FORMAT_HEX_32: case INTEGER_FORMAT_HEX_32:
snprintf(buffer, bufferSize, "%#lx", (uint32)value.ToUInt64()); snprintf(buffer, bufferSize, "%#" B_PRIx32,
(uint32)value.ToUInt64());
break; break;
case INTEGER_FORMAT_HEX_64: case INTEGER_FORMAT_HEX_64:
default: default:
snprintf(buffer, bufferSize, "%#llx", value.ToUInt64()); snprintf(buffer, bufferSize, "%#" B_PRIx64, value.ToUInt64());
break; break;
} }
+9 -9
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -77,7 +77,7 @@ ValueLoader::LoadValue(ValueLocation* location, type_code valueType,
} }
if (piece.size > kMaxPieceSize) { if (piece.size > kMaxPieceSize) {
TRACE_LOCALS(" -> overly long piece size (%llu bytes)\n", TRACE_LOCALS(" -> overly long piece size (%" B_PRIu64 " bytes)\n",
piece.size); piece.size);
return B_UNSUPPORTED; return B_UNSUPPORTED;
} }
@@ -85,7 +85,7 @@ ValueLoader::LoadValue(ValueLocation* location, type_code valueType,
totalBitSize += piece.bitSize; totalBitSize += piece.bitSize;
} }
TRACE_LOCALS(" -> totalBitSize: %llu\n", totalBitSize); TRACE_LOCALS(" -> totalBitSize: %" B_PRIu64 "\n", totalBitSize);
if (totalBitSize == 0) { if (totalBitSize == 0) {
TRACE_LOCALS(" -> no size\n"); TRACE_LOCALS(" -> no size\n");
@@ -99,8 +99,8 @@ ValueLoader::LoadValue(ValueLocation* location, type_code valueType,
uint64 valueBitSize = BVariant::SizeOfType(valueType) * 8; uint64 valueBitSize = BVariant::SizeOfType(valueType) * 8;
if (!shortValueIsFine && totalBitSize < valueBitSize) { if (!shortValueIsFine && totalBitSize < valueBitSize) {
TRACE_LOCALS(" -> too short for value type (%llu vs. %llu bits)\n", TRACE_LOCALS(" -> too short for value type (%" B_PRIu64 " vs. %"
totalBitSize, valueBitSize); B_PRIu64 " bits)\n", totalBitSize, valueBitSize);
return B_BAD_VALUE; return B_BAD_VALUE;
} }
@@ -130,8 +130,8 @@ ValueLoader::LoadValue(ValueLocation* location, type_code valueType,
{ {
target_addr_t address = piece.address; target_addr_t address = piece.address;
TRACE_LOCALS(" piece %ld: memory address: %#llx, bits: %lu\n", TRACE_LOCALS(" piece %" B_PRId32 ": memory address: %#"
i, address, bitSize); B_PRIx64 ", bits: %" B_PRIu32 "\n", i, address, bitSize);
uint8 pieceBuffer[kMaxPieceSize]; uint8 pieceBuffer[kMaxPieceSize];
ssize_t bytesRead = fTeamMemory->ReadMemory(address, ssize_t bytesRead = fTeamMemory->ReadMemory(address,
@@ -161,8 +161,8 @@ ValueLoader::LoadValue(ValueLocation* location, type_code valueType,
} }
case VALUE_PIECE_LOCATION_REGISTER: case VALUE_PIECE_LOCATION_REGISTER:
{ {
TRACE_LOCALS(" piece %ld: register: %lu, bits: %lu\n", i, TRACE_LOCALS(" piece %" B_PRId32 ": register: %" B_PRIu32
piece.reg, bitSize); ", bits: %" B_PRIu32 "\n", i, piece.reg, bitSize);
if (fCpuState == NULL) { if (fCpuState == NULL) {
WARNING("ValueLoader::LoadValue(): register piece, but no " WARNING("ValueLoader::LoadValue(): register piece, but no "
@@ -255,8 +255,8 @@ BMessageValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader,
return B_NO_MEMORY; return B_NO_MEMORY;
error = valueLoader->LoadRawValue(headerAddress, sizeof( error = valueLoader->LoadRawValue(headerAddress, sizeof(
BMessage::message_header), fHeader); BMessage::message_header), fHeader);
TRACE_LOCALS("BMessage: Header Address: 0x%" B_PRIx64 ", result: %ld\n", TRACE_LOCALS("BMessage: Header Address: 0x%" B_PRIx64 ", result: %s\n",
headerAddress.ToUInt64(), error); headerAddress.ToUInt64(), strerror(error));
if (error != B_OK) if (error != B_OK)
return error; return error;
@@ -269,15 +269,16 @@ BMessageValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader,
else else
fHeader->what = what.ToUInt32(); fHeader->what = what.ToUInt32();
TRACE_LOCALS("BMessage: what: 0x%" B_PRIx32 ", result: %ld\n", TRACE_LOCALS("BMessage: what: 0x%" B_PRIx32 ", result: %s\n",
what.ToUInt32(), error); what.ToUInt32(), strerror(error));
size_t fieldsSize = fHeader->field_count * sizeof( size_t fieldsSize = fHeader->field_count * sizeof(
BMessage::field_header); BMessage::field_header);
if (fIsFlatMessage) if (fIsFlatMessage)
fDataLocation.SetTo(fieldAddress.ToUInt64() + fieldsSize); fDataLocation.SetTo(fieldAddress.ToUInt64() + fieldsSize);
size_t totalSize = sizeof(BMessage::message_header) + fieldsSize + fHeader->data_size; size_t totalSize = sizeof(BMessage::message_header) + fieldsSize
+ fHeader->data_size;
uint8* messageBuffer = new(std::nothrow) uint8[totalSize]; uint8* messageBuffer = new(std::nothrow) uint8[totalSize];
if (messageBuffer == NULL) if (messageBuffer == NULL)
return B_NO_MEMORY; return B_NO_MEMORY;
@@ -296,7 +297,7 @@ BMessageValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader,
error = valueLoader->LoadRawValue(fieldAddress, fieldsSize, error = valueLoader->LoadRawValue(fieldAddress, fieldsSize,
fFields); fFields);
TRACE_LOCALS("BMessage: Field Header Address: 0x%" B_PRIx64 TRACE_LOCALS("BMessage: Field Header Address: 0x%" B_PRIx64
", result: %ld\n", headerAddress.ToUInt64(), error); ", result: %s\n", headerAddress.ToUInt64(), strerror(error));
if (error != B_OK) if (error != B_OK)
return error; return error;
@@ -307,7 +308,7 @@ BMessageValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader,
error = valueLoader->LoadRawValue(fDataLocation, fHeader->data_size, error = valueLoader->LoadRawValue(fDataLocation, fHeader->data_size,
fData); fData);
TRACE_LOCALS("BMessage: Data Address: 0x%" B_PRIx64 TRACE_LOCALS("BMessage: Data Address: 0x%" B_PRIx64
", result: %ld\n", fDataLocation.ToUInt64(), error); ", result: %s\n", fDataLocation.ToUInt64(), strerror(error));
if (error != B_OK) if (error != B_OK)
return error; return error;
memcpy(tempBuffer, fFields, fieldsSize); memcpy(tempBuffer, fFields, fieldsSize);
@@ -710,7 +711,7 @@ BMessageValueNode::BMessageFieldNodeChild::BMessageFieldNodeChild(
fType->AcquireReference(); fType->AcquireReference();
if (fFieldIndex >= 0) if (fFieldIndex >= 0)
fPresentationName.SetToFormat("[%ld]", fFieldIndex); fPresentationName.SetToFormat("[%" B_PRId32 "]", fFieldIndex);
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -198,7 +198,7 @@ CompoundValueNode::CreateChildren()
// base types // base types
for (int32 i = 0; BaseType* baseType = fType->BaseTypeAt(i); i++) { for (int32 i = 0; BaseType* baseType = fType->BaseTypeAt(i); i++) {
TRACE_LOCALS(" base %ld\n", i); TRACE_LOCALS(" base %" B_PRId32 "\n", i);
BaseTypeChild* child = new(std::nothrow) BaseTypeChild(this, baseType); BaseTypeChild* child = new(std::nothrow) BaseTypeChild(this, baseType);
if (child == NULL || !fChildren.AddItem(child)) { if (child == NULL || !fChildren.AddItem(child)) {
@@ -211,7 +211,7 @@ CompoundValueNode::CreateChildren()
// members // members
for (int32 i = 0; DataMember* member = fType->DataMemberAt(i); i++) { for (int32 i = 0; DataMember* member = fType->DataMemberAt(i); i++) {
TRACE_LOCALS(" member %ld: \"%s\"\n", i, member->Name()); TRACE_LOCALS(" member %" B_PRId32 ": \"%s\"\n", i, member->Name());
MemberChild* child = new(std::nothrow) MemberChild(this, member); MemberChild* child = new(std::nothrow) MemberChild(this, member);
if (child == NULL || !fChildren.AddItem(child)) { if (child == NULL || !fChildren.AddItem(child)) {
@@ -1,5 +1,5 @@
/* /*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -28,7 +28,7 @@ AddressValue::ToString(BString& _string) const
return false; return false;
char buffer[32]; char buffer[32];
snprintf(buffer, sizeof(buffer), "%#llx", fValue.ToUInt64()); snprintf(buffer, sizeof(buffer), "%#" B_PRIx64, fValue.ToUInt64());
BString string(buffer); BString string(buffer);
if (string.Length() == 0) if (string.Length() == 0)
+1 -1
View File
@@ -176,7 +176,7 @@ continue_thread(port_id nubPort, thread_id thread)
return; return;
if (error != B_INTERRUPTED) { if (error != B_INTERRUPTED) {
fprintf(stderr, "%s: Failed to run thread %ld: %s\n", fprintf(stderr, "%s: Failed to run thread %" B_PRId32 ": %s\n",
kCommandName, thread, strerror(error)); kCommandName, thread, strerror(error));
exit(1); exit(1);
} }