diff --git a/src/apps/debuganalyzer/gui/table/TableColumns.cpp b/src/apps/debuganalyzer/gui/table/TableColumns.cpp index 6f3e940e94..7bd940665b 100644 --- a/src/apps/debuganalyzer/gui/table/TableColumns.cpp +++ b/src/apps/debuganalyzer/gui/table/TableColumns.cpp @@ -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. */ @@ -144,7 +144,7 @@ BField* Int32TableColumn::PrepareField(const BVariant& value) const { char buffer[16]; - snprintf(buffer, sizeof(buffer), "%ld", value.ToInt32()); + snprintf(buffer, sizeof(buffer), "%" B_PRId32, value.ToInt32()); return StringTableColumn::PrepareField( BVariant(buffer, B_VARIANT_DONT_COPY_DATA)); } @@ -174,7 +174,7 @@ BField* Int64TableColumn::PrepareField(const BVariant& value) const { char buffer[32]; - snprintf(buffer, sizeof(buffer), "%lld", value.ToInt64()); + snprintf(buffer, sizeof(buffer), "%" B_PRId64, value.ToInt64()); return StringTableColumn::PrepareField( BVariant(buffer, B_VARIANT_DONT_COPY_DATA)); } diff --git a/src/apps/debuganalyzer/util/TimeUtils.h b/src/apps/debuganalyzer/util/TimeUtils.h index b890d8b2b9..027dc172de 100644 --- a/src/apps/debuganalyzer/util/TimeUtils.h +++ b/src/apps/debuganalyzer/util/TimeUtils.h @@ -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. */ #ifndef TIME_UTILS_H @@ -65,8 +65,9 @@ format_bigtime(bigtime_t time, char* buffer, size_t bufferSize) decomposed_bigtime decomposed; decompose_time(time, decomposed); - snprintf(buffer, bufferSize, "%02lld:%02d:%02d:%06d", decomposed.hours, - decomposed.minutes, decomposed.seconds, decomposed.micros); + snprintf(buffer, bufferSize, "%02" B_PRId64 ":%02d:%02d:%06d", + decomposed.hours, decomposed.minutes, decomposed.seconds, + decomposed.micros); return buffer; } @@ -86,8 +87,9 @@ format_nanotime(nanotime_t time, char* buffer, size_t bufferSize) decomposed_nanotime decomposed; decompose_time(time, decomposed); - snprintf(buffer, bufferSize, "%02lld:%02d:%02d:%09d", decomposed.hours, - decomposed.minutes, decomposed.seconds, decomposed.nanos); + snprintf(buffer, bufferSize, "%02" B_PRId64 ":%02d:%02d:%09d", + decomposed.hours, decomposed.minutes, decomposed.seconds, + decomposed.nanos); return buffer; } diff --git a/src/apps/debugger/BreakpointManager.cpp b/src/apps/debugger/BreakpointManager.cpp index 1c653bc6d0..998f9fcd04 100644 --- a/src/apps/debugger/BreakpointManager.cpp +++ b/src/apps/debugger/BreakpointManager.cpp @@ -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. */ @@ -499,7 +499,7 @@ BreakpointManager::_UpdateBreakpointInstallation(Breakpoint* breakpoint) if (error != B_OK) return error; - TRACE_CONTROL("BREAKPOINT at %#llx installed: %s\n", + TRACE_CONTROL("BREAKPOINT at %#" B_PRIx64 " installed: %s\n", breakpoint->Address(), strerror(error)); breakpoint->SetInstalled(true); @@ -507,7 +507,7 @@ BreakpointManager::_UpdateBreakpointInstallation(Breakpoint* breakpoint) // uninstall fDebuggerInterface->UninstallBreakpoint(breakpoint->Address()); - TRACE_CONTROL("BREAKPOINT at %#llx uninstalled\n", + TRACE_CONTROL("BREAKPOINT at %#" B_PRIx64 " uninstalled\n", breakpoint->Address()); breakpoint->SetInstalled(false); diff --git a/src/apps/debugger/Debugger.cpp b/src/apps/debugger/Debugger.cpp index 645151d84e..9a25be1108 100644 --- a/src/apps/debugger/Debugger.cpp +++ b/src/apps/debugger/Debugger.cpp @@ -240,14 +240,14 @@ get_debugged_program(const Options& options, DebuggedProgramInfo& _info) status_t error = get_thread_info(thread, &threadInfo); if (error != B_OK) { // TODO: Notify the user! - fprintf(stderr, "Error: Failed to get info for thread \"%ld\": " - "%s\n", thread, strerror(error)); + fprintf(stderr, "Error: Failed to get info for thread \"%" B_PRId32 + "\": %s\n", thread, strerror(error)); return false; } 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.thread = thread; @@ -289,13 +289,13 @@ start_team_debugger(team_id teamID, SettingsManager* settingsManager, error = debugger->Init(teamID, threadID, stopInMain); 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)); delete debugger; return NULL; } else - printf("debugger for team %ld created and initialized successfully!\n", - teamID); + printf("debugger for team %" B_PRId32 " created and initialized " + "successfully!\n", teamID); return debugger; } @@ -458,7 +458,8 @@ Debugger::ArgvReceived(int32 argc, char** argv) TeamDebugger* debugger = _FindTeamDebugger(programInfo.team); 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(); return; } @@ -471,8 +472,7 @@ Debugger::ArgvReceived(int32 argc, char** argv) void Debugger::TeamDebuggerStarted(TeamDebugger* debugger) { - printf("debugger for team %ld started...\n", - debugger->TeamID()); + printf("debugger for team %" B_PRId32 " started...\n", debugger->TeamID()); // Note: see TeamDebuggerQuit() note about locking AutoLocker 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 // separate lock to protect the list. - printf("debugger for team %ld quit.\n", - debugger->TeamID()); + printf("debugger for team %" B_PRId32 " quit.\n", debugger->TeamID()); AutoLocker locker(this); fTeamDebuggers.RemoveItem(debugger); diff --git a/src/apps/debugger/TeamDebugger.cpp b/src/apps/debugger/TeamDebugger.cpp index f0853fb296..58eb10d880 100644 --- a/src/apps/debugger/TeamDebugger.cpp +++ b/src/apps/debugger/TeamDebugger.cpp @@ -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. * 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 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, B_NORMAL_PRIORITY, this); if (fDebugEventListener < 0) @@ -842,8 +843,8 @@ TeamDebugger::_DebugEventListener() // TODO: Error handling! if (event->Team() != fTeamID) { - TRACE_EVENTS("TeamDebugger for team %ld: received event from team " - "%ld!\n", fTeamID, event->Team()); + TRACE_EVENTS("TeamDebugger for team %" B_PRId32 ": received event " + "from team %" B_PRId32 "!\n", fTeamID, event->Team()); continue; } @@ -862,7 +863,7 @@ TeamDebugger::_DebugEventListener() void TeamDebugger::_HandleDebuggerMessage(DebugEvent* event) { - TRACE_EVENTS("TeamDebugger::_HandleDebuggerMessage(): %ld\n", + TRACE_EVENTS("TeamDebugger::_HandleDebuggerMessage(): %" B_PRId32 "\n", event->EventType()); bool handled = false; @@ -872,8 +873,8 @@ TeamDebugger::_HandleDebuggerMessage(DebugEvent* event) switch (event->EventType()) { case B_DEBUGGER_MESSAGE_THREAD_DEBUGGED: - TRACE_EVENTS("B_DEBUGGER_MESSAGE_THREAD_DEBUGGED: thread: %ld\n", - event->Thread()); + TRACE_EVENTS("B_DEBUGGER_MESSAGE_THREAD_DEBUGGED: thread: %" + B_PRId32 "\n", event->Thread()); if (handler != NULL) { handled = handler->HandleThreadDebugged( @@ -881,8 +882,8 @@ TeamDebugger::_HandleDebuggerMessage(DebugEvent* event) } break; case B_DEBUGGER_MESSAGE_DEBUGGER_CALL: - TRACE_EVENTS("B_DEBUGGER_MESSAGE_DEBUGGER_CALL: thread: %ld\n", - event->Thread()); + TRACE_EVENTS("B_DEBUGGER_MESSAGE_DEBUGGER_CALL: thread: %" B_PRId32 + "\n", event->Thread()); if (handler != NULL) { handled = handler->HandleDebuggerCall( @@ -890,8 +891,8 @@ TeamDebugger::_HandleDebuggerMessage(DebugEvent* event) } break; case B_DEBUGGER_MESSAGE_BREAKPOINT_HIT: - TRACE_EVENTS("B_DEBUGGER_MESSAGE_BREAKPOINT_HIT: thread: %ld\n", - event->Thread()); + TRACE_EVENTS("B_DEBUGGER_MESSAGE_BREAKPOINT_HIT: thread: %" B_PRId32 + "\n", event->Thread()); if (handler != NULL) { handled = handler->HandleBreakpointHit( @@ -899,8 +900,8 @@ TeamDebugger::_HandleDebuggerMessage(DebugEvent* event) } break; case B_DEBUGGER_MESSAGE_WATCHPOINT_HIT: - TRACE_EVENTS("B_DEBUGGER_MESSAGE_WATCHPOINT_HIT: thread: %ld\n", - event->Thread()); + TRACE_EVENTS("B_DEBUGGER_MESSAGE_WATCHPOINT_HIT: thread: %" B_PRId32 + "\n", event->Thread()); if (handler != NULL) { handled = handler->HandleWatchpointHit( @@ -908,8 +909,8 @@ TeamDebugger::_HandleDebuggerMessage(DebugEvent* event) } break; case B_DEBUGGER_MESSAGE_SINGLE_STEP: - TRACE_EVENTS("B_DEBUGGER_MESSAGE_SINGLE_STEP: thread: %ld\n", - event->Thread()); + TRACE_EVENTS("B_DEBUGGER_MESSAGE_SINGLE_STEP: thread: %" B_PRId32 + "\n", event->Thread()); if (handler != NULL) { handled = handler->HandleSingleStep( @@ -917,8 +918,8 @@ TeamDebugger::_HandleDebuggerMessage(DebugEvent* event) } break; case B_DEBUGGER_MESSAGE_EXCEPTION_OCCURRED: - TRACE_EVENTS("B_DEBUGGER_MESSAGE_EXCEPTION_OCCURRED: thread: %ld\n", - event->Thread()); + TRACE_EVENTS("B_DEBUGGER_MESSAGE_EXCEPTION_OCCURRED: thread: %" + B_PRId32 "\n", event->Thread()); if (handler != NULL) { handled = handler->HandleExceptionOccurred( @@ -930,11 +931,11 @@ TeamDebugger::_HandleDebuggerMessage(DebugEvent* event) // break; case B_DEBUGGER_MESSAGE_TEAM_DELETED: // TODO: Handle! - TRACE_EVENTS("B_DEBUGGER_MESSAGE_TEAM_DELETED: team: %ld\n", - event->Team()); + TRACE_EVENTS("B_DEBUGGER_MESSAGE_TEAM_DELETED: team: %" B_PRId32 + "\n", event->Team()); break; 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()); // TODO: Handle! break; @@ -942,8 +943,8 @@ TeamDebugger::_HandleDebuggerMessage(DebugEvent* event) { ThreadCreatedEvent* threadEvent = dynamic_cast(event); - TRACE_EVENTS("B_DEBUGGER_MESSAGE_THREAD_CREATED: thread: %ld\n", - threadEvent->NewThread()); + TRACE_EVENTS("B_DEBUGGER_MESSAGE_THREAD_CREATED: thread: %" B_PRId32 + "\n", threadEvent->NewThread()); handled = _HandleThreadCreated(threadEvent); break; } @@ -951,8 +952,8 @@ TeamDebugger::_HandleDebuggerMessage(DebugEvent* event) { ThreadRenamedEvent* threadEvent = dynamic_cast(event); - TRACE_EVENTS("DEBUGGER_MESSAGE_THREAD_RENAMED: thread: %ld " - "(\"%s\")\n", + TRACE_EVENTS("DEBUGGER_MESSAGE_THREAD_RENAMED: thread: %" B_PRId32 + " (\"%s\")\n", threadEvent->RenamedThread(), threadEvent->NewName()); handled = _HandleThreadRenamed(threadEvent); break; @@ -962,13 +963,13 @@ TeamDebugger::_HandleDebuggerMessage(DebugEvent* event) ThreadPriorityChangedEvent* threadEvent = dynamic_cast(event); TRACE_EVENTS("B_DEBUGGER_MESSAGE_THREAD_PRIORITY_CHANGED: thread:" - " %ld\n", threadEvent->ChangedThread()); + " %" B_PRId32 "\n", threadEvent->ChangedThread()); handled = _HandleThreadPriorityChanged(threadEvent); break; } case B_DEBUGGER_MESSAGE_THREAD_DELETED: - TRACE_EVENTS("B_DEBUGGER_MESSAGE_THREAD_DELETED: thread: %ld\n", - event->Thread()); + TRACE_EVENTS("B_DEBUGGER_MESSAGE_THREAD_DELETED: thread: %" B_PRId32 + "\n", event->Thread()); handled = _HandleThreadDeleted( dynamic_cast(event)); break; @@ -977,7 +978,7 @@ TeamDebugger::_HandleDebuggerMessage(DebugEvent* event) ImageCreatedEvent* imageEvent = dynamic_cast(event); 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()); handled = _HandleImageCreated(imageEvent); break; @@ -987,7 +988,7 @@ TeamDebugger::_HandleDebuggerMessage(DebugEvent* event) ImageDeletedEvent* imageEvent = dynamic_cast(event); 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()); handled = _HandleImageDeleted(imageEvent); break; @@ -1000,8 +1001,8 @@ TeamDebugger::_HandleDebuggerMessage(DebugEvent* event) // not interested break; default: - WARNING("TeamDebugger for team %ld: unknown event type: " - "%ld\n", fTeamID, event->EventType()); + WARNING("TeamDebugger for team %" B_PRId32 ": unknown event type: " + "%" B_PRId32 "\n", fTeamID, event->EventType()); break; } @@ -1124,7 +1125,8 @@ TeamDebugger::_HandleImageDebugInfoChanged(image_id imageID) void 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! } @@ -1132,8 +1134,8 @@ TeamDebugger::_HandleImageFileChanged(image_id imageID) void TeamDebugger::_HandleSetUserBreakpoint(target_addr_t address, bool enabled) { - TRACE_CONTROL("TeamDebugger::_HandleSetUserBreakpoint(%#llx, %d)\n", - address, enabled); + TRACE_CONTROL("TeamDebugger::_HandleSetUserBreakpoint(%#" B_PRIx64 + ", %d)\n", address, enabled); // check whether there already is a breakpoint AutoLocker< ::Team> locker(fTeam); @@ -1187,9 +1189,9 @@ TeamDebugger::_HandleSetUserBreakpoint(target_addr_t address, bool enabled) target_addr_t relativeAddress = address - functionInstance->Address(); - TRACE_CONTROL(" relative address: %#llx, source location: " - "(%ld, %ld)\n", relativeAddress, sourceLocation.Line(), - sourceLocation.Column()); + TRACE_CONTROL(" relative address: %#" B_PRIx64 ", source location: " + "(%" B_PRId32 ", %" B_PRId32 ")\n", relativeAddress, + sourceLocation.Line(), sourceLocation.Column()); // get function id FunctionID* functionID = functionInstance->GetFunctionID(); @@ -1212,8 +1214,8 @@ TeamDebugger::_HandleSetUserBreakpoint(target_addr_t address, bool enabled) for (FunctionInstanceList::ConstIterator it = function->Instances().GetIterator(); FunctionInstance* instance = it.Next();) { - TRACE_CONTROL(" function instance %p: range: %#llx - %#llx\n", - instance, instance->Address(), + TRACE_CONTROL(" function instance %p: range: %#" B_PRIx64 " - %#" + B_PRIx64 "\n", instance, instance->Address(), instance->Address() + instance->Size()); // 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", - instanceAddress); + TRACE_CONTROL(" breakpoint address using source info: %" B_PRIx64 + "\n", instanceAddress); if (instanceAddress == 0) { // 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; } - TRACE_CONTROL(" final breakpoint address: %llx\n", + TRACE_CONTROL(" final breakpoint address: %" B_PRIx64 "\n", instanceAddress); UserBreakpointInstance* breakpointInstance = new(std::nothrow) @@ -1282,7 +1284,8 @@ TeamDebugger::_HandleSetUserBreakpoint(UserBreakpoint* breakpoint, bool enabled) void 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); diff --git a/src/apps/debugger/ThreadHandler.cpp b/src/apps/debugger/ThreadHandler.cpp index c1932f2ebb..366c3923b9 100644 --- a/src/apps/debugger/ThreadHandler.cpp +++ b/src/apps/debugger/ThreadHandler.cpp @@ -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. * Distributed under the terms of the MIT License. */ @@ -117,7 +117,7 @@ ThreadHandler::HandleBreakpointHit(BreakpointHitEvent* event) CpuState* cpuState = event->GetCpuState(); target_addr_t instructionPointer = cpuState->InstructionPointer(); - TRACE_EVENTS("ThreadHandler::HandleBreakpointHit(): ip: %llx\n", + TRACE_EVENTS("ThreadHandler::HandleBreakpointHit(): ip: %" B_PRIx64 "\n", instructionPointer); // check whether this is a temporary breakpoint we're waiting for @@ -265,7 +265,7 @@ ThreadHandler::HandleThreadAction(uint32 action) 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 it returns by means of a breakpoint. @@ -315,7 +315,7 @@ ThreadHandler::HandleThreadAction(uint32 action) return; } - TRACE_CONTROL(" statement: %#llx - %#llx\n", + TRACE_CONTROL(" statement: %#" B_PRIx64 " - %#" B_PRIx64 "\n", fStepStatement->CoveringAddressRange().Start(), fStepStatement->CoveringAddressRange().End()); @@ -481,7 +481,7 @@ ThreadHandler::_DoStepOver(CpuState* cpuState) } 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) return false; @@ -633,7 +633,7 @@ ThreadHandler::_HandleBreakpointHitStep(CpuState* cpuState) bool ThreadHandler::_HandleSingleStepStep(CpuState* cpuState) { - TRACE_CONTROL("ThreadHandler::_HandleSingleStepStep(): ip: %llx\n", + TRACE_CONTROL("ThreadHandler::_HandleSingleStepStep(): ip: %" B_PRIx64 "\n", cpuState->InstructionPointer()); switch (fStepMode) { diff --git a/src/apps/debugger/Worker.h b/src/apps/debugger/Worker.h index 7e356992a7..411b9cba03 100644 --- a/src/apps/debugger/Worker.h +++ b/src/apps/debugger/Worker.h @@ -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. */ #ifndef WORKER_H @@ -40,7 +40,7 @@ class JobKey { public: virtual ~JobKey(); - virtual uint32 HashValue() const = 0; + virtual size_t HashValue() const = 0; virtual bool operator==(const JobKey& other) const = 0; }; @@ -54,7 +54,7 @@ public: SimpleJobKey(void* object, uint32 type); SimpleJobKey(const SimpleJobKey& other); - virtual uint32 HashValue() const; + virtual size_t HashValue() const; virtual bool operator==(const JobKey& other) const; diff --git a/src/apps/debugger/arch/x86/ArchitectureX86.cpp b/src/apps/debugger/arch/x86/ArchitectureX86.cpp index cc856cedce..9fd80cfa7a 100644 --- a/src/apps/debugger/arch/x86/ArchitectureX86.cpp +++ b/src/apps/debugger/arch/x86/ArchitectureX86.cpp @@ -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. * Distributed under the terms of the MIT License. */ @@ -250,11 +250,11 @@ status_t ArchitectureX86::CreateCpuState(const void* cpuStateData, size_t size, CpuState*& _state) { - if (size != sizeof(debug_cpu_state_x86)) + if (size != sizeof(x86_debug_cpu_state)) return B_BAD_VALUE; CpuStateX86* state = new(std::nothrow) CpuStateX86( - *(const debug_cpu_state_x86*)cpuStateData); + *(const x86_debug_cpu_state*)cpuStateData); if (state == NULL) return B_NO_MEMORY; diff --git a/src/apps/debugger/arch/x86/CpuStateX86.cpp b/src/apps/debugger/arch/x86/CpuStateX86.cpp index c51ee9df40..236c5054c3 100644 --- a/src/apps/debugger/arch/x86/CpuStateX86.cpp +++ b/src/apps/debugger/arch/x86/CpuStateX86.cpp @@ -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. * 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(), fInterruptVector(0) diff --git a/src/apps/debugger/arch/x86/CpuStateX86.h b/src/apps/debugger/arch/x86/CpuStateX86.h index dde5537ef5..795d331f82 100644 --- a/src/apps/debugger/arch/x86/CpuStateX86.h +++ b/src/apps/debugger/arch/x86/CpuStateX86.h @@ -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. * Distributed under the terms of the MIT License. */ @@ -13,9 +13,6 @@ #include "CpuState.h" -typedef debug_cpu_state debug_cpu_state_x86; - // TODO: Should be defined by ! - enum { X86_REGISTER_EIP = 0, X86_REGISTER_ESP, @@ -44,7 +41,7 @@ enum { class CpuStateX86 : public CpuState { public: CpuStateX86(); - CpuStateX86(const debug_cpu_state_x86& state); + CpuStateX86(const x86_debug_cpu_state& state); virtual ~CpuStateX86(); virtual target_addr_t InstructionPointer() const; diff --git a/src/apps/debugger/arch/x86/disasm/DisassemblerX86.cpp b/src/apps/debugger/arch/x86/disasm/DisassemblerX86.cpp index 31f4fe819f..f20838e31e 100644 --- a/src/apps/debugger/arch/x86/disasm/DisassemblerX86.cpp +++ b/src/apps/debugger/arch/x86/disasm/DisassemblerX86.cpp @@ -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 * 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); 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)); // TODO: Resolve symbols! diff --git a/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp b/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp index befa138729..04f57608ee 100644 --- a/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp +++ b/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp @@ -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. * Distributed under the terms of the MIT License. */ @@ -290,7 +290,8 @@ status_t DwarfImageDebugInfo::GetFunctions(BObjectList& functions) { 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); i++) { @@ -368,7 +369,7 @@ DwarfImageDebugInfo::GetFunctions(BObjectList& functions) DwarfFunctionDebugInfo* function = new(std::nothrow) DwarfFunctionDebugInfo(this, unit, subprogramEntry, rangeList, name, file, - SourceLocation(line, std::max(column, 0L))); + SourceLocation(line, std::max(column, (int32)0))); if (function == NULL || !functions.AddItem(function)) { delete function; return B_NO_MEMORY; @@ -568,9 +569,10 @@ DwarfImageDebugInfo::CreateFrame(Image* image, for (int32 i = 0; i < registerCount; i++) { const Register* reg = registers + i; BVariant value; - if (previousCpuState->GetRegisterValue(reg, value)) - TRACE_CFI(" %3s: %#lx\n", reg->Name(), value.ToUInt32()); - else + if (previousCpuState->GetRegisterValue(reg, value)) { + TRACE_CFI(" %3s: %#" B_PRIx32 "\n", reg->Name(), + value.ToUInt32()); + } else TRACE_CFI(" %3s: undefined\n", reg->Name()); } ) @@ -649,8 +651,8 @@ status_t DwarfImageDebugInfo::GetStatement(FunctionDebugInfo* _function, target_addr_t address, Statement*& _statement) { - TRACE_CODE("DwarfImageDebugInfo::GetStatement(function: %p, address: %#llx)\n", - _function, address); + TRACE_CODE("DwarfImageDebugInfo::GetStatement(function: %p, address: %#" + B_PRIx64 ")\n", _function, address); DwarfFunctionDebugInfo* function = dynamic_cast(_function); @@ -719,7 +721,7 @@ DwarfImageDebugInfo::GetStatement(FunctionDebugInfo* _function, if (state.isStatement) { statementAddress = state.address; 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(); TRACE_LINES2("DwarfImageDebugInfo::GetStatementAtSourceLocation(%p, " - "(%ld, %ld)): function range: %#llx - %#llx\n", function, - sourceLocation.Line(), sourceLocation.Column(), + "(%" B_PRId32 ", %" B_PRId32 ")): function range: %#" B_PRIx64 " - %#" + B_PRIx64 "\n", function, sourceLocation.Line(), sourceLocation.Column(), functionStartAddress, functionEndAddress); AutoLocker locker(fLock); @@ -778,9 +780,10 @@ DwarfImageDebugInfo::GetStatementAtSourceLocation(FunctionDebugInfo* _function, target_addr_t endAddress = state.address; if (statementAddress < endAddress) { - TRACE_LINES2(" statement: %#llx - %#llx, location: " - "(%ld, %ld)\n", statementAddress, endAddress, statementLine, - statementColumn); + TRACE_LINES2(" statement: %#" B_PRIx64 " - %#" B_PRIx64 + ", location: (%" B_PRId32 ", %" B_PRId32 ")\n", + statementAddress, endAddress, statementLine, + statementColumn); } if (statementAddress < endAddress @@ -812,7 +815,7 @@ DwarfImageDebugInfo::GetStatementAtSourceLocation(FunctionDebugInfo* _function, if (state.isStatement) { statementAddress = state.address; 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 statementColumn = -1; while (program.GetNextRow(state)) { - TRACE_LINES2(" %#llx (%ld, %ld, %ld) %d\n", state.address, - state.file, state.line, state.column, state.isStatement); + TRACE_LINES2(" %#" B_PRIx64 " (%" B_PRId32 ", %" B_PRId32 ", %" + B_PRId32 ") %d\n", state.address, state.file, state.line, + state.column, state.isStatement); bool isOurFile = state.file == fileIndex; @@ -917,9 +921,10 @@ DwarfImageDebugInfo::_AddSourceCodeInfo(CompilationUnit* unit, if (error != B_OK) return error; - TRACE_LINES2(" -> statement: %#llx - %#llx, source location: " - "(%ld, %ld)\n", statementAddress, endAddress, statementLine, - statementColumn); + TRACE_LINES2(" -> statement: %#" B_PRIx64 " - %#" B_PRIx64 + ", source location: (%" B_PRId32 ", %" B_PRId32 ")\n", + statementAddress, endAddress, statementLine, + statementColumn); } statementAddress = 0; @@ -932,7 +937,7 @@ DwarfImageDebugInfo::_AddSourceCodeInfo(CompilationUnit* unit, if (state.isStatement) { statementAddress = state.address; 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, const EntryListWrapper& blockEntries) { - TRACE_LOCALS("DwarfImageDebugInfo::_CreateLocalVariables(): ip: %#llx, " - "low PC: %#llx\n", instructionPointer, lowPC); + TRACE_LOCALS("DwarfImageDebugInfo::_CreateLocalVariables(): ip: %#" B_PRIx64 + ", low PC: %#" B_PRIx64 "\n", instructionPointer, lowPC); // iterate through the variables and add the ones in scope for (DebugInfoEntryList::ConstIterator it = variableEntries.list.GetIterator(); DIEVariable* variableEntry = dynamic_cast(it.Next());) { - TRACE_LOCALS(" variableEntry %p, scope start: %llu\n", variableEntry, - variableEntry->StartScope()); + TRACE_LOCALS(" variableEntry %p, scope start: %" B_PRIu64 "\n", + variableEntry, variableEntry->StartScope()); // check the variable's scope if (instructionPointer < lowPC + variableEntry->StartScope()) diff --git a/src/apps/debugger/debug_info/DwarfTypeFactory.cpp b/src/apps/debugger/debug_info/DwarfTypeFactory.cpp index d6a633dc73..7bd2292985 100644 --- a/src/apps/debugger/debug_info/DwarfTypeFactory.cpp +++ b/src/apps/debugger/debug_info/DwarfTypeFactory.cpp @@ -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. */ @@ -1304,7 +1304,8 @@ DwarfTypeFactory::_ResolveTypeByteSize(DIEType* typeEntry, case DW_TAG_ptr_to_member_type: _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; default: @@ -1327,7 +1328,7 @@ DwarfTypeFactory::_ResolveTypeByteSize(DIEType* typeEntry, _size = size.ToUInt64(); - TRACE_LOCALS(" -> size: %llu\n", _size); + TRACE_LOCALS(" -> size: %" B_PRIu64 "\n", _size); return B_OK; } diff --git a/src/apps/debugger/debug_info/DwarfTypes.cpp b/src/apps/debugger/debug_info/DwarfTypes.cpp index 01450bdf0a..c1544960ce 100644 --- a/src/apps/debugger/debug_info/DwarfTypes.cpp +++ b/src/apps/debugger/debug_info/DwarfTypes.cpp @@ -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. */ @@ -346,7 +346,8 @@ DwarfType::ResolveLocation(DwarfTypeContext* typeContext, // TODO: Use bit size and bit offset, if specified! _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(); } - TRACE_LOCALS("bit field: byte size: %llu, bit offset/size: %llu/%llu\n", - byteSize, bitOffset, bitSize); + TRACE_LOCALS("bit field: byte size: %" B_PRIu64 ", bit offset/size: %" + B_PRIu64 "/%" B_PRIu64 "\n", byteSize, bitOffset, bitSize); if (bitOffset + bitSize > byteSize * 8) 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 // not known), we can only resolve the first element. if (dimensionStride == 0 && index != 0) { - WARNING("No dimension bit stride for dimension %ld and element " - "index is not 0.\n", dimensionIndex); + WARNING("No dimension bit stride for dimension %" B_PRId32 " and " + "element index is not 0.\n", dimensionIndex); return B_BAD_VALUE; } @@ -953,7 +954,7 @@ DwarfArrayType::ResolveElementLocation(const ArrayIndexPath& indexPath, 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 ValueLocation* location = new(std::nothrow) ValueLocation( diff --git a/src/apps/debugger/debugger_interface/DebuggerInterface.cpp b/src/apps/debugger/debugger_interface/DebuggerInterface.cpp index a1c9a05d62..ae3eb33993 100644 --- a/src/apps/debugger/debugger_interface/DebuggerInterface.cpp +++ b/src/apps/debugger/debugger_interface/DebuggerInterface.cpp @@ -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. * Distributed under the terms of the MIT License. */ @@ -266,7 +266,7 @@ DebuggerInterface::Init() // create debugger port 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); if (fDebuggerPort < 0) return fDebuggerPort; @@ -719,8 +719,8 @@ DebuggerInterface::_CreateDebugEvent(int32 messageCode, break; } default: - printf("DebuggerInterface for team %ld: unknown message from " - "kernel: %ld\n", fTeamID, messageCode); + printf("DebuggerInterface for team %" B_PRId32 ": unknown message " + "from kernel: %" B_PRId32 "\n", fTeamID, messageCode); // fall through... case B_DEBUGGER_MESSAGE_TEAM_CREATED: case B_DEBUGGER_MESSAGE_PRE_SYSCALL: diff --git a/src/apps/debugger/dwarf/AbbreviationTable.cpp b/src/apps/debugger/dwarf/AbbreviationTable.cpp index 158a854fec..337e10c26f 100644 --- a/src/apps/debugger/dwarf/AbbreviationTable.cpp +++ b/src/apps/debugger/dwarf/AbbreviationTable.cpp @@ -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. */ @@ -116,8 +116,10 @@ AbbreviationTable::_ParseAbbreviationEntry(DataReader& abbrevReader, return B_NO_MEMORY; fEntryTable.Insert(entry); - } else - fprintf(stderr, "Duplicate abbreviation table entry %lu!\n", code); + } else { + fprintf(stderr, "Duplicate abbreviation table entry %" B_PRIu32 "!\n", + code); + } _nullEntry = false; return B_OK; diff --git a/src/apps/debugger/dwarf/AttributeValue.cpp b/src/apps/debugger/dwarf/AttributeValue.cpp index 2e052ca5ea..67b05f14cd 100644 --- a/src/apps/debugger/dwarf/AttributeValue.cpp +++ b/src/apps/debugger/dwarf/AttributeValue.cpp @@ -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. */ @@ -15,13 +15,14 @@ AttributeValue::ToString(char* buffer, size_t size) { switch (attributeClass) { case ATTRIBUTE_CLASS_ADDRESS: - snprintf(buffer, size, "%#llx", address); + snprintf(buffer, size, "%#" B_PRIx64, address); return buffer; 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; case ATTRIBUTE_CLASS_CONSTANT: - snprintf(buffer, size, "%#llx", constant); + snprintf(buffer, size, "%#" B_PRIx64, constant); return buffer; case ATTRIBUTE_CLASS_FLAG: 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_MACPTR: case ATTRIBUTE_CLASS_RANGELISTPTR: - snprintf(buffer, size, "%#llx", pointer); + snprintf(buffer, size, "%#" B_PRIx64, pointer); return buffer; case ATTRIBUTE_CLASS_REFERENCE: snprintf(buffer, size, "%p", reference); diff --git a/src/apps/debugger/dwarf/DataReader.h b/src/apps/debugger/dwarf/DataReader.h index e6c2e8d765..3b38e802ea 100644 --- a/src/apps/debugger/dwarf/DataReader.h +++ b/src/apps/debugger/dwarf/DataReader.h @@ -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. */ #ifndef DATA_READER_H @@ -100,7 +100,7 @@ public: template Type Read(const Type& defaultValue) { - if (fSize < sizeof(Type)) { + if (fSize < (off_t)sizeof(Type)) { fOverflow = true; fSize = 0; return defaultValue; diff --git a/src/apps/debugger/dwarf/DwarfExpressionEvaluator.cpp b/src/apps/debugger/dwarf/DwarfExpressionEvaluator.cpp index 00256826bd..e1a431d08a 100644 --- a/src/apps/debugger/dwarf/DwarfExpressionEvaluator.cpp +++ b/src/apps/debugger/dwarf/DwarfExpressionEvaluator.cpp @@ -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. */ @@ -267,7 +267,7 @@ status_t DwarfExpressionEvaluator::_Evaluate(ValuePieceLocation* _piece) { TRACE_EXPR_ONLY({ - TRACE_EXPR("DwarfExpressionEvaluator::_Evaluate(%p, %lld)\n", + TRACE_EXPR("DwarfExpressionEvaluator::_Evaluate(%p, %" B_PRIdOFF ")\n", fDataReader.Data(), fDataReader.BytesRemaining()); const uint8* data = (const uint8*)fDataReader.Data(); int32 count = fDataReader.BytesRemaining(); @@ -557,7 +557,7 @@ DwarfExpressionEvaluator::_Evaluate(ValuePieceLocation* _piece) case DW_OP_fbreg: { 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; if (!fContext->GetFrameBaseAddress(address)) { throw EvaluationException( @@ -644,8 +644,8 @@ DwarfExpressionEvaluator::_Evaluate(ValuePieceLocation* _piece) } } else if (opcode >= DW_OP_breg0 && opcode <= DW_OP_breg31) { int64 offset = fDataReader.ReadSignedLEB128(0); - TRACE_EXPR(" DW_OP_breg%u(%lld)\n", opcode - DW_OP_breg0, - offset); + TRACE_EXPR(" DW_OP_breg%u(%" B_PRId64 ")\n", + opcode - DW_OP_breg0, offset); _PushRegister(opcode - DW_OP_breg0, offset); } else { WARNING("DwarfExpressionEvaluator::_Evaluate(): " diff --git a/src/apps/debugger/dwarf/DwarfFile.cpp b/src/apps/debugger/dwarf/DwarfFile.cpp index 636b1fa937..80650ce13e 100644 --- a/src/apps/debugger/dwarf/DwarfFile.cpp +++ b/src/apps/debugger/dwarf/DwarfFile.cpp @@ -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. * Distributed under the terms of the MIT License. */ @@ -134,7 +134,7 @@ public: if (error != B_OK) return false; - TRACE_EXPR(" -> frame base: %llx\n", fFrameBasePointer); + TRACE_EXPR(" -> frame base: %" B_PRIx64 "\n", fFrameBasePointer); _address = fFrameBasePointer; return true; @@ -420,9 +420,9 @@ DwarfFile::Load(const char* fileName) break; } - TRACE_DIE("DWARF%d compilation unit: version %d, length: %lld, " - "abbrevOffset: %lld, address size: %d\n", dwarf64 ? 64 : 32, - version, unitLength, abbrevOffset, addressSize); + TRACE_DIE("DWARF%d compilation unit: version %d, length: %" B_PRIu64 + ", abbrevOffset: %" B_PRIdOFF ", address size: %d\n", + dwarf64 ? 64 : 32, version, unitLength, abbrevOffset, addressSize); if (version != 2 && version != 3) { WARNING("\"%s\": Unsupported compilation unit version: %d\n", @@ -818,7 +818,7 @@ DwarfFile::_ParseCompilationUnit(CompilationUnit* unit) unit->SetUnitEntry(unitEntry); TRACE_DIE_ONLY( - TRACE_DIE("remaining bytes in unit: %lld\n", + TRACE_DIE("remaining bytes in unit: %" B_PRIdOFF "\n", dataReader.BytesRemaining()); if (dataReader.HasData()) { TRACE_DIE(" "); @@ -853,7 +853,7 @@ DwarfFile::_ParseDebugInfoEntry(DataReader& dataReader, // get the corresponding abbreviation entry AbbreviationEntry 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; } @@ -861,17 +861,17 @@ DwarfFile::_ParseDebugInfoEntry(DataReader& dataReader, status_t error = fDebugInfoFactory.CreateDebugInfoEntry( abbreviationEntry.Tag(), entry); if (error != B_OK) { - WARNING("Failed to generate entry for tag %lu, code %lu\n", - abbreviationEntry.Tag(), code); + WARNING("Failed to generate entry for tag %" B_PRIu32 ", code %" + B_PRIu32 "\n", abbreviationEntry.Tag(), code); return error; } ObjectDeleter entryDeleter(entry); - TRACE_DIE("%*sentry %p at %lld: %lu, tag: %s (%lu), children: %d\n", - level * 2, "", entry, entryOffset, abbreviationEntry.Code(), - get_entry_tag_name(abbreviationEntry.Tag()), abbreviationEntry.Tag(), - abbreviationEntry.HasChildren()); + TRACE_DIE("%*sentry %p at %" B_PRIdOFF ": %" B_PRIu32 ", tag: %s (%" + B_PRIu32 "), children: %d\n", level * 2, "", entry, entryOffset, + abbreviationEntry.Code(), get_entry_tag_name(abbreviationEntry.Tag()), + abbreviationEntry.Tag(), abbreviationEntry.HasChildren()); error = fCurrentCompilationUnit->AddDebugInfoEntry(entry, entryOffset); if (error != B_OK) @@ -943,7 +943,7 @@ DwarfFile::_FinishCompilationUnit(CompilationUnit* unit) off_t 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 dataReader.SeekAbsolute(offset); @@ -1069,7 +1069,8 @@ DwarfFile::_ParseEntryAttributes(DataReader& dataReader, ? (off_t)dataReader.Read(0) : (off_t)dataReader.Read(0); 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; } attributeValue.SetToString( @@ -1106,7 +1107,8 @@ DwarfFile::_ParseEntryAttributes(DataReader& dataReader, break; case DW_FORM_indirect: default: - WARNING("Unsupported attribute form: %lu\n", attributeForm); + WARNING("Unsupported attribute form: %" B_PRIu32 "\n", + attributeForm); return B_BAD_DATA; } @@ -1115,10 +1117,10 @@ DwarfFile::_ParseEntryAttributes(DataReader& dataReader, uint8 attributeClass = get_attribute_class(attributeName, attributeForm); if (attributeClass == ATTRIBUTE_CLASS_UNKNOWN) { - TRACE_DIE("skipping attribute with unrecognized class: %s (%#lx) " - "%s (%#lx)\n", get_attribute_name_name(attributeName), - attributeName, get_attribute_form_name(attributeForm), - attributeForm); + TRACE_DIE("skipping attribute with unrecognized class: %s (%#" + B_PRIx32 ") %s (%#" B_PRIx32 ")\n", + get_attribute_name_name(attributeName), attributeName, + get_attribute_form_name(attributeForm), attributeForm); continue; } // attributeValue.attributeClass = attributeClass; @@ -1158,8 +1160,8 @@ DwarfFile::_ParseEntryAttributes(DataReader& dataReader, if (attributeName == DW_AT_sibling) continue; - WARNING("Failed to resolve reference: %s (%#lx) " - "%s (%#lx): value: %llu\n", + WARNING("Failed to resolve reference: %s (%#" B_PRIx32 + ") %s (%#" B_PRIx32 "): value: %" B_PRIu64 "\n", get_attribute_name_name(attributeName), attributeName, get_attribute_form_name(attributeForm), @@ -1220,7 +1222,8 @@ DwarfFile::_ParseLineInfo(CompilationUnit* unit) { 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, fDebugLineSection->Size() - offset, unit->AddressSize()); @@ -1268,9 +1271,9 @@ DwarfFile::_ParseLineInfo(CompilationUnit* unit) if (version != 2 && version != 3) return B_UNSUPPORTED; - TRACE_LINES(" unitLength: %llu\n", unitLength); + TRACE_LINES(" unitLength: %" B_PRIu64 "\n", unitLength); 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(" defaultIsStatement: %d\n", defaultIsStatement); TRACE_LINES(" lineBase: %d\n", lineBase); @@ -1302,8 +1305,9 @@ DwarfFile::_ParseLineInfo(CompilationUnit* unit) if (dataReader.HasOverflow()) return B_BAD_DATA; - TRACE_LINES(" \"%s\", dir index: %llu, mtime: %llu, length: %llu\n", - file, dirIndex, modificationTime, fileLength); + TRACE_LINES(" \"%s\", dir index: %" B_PRIu64 ", mtime: %" B_PRIu64 + ", length: %" B_PRIu64 "\n", file, dirIndex, modificationTime, + fileLength); if (!unit->AddFile(file, dirIndex)) return B_NO_MEMORY; @@ -1343,7 +1347,7 @@ DwarfFile::_UnwindCallFrame(bool usingEHFrameSection, CompilationUnit* unit, // 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(), currentFrameSection->Size(), unit->AddressSize()); @@ -1426,8 +1430,9 @@ DwarfFile::_UnwindCallFrame(bool usingEHFrameSection, CompilationUnit* unit, cieID = lengthOffset - cieID; } - TRACE_CFI(" found fde: length: %llu (%lld), CIE offset: %#llx, " - "location: %#llx, range: %#llx\n", length, remaining, cieID, + TRACE_CFI(" found fde: length: %" B_PRIu64 " (%" B_PRIdOFF + "), CIE offset: %#" B_PRIx64 ", location: %#" B_PRIx64 ", " + "range: %#" B_PRIx64 "\n", length, remaining, cieID, initialLocation, addressRange); CfaContext context(location, initialLocation); @@ -1505,11 +1510,11 @@ DwarfFile::_UnwindCallFrame(bool usingEHFrameSection, CompilationUnit* unit, return B_BAD_VALUE; } - TRACE_CFI(" frame address: %#llx\n", frameAddress); + TRACE_CFI(" frame address: %#" B_PRIx64 "\n", frameAddress); // apply the register rules 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); if (valueType == 0) @@ -1532,8 +1537,8 @@ DwarfFile::_UnwindCallFrame(bool usingEHFrameSection, CompilationUnit* unit, } case CFA_RULE_LOCATION_OFFSET: { - TRACE_CFI(" -> CFA_RULE_LOCATION_OFFSET: %lld\n", - rule->Offset()); + TRACE_CFI(" -> CFA_RULE_LOCATION_OFFSET: %" + B_PRId64 "\n", rule->Offset()); BVariant value; if (inputInterface->ReadValueFromMemory( @@ -1642,8 +1647,8 @@ DwarfFile::_ParseCIE(ElfSection* debugFrameSection, bool usingEHFrameSection, uint8 version = dataReader.Read(0); if (version != 1) { - TRACE_CFI(" cie: length: %llu, offset: %#llx, version: %u " - "-- unsupported\n", length, cieOffset, version); + TRACE_CFI(" cie: length: %" B_PRIu64 ", offset: %#" B_PRIx64 ", " + "version: %u -- unsupported\n", length, (uint64)cieOffset, version); return B_UNSUPPORTED; } @@ -1660,16 +1665,18 @@ DwarfFile::_ParseCIE(ElfSection* debugFrameSection, bool usingEHFrameSection, context.SetDataAlignment(dataReader.ReadSignedLEB128(0)); context.SetReturnAddressRegister(dataReader.ReadUnsignedLEB128(0)); - TRACE_CFI(" cie: length: %llu, offset: %#llx, version: %u, augmentation: " - "\"%s\", aligment: code: %lu, data: %ld, return address reg: %lu\n", - length, cieOffset, version, cieAugmentation.String(), + TRACE_CFI(" cie: length: %" B_PRIu64 ", offset: %#" B_PRIx64 ", version: " + "%u, augmentation: \"%s\", aligment: code: %" B_PRIu32 ", data: %" + B_PRId32 ", return address reg: %" B_PRIu32 "\n", length, + (uint64)cieOffset, version, cieAugmentation.String(), context.CodeAlignment(), context.DataAlignment(), context.ReturnAddressRegister()); status_t error = cieAugmentation.Read(dataReader); if (error != B_OK) { - TRACE_CFI(" cie: length: %llu, version: %u, augmentation: \"%s\" " - "-- unsupported\n", length, version, cieAugmentation.String()); + TRACE_CFI(" cie: length: %" B_PRIu64 ", version: %u, augmentation: " + "\"%s\" -- unsupported\n", length, version, + cieAugmentation.String()); return error; } @@ -1690,7 +1697,7 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit, CfaContext& context, DataReader& dataReader) { while (dataReader.BytesRemaining() > 0) { - TRACE_CFI(" [%2lld]", dataReader.BytesRemaining()); + TRACE_CFI(" [%2" B_PRId64 "]", dataReader.BytesRemaining()); uint8 opcode = dataReader.Read(0); if ((opcode >> 6) != 0) { @@ -1699,7 +1706,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit, switch (opcode >> 6) { 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() + operand * context.CodeAlignment(); @@ -1711,8 +1719,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit, case DW_CFA_offset: { uint64 offset = dataReader.ReadUnsignedLEB128(0); - TRACE_CFI(" DW_CFA_offset: reg: %lu, offset: %llu\n", - operand, offset); + TRACE_CFI(" DW_CFA_offset: reg: %" B_PRIu32 ", offset: " + "%" B_PRIu64 "\n", operand, offset); if (CfaRule* rule = context.RegisterRule(operand)) { rule->SetToLocationOffset( @@ -1722,7 +1730,7 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit, } case DW_CFA_restore: { - TRACE_CFI(" DW_CFA_restore: %#lx\n", operand); + TRACE_CFI(" DW_CFA_restore: %#" B_PRIx32 "\n", operand); context.RestoreRegisterRule(operand); break; @@ -1739,7 +1747,7 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit, { 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()) return B_BAD_VALUE; @@ -1752,7 +1760,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit, { uint32 delta = dataReader.Read(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() + delta * context.CodeAlignment(); @@ -1765,7 +1774,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit, { uint32 delta = dataReader.Read(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() + delta * context.CodeAlignment(); @@ -1778,7 +1788,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit, { uint32 delta = dataReader.Read(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() + delta * context.CodeAlignment(); @@ -1792,8 +1803,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit, uint32 reg = dataReader.ReadUnsignedLEB128(0); uint64 offset = dataReader.ReadUnsignedLEB128(0); - TRACE_CFI(" DW_CFA_offset_extended: reg: %lu, " - "offset: %llu\n", reg, offset); + TRACE_CFI(" DW_CFA_offset_extended: reg: %" B_PRIu32 ", " + "offset: %" B_PRIu64 "\n", reg, offset); if (CfaRule* rule = context.RegisterRule(reg)) { rule->SetToLocationOffset( @@ -1805,7 +1816,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit, { 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); break; @@ -1814,7 +1826,7 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit, { 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)) rule->SetToUndefined(); @@ -1824,7 +1836,7 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit, { 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)) rule->SetToSameValue(); @@ -1835,7 +1847,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit, uint32 reg1 = 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)) rule->SetToValueOffset(reg2); @@ -1864,8 +1877,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit, uint32 reg = dataReader.ReadUnsignedLEB128(0); uint64 offset = dataReader.ReadUnsignedLEB128(0); - TRACE_CFI(" DW_CFA_def_cfa: reg: %lu, offset: %llu\n", - reg, offset); + TRACE_CFI(" DW_CFA_def_cfa: reg: %" B_PRIu32 ", offset: " + "%" B_PRIu64 "\n", reg, offset); context.GetCfaCfaRule()->SetToRegisterOffset(reg, offset); break; @@ -1874,7 +1887,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit, { 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() != CFA_CFA_RULE_REGISTER_OFFSET) { @@ -1887,7 +1901,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit, { 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() != CFA_CFA_RULE_REGISTER_OFFSET) { @@ -1902,8 +1917,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit, uint8* block = (uint8*)dataReader.Data(); dataReader.Skip(blockLength); - TRACE_CFI(" DW_CFA_def_cfa_expression: %p, %llu\n", - block, blockLength); + TRACE_CFI(" DW_CFA_def_cfa_expression: %p, %" B_PRIu64 + "\n", block, blockLength); context.GetCfaCfaRule()->SetToExpression(block, blockLength); @@ -1916,8 +1931,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit, uint8* block = (uint8*)dataReader.Data(); dataReader.Skip(blockLength); - TRACE_CFI(" DW_CFA_expression: reg: %lu, block: %p, " - "%llu\n", reg, block, blockLength); + TRACE_CFI(" DW_CFA_expression: reg: %" B_PRIu32 ", " + "block: %p, %" B_PRIu64 "\n", reg, block, blockLength); if (CfaRule* rule = context.RegisterRule(reg)) rule->SetToLocationExpression(block, blockLength); @@ -1928,8 +1943,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit, uint32 reg = dataReader.ReadUnsignedLEB128(0); int64 offset = dataReader.ReadSignedLEB128(0); - TRACE_CFI(" DW_CFA_offset_extended: reg: %lu, " - "offset: %lld\n", reg, offset); + TRACE_CFI(" DW_CFA_offset_extended: reg: %" B_PRIu32 ", " + "offset: %" B_PRId64 "\n", reg, offset); if (CfaRule* rule = context.RegisterRule(reg)) { rule->SetToLocationOffset( @@ -1942,8 +1957,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit, uint32 reg = dataReader.ReadUnsignedLEB128(0); int64 offset = dataReader.ReadSignedLEB128(0); - TRACE_CFI(" DW_CFA_def_cfa_sf: reg: %lu, offset: %lld\n", - reg, offset); + TRACE_CFI(" DW_CFA_def_cfa_sf: reg: %" B_PRIu32 ", " + "offset: %" B_PRId64 "\n", reg, offset); context.GetCfaCfaRule()->SetToRegisterOffset(reg, offset * (int32)context.DataAlignment()); @@ -1953,7 +1968,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit, { 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() != CFA_CFA_RULE_REGISTER_OFFSET) { @@ -1968,8 +1984,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit, uint32 reg = dataReader.ReadUnsignedLEB128(0); uint64 offset = dataReader.ReadUnsignedLEB128(0); - TRACE_CFI(" DW_CFA_val_offset: reg: %lu, offset: %llu\n", - reg, offset); + TRACE_CFI(" DW_CFA_val_offset: reg: %" B_PRIu32 ", " + "offset: %" B_PRIu64 "\n", reg, offset); if (CfaRule* rule = context.RegisterRule(reg)) { rule->SetToValueOffset( @@ -1982,8 +1998,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit, uint32 reg = dataReader.ReadUnsignedLEB128(0); int64 offset = dataReader.ReadSignedLEB128(0); - TRACE_CFI(" DW_CFA_val_offset_sf: reg: %lu, " - "offset: %lld\n", reg, offset); + TRACE_CFI(" DW_CFA_val_offset_sf: reg: %" B_PRIu32 ", " + "offset: %" B_PRId64 "\n", reg, offset); if (CfaRule* rule = context.RegisterRule(reg)) { rule->SetToValueOffset( @@ -1998,8 +2014,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit, uint8* block = (uint8*)dataReader.Data(); dataReader.Skip(blockLength); - TRACE_CFI(" DW_CFA_val_expression: reg: %lu, block: %p, " - "%llu\n", reg, block, blockLength); + TRACE_CFI(" DW_CFA_val_expression: reg: %" B_PRIu32 ", " + "block: %p, %" B_PRIu64 "\n", reg, block, blockLength); if (CfaRule* rule = context.RegisterRule(reg)) rule->SetToValueExpression(block, blockLength); @@ -2011,7 +2027,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit, { uint64 delta = dataReader.Read(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() + delta * context.CodeAlignment(); @@ -2034,7 +2051,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit, TRACE_CFI_ONLY(uint64 size =) 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! break; } @@ -2045,7 +2063,8 @@ DwarfFile::_ParseFrameInfoInstructions(CompilationUnit* unit, int64 offset = dataReader.ReadSignedLEB128(0); 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)) { rule->SetToLocationOffset( @@ -2125,7 +2144,8 @@ DwarfFile::_ParsePublicTypesInfo(DataReader& dataReader, bool dwarf64) return B_BAD_DATA; 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) { off_t entryOffset = dwarf64 @@ -2136,7 +2156,7 @@ DwarfFile::_ParsePublicTypesInfo(DataReader& dataReader, bool dwarf64) 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; diff --git a/src/apps/debugger/model/Team.cpp b/src/apps/debugger/model/Team.cpp index 6e2fad0771..d4868ee11f 100644 --- a/src/apps/debugger/model/Team.cpp +++ b/src/apps/debugger/model/Team.cpp @@ -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. */ @@ -367,7 +367,7 @@ status_t Team::GetStatementAtAddress(target_addr_t address, FunctionInstance*& _function, Statement*& _statement) { - TRACE_CODE("Team::GetStatementAtAddress(%#llx)\n", address); + TRACE_CODE("Team::GetStatementAtAddress(%#" B_PRIx64 ")\n", address); // get the image at the address Image* image = ImageByAddress(address); @@ -422,8 +422,8 @@ status_t Team::GetStatementAtSourceLocation(SourceCode* sourceCode, const SourceLocation& location, Statement*& _statement) { - TRACE_CODE("Team::GetStatementAtSourceLocation(%p, (%ld, %ld))\n", - sourceCode, location.Line(), location.Column()); + TRACE_CODE("Team::GetStatementAtSourceLocation(%p, (%" B_PRId32 ", %" + B_PRId32 "))\n", sourceCode, location.Line(), location.Column()); // If we're lucky the source code can provide us with a statement. if (DisassembledCode* code = dynamic_cast(sourceCode)) { diff --git a/src/apps/debugger/model/TypeComponentPath.cpp b/src/apps/debugger/model/TypeComponentPath.cpp index 286e6031ec..0377e29762 100644 --- a/src/apps/debugger/model/TypeComponentPath.cpp +++ b/src/apps/debugger/model/TypeComponentPath.cpp @@ -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. */ @@ -82,13 +82,13 @@ TypeComponent::Dump() const printf("undefined"); break; case TYPE_COMPONENT_BASE_TYPE: - printf("base %llu \"%s\"", index, name.String()); + printf("base %" B_PRIu64 " \"%s\"", index, name.String()); break; case TYPE_COMPONENT_DATA_MEMBER: - printf("member %llu \"%s\"", index, name.String()); + printf("member %" B_PRIu64 " \"%s\"", index, name.String()); break; case TYPE_COMPONENT_ARRAY_ELEMENT: - printf("element %llu \"%s\"", index, name.String()); + printf("element %" B_PRIu64 " \"%s\"", index, name.String()); break; } } diff --git a/src/apps/debugger/model/TypeComponentPath.h b/src/apps/debugger/model/TypeComponentPath.h index 5df4649052..0ded421df1 100644 --- a/src/apps/debugger/model/TypeComponentPath.h +++ b/src/apps/debugger/model/TypeComponentPath.h @@ -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. */ #ifndef TYPE_COMPONENT_PATH_H diff --git a/src/apps/debugger/types/ValueLocation.cpp b/src/apps/debugger/types/ValueLocation.cpp index 453de97a28..887b63bf5e 100644 --- a/src/apps/debugger/types/ValueLocation.cpp +++ b/src/apps/debugger/types/ValueLocation.cpp @@ -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. */ @@ -240,7 +240,7 @@ void ValueLocation::Dump() const { int32 count = fPieces.Size(); - printf("ValueLocation: %s endian, %ld pieces:\n", + printf("ValueLocation: %s endian, %" B_PRId32 " pieces:\n", fBigEndian ? "big" : "little", count); for (int32 i = 0; i < count; i++) { @@ -253,14 +253,14 @@ ValueLocation::Dump() const printf(" unknown"); break; case VALUE_PIECE_LOCATION_MEMORY: - printf(" address %#llx", piece.address); + printf(" address %#" B_PRIx64, piece.address); break; case VALUE_PIECE_LOCATION_REGISTER: - printf(" register %lu", piece.reg); + printf(" register %" B_PRIu32, piece.reg); break; } - printf(" size: %llu (%llu bits), offset: %llu bits\n", piece.size, - piece.bitSize, piece.bitOffset); + printf(" size: %" B_PRIu64 " (%" B_PRIu64 " bits), offset: %" B_PRIu64 + " bits\n", piece.size, piece.bitSize, piece.bitOffset); } } diff --git a/src/apps/debugger/types/ValueLocation.h b/src/apps/debugger/types/ValueLocation.h index 5b598d9cdc..1ff9f6116e 100644 --- a/src/apps/debugger/types/ValueLocation.h +++ b/src/apps/debugger/types/ValueLocation.h @@ -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. */ #ifndef VALUE_LOCATION_H diff --git a/src/apps/debugger/user_interface/gui/inspector_window/MemoryView.cpp b/src/apps/debugger/user_interface/gui/inspector_window/MemoryView.cpp index 5164c14447..9717a18dcf 100644 --- a/src/apps/debugger/user_interface/gui/inspector_window/MemoryView.cpp +++ b/src/apps/debugger/user_interface/gui/inspector_window/MemoryView.cpp @@ -161,7 +161,7 @@ MemoryView::Draw(BRect rect) const char* blockAddress = currentAddress + (j * blockByteSize); _GetNextHexBlock(buffer, - std::min(hexBlockSize, sizeof(buffer)), + std::min((size_t)hexBlockSize, sizeof(buffer)), blockAddress); DrawString(buffer, drawPoint); if (targetAddress >= blockAddress && targetAddress < diff --git a/src/apps/debugger/user_interface/gui/team_window/RegistersView.cpp b/src/apps/debugger/user_interface/gui/team_window/RegistersView.cpp index a2349e0089..b6e0c0dd8b 100644 --- a/src/apps/debugger/user_interface/gui/team_window/RegistersView.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/RegistersView.cpp @@ -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. * Distributed under the terms of the MIT License. */ @@ -96,12 +96,14 @@ private: break; case B_INT32_TYPE: case B_UINT32_TYPE: - snprintf(buffer, bufferSize, "0x%08lx", value.ToUInt32()); + snprintf(buffer, bufferSize, "0x%08" B_PRIx32, + value.ToUInt32()); break; case B_INT64_TYPE: case B_UINT64_TYPE: default: - snprintf(buffer, bufferSize, "0x%016llx", value.ToUInt64()); + snprintf(buffer, bufferSize, "0x%016" B_PRIx64, + value.ToUInt64()); break; } diff --git a/src/apps/debugger/user_interface/gui/team_window/SourceView.cpp b/src/apps/debugger/user_interface/gui/team_window/SourceView.cpp index 831c0895f9..24a515044c 100644 --- a/src/apps/debugger/user_interface/gui/team_window/SourceView.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/SourceView.cpp @@ -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. * Distributed under the terms of the MIT License. */ @@ -384,7 +384,7 @@ SourceView::BaseView::GetLineRange(BRect rect, int32& minLine, int32 lineHeight = (int32)fFontInfo->lineHeight; minLine = (int32)rect.top / 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); } @@ -1772,7 +1772,7 @@ SourceView::UserBreakpointChanged(UserBreakpoint* breakpoint) bool SourceView::ScrollToAddress(target_addr_t address) { - TRACE_GUI("SourceView::ScrollToAddress(%#llx)\n", address); + TRACE_GUI("SourceView::ScrollToAddress(%#" B_PRIx64 ")\n", address); if (fSourceCode == NULL) return false; @@ -1794,7 +1794,7 @@ SourceView::ScrollToAddress(target_addr_t address) bool 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()) return false; @@ -1804,7 +1804,7 @@ SourceView::ScrollToLine(uint32 line) 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, visible.top, visible.right, visible.bottom, top, bottom); diff --git a/src/apps/debugger/user_interface/gui/team_window/StackTraceView.cpp b/src/apps/debugger/user_interface/gui/team_window/StackTraceView.cpp index 70cb01afe2..698c9a2f8a 100644 --- a/src/apps/debugger/user_interface/gui/team_window/StackTraceView.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/StackTraceView.cpp @@ -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. * Distributed under the terms of the MIT License. */ @@ -95,7 +95,7 @@ public: } char offset[32]; - snprintf(offset, sizeof(offset), " + %#llx", + snprintf(offset, sizeof(offset), " + %#" B_PRIx64, frame->InstructionPointer() - baseAddress); name << offset; diff --git a/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp b/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp index 9c0338ce37..4da2045c39 100644 --- a/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp @@ -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. * Distributed under the terms of the MIT License. */ @@ -1191,7 +1191,8 @@ TeamWindow::_HandleStackTraceChanged(thread_id threadID) void 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 if (fActiveImage == NULL || imageID != fActiveImage->ID()) diff --git a/src/apps/debugger/user_interface/gui/util/TargetAddressTableColumn.cpp b/src/apps/debugger/user_interface/gui/util/TargetAddressTableColumn.cpp index 8c5f6adca7..aa11674863 100644 --- a/src/apps/debugger/user_interface/gui/util/TargetAddressTableColumn.cpp +++ b/src/apps/debugger/user_interface/gui/util/TargetAddressTableColumn.cpp @@ -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. */ @@ -23,7 +23,7 @@ BField* TargetAddressTableColumn::PrepareField(const BVariant& value) const { char buffer[64]; - snprintf(buffer, sizeof(buffer), "%#llx", value.ToUInt64()); + snprintf(buffer, sizeof(buffer), "%#" B_PRIx64, value.ToUInt64()); return StringTableColumn::PrepareField( BVariant(buffer, B_VARIANT_DONT_COPY_DATA)); diff --git a/src/apps/debugger/util/IntegerFormatter.cpp b/src/apps/debugger/util/IntegerFormatter.cpp index 8ae05d1217..c6c70df5cd 100644 --- a/src/apps/debugger/util/IntegerFormatter.cpp +++ b/src/apps/debugger/util/IntegerFormatter.cpp @@ -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. * 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()); break; case INTEGER_FORMAT_HEX_32: - snprintf(buffer, bufferSize, "%#lx", (uint32)value.ToUInt64()); + snprintf(buffer, bufferSize, "%#" B_PRIx32, + (uint32)value.ToUInt64()); break; case INTEGER_FORMAT_HEX_64: default: - snprintf(buffer, bufferSize, "%#llx", value.ToUInt64()); + snprintf(buffer, bufferSize, "%#" B_PRIx64, value.ToUInt64()); break; } diff --git a/src/apps/debugger/value/ValueLoader.cpp b/src/apps/debugger/value/ValueLoader.cpp index 5c6232de65..81b7bfb22e 100644 --- a/src/apps/debugger/value/ValueLoader.cpp +++ b/src/apps/debugger/value/ValueLoader.cpp @@ -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. */ @@ -77,7 +77,7 @@ ValueLoader::LoadValue(ValueLocation* location, type_code valueType, } 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); return B_UNSUPPORTED; } @@ -85,7 +85,7 @@ ValueLoader::LoadValue(ValueLocation* location, type_code valueType, totalBitSize += piece.bitSize; } - TRACE_LOCALS(" -> totalBitSize: %llu\n", totalBitSize); + TRACE_LOCALS(" -> totalBitSize: %" B_PRIu64 "\n", totalBitSize); if (totalBitSize == 0) { TRACE_LOCALS(" -> no size\n"); @@ -99,8 +99,8 @@ ValueLoader::LoadValue(ValueLocation* location, type_code valueType, uint64 valueBitSize = BVariant::SizeOfType(valueType) * 8; if (!shortValueIsFine && totalBitSize < valueBitSize) { - TRACE_LOCALS(" -> too short for value type (%llu vs. %llu bits)\n", - totalBitSize, valueBitSize); + TRACE_LOCALS(" -> too short for value type (%" B_PRIu64 " vs. %" + B_PRIu64 " bits)\n", totalBitSize, valueBitSize); return B_BAD_VALUE; } @@ -130,8 +130,8 @@ ValueLoader::LoadValue(ValueLocation* location, type_code valueType, { target_addr_t address = piece.address; - TRACE_LOCALS(" piece %ld: memory address: %#llx, bits: %lu\n", - i, address, bitSize); + TRACE_LOCALS(" piece %" B_PRId32 ": memory address: %#" + B_PRIx64 ", bits: %" B_PRIu32 "\n", i, address, bitSize); uint8 pieceBuffer[kMaxPieceSize]; ssize_t bytesRead = fTeamMemory->ReadMemory(address, @@ -161,8 +161,8 @@ ValueLoader::LoadValue(ValueLocation* location, type_code valueType, } case VALUE_PIECE_LOCATION_REGISTER: { - TRACE_LOCALS(" piece %ld: register: %lu, bits: %lu\n", i, - piece.reg, bitSize); + TRACE_LOCALS(" piece %" B_PRId32 ": register: %" B_PRIu32 + ", bits: %" B_PRIu32 "\n", i, piece.reg, bitSize); if (fCpuState == NULL) { WARNING("ValueLoader::LoadValue(): register piece, but no " diff --git a/src/apps/debugger/value/value_nodes/BMessageValueNode.cpp b/src/apps/debugger/value/value_nodes/BMessageValueNode.cpp index b805a35332..d53f87093a 100644 --- a/src/apps/debugger/value/value_nodes/BMessageValueNode.cpp +++ b/src/apps/debugger/value/value_nodes/BMessageValueNode.cpp @@ -255,8 +255,8 @@ BMessageValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader, return B_NO_MEMORY; error = valueLoader->LoadRawValue(headerAddress, sizeof( BMessage::message_header), fHeader); - TRACE_LOCALS("BMessage: Header Address: 0x%" B_PRIx64 ", result: %ld\n", - headerAddress.ToUInt64(), error); + TRACE_LOCALS("BMessage: Header Address: 0x%" B_PRIx64 ", result: %s\n", + headerAddress.ToUInt64(), strerror(error)); if (error != B_OK) return error; @@ -269,15 +269,16 @@ BMessageValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader, else fHeader->what = what.ToUInt32(); - TRACE_LOCALS("BMessage: what: 0x%" B_PRIx32 ", result: %ld\n", - what.ToUInt32(), error); + TRACE_LOCALS("BMessage: what: 0x%" B_PRIx32 ", result: %s\n", + what.ToUInt32(), strerror(error)); size_t fieldsSize = fHeader->field_count * sizeof( BMessage::field_header); if (fIsFlatMessage) 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]; if (messageBuffer == NULL) return B_NO_MEMORY; @@ -296,7 +297,7 @@ BMessageValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader, error = valueLoader->LoadRawValue(fieldAddress, fieldsSize, fFields); 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) return error; @@ -307,7 +308,7 @@ BMessageValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader, error = valueLoader->LoadRawValue(fDataLocation, fHeader->data_size, fData); 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) return error; memcpy(tempBuffer, fFields, fieldsSize); @@ -710,7 +711,7 @@ BMessageValueNode::BMessageFieldNodeChild::BMessageFieldNodeChild( fType->AcquireReference(); if (fFieldIndex >= 0) - fPresentationName.SetToFormat("[%ld]", fFieldIndex); + fPresentationName.SetToFormat("[%" B_PRId32 "]", fFieldIndex); } diff --git a/src/apps/debugger/value/value_nodes/CompoundValueNode.cpp b/src/apps/debugger/value/value_nodes/CompoundValueNode.cpp index ee375de417..6e208e754a 100644 --- a/src/apps/debugger/value/value_nodes/CompoundValueNode.cpp +++ b/src/apps/debugger/value/value_nodes/CompoundValueNode.cpp @@ -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. */ @@ -198,7 +198,7 @@ CompoundValueNode::CreateChildren() // base types 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); if (child == NULL || !fChildren.AddItem(child)) { @@ -211,7 +211,7 @@ CompoundValueNode::CreateChildren() // members 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); if (child == NULL || !fChildren.AddItem(child)) { diff --git a/src/apps/debugger/value/values/AddressValue.cpp b/src/apps/debugger/value/values/AddressValue.cpp index 0e90bbc4a7..5495b270f1 100644 --- a/src/apps/debugger/value/values/AddressValue.cpp +++ b/src/apps/debugger/value/values/AddressValue.cpp @@ -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. */ @@ -28,7 +28,7 @@ AddressValue::ToString(BString& _string) const return false; char buffer[32]; - snprintf(buffer, sizeof(buffer), "%#llx", fValue.ToUInt64()); + snprintf(buffer, sizeof(buffer), "%#" B_PRIx64, fValue.ToUInt64()); BString string(buffer); if (string.Length() == 0) diff --git a/src/bin/debug/debug_utils.cpp b/src/bin/debug/debug_utils.cpp index 8ce6ec0cfa..fa9d431b43 100644 --- a/src/bin/debug/debug_utils.cpp +++ b/src/bin/debug/debug_utils.cpp @@ -176,7 +176,7 @@ continue_thread(port_id nubPort, thread_id thread) return; 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)); exit(1); }