This changes all reporting of addresses from lldb-mi to be 64 bit capable. There could have been cases where a 64 bit address was getting truncated to 32 bit format.
Patch from chuckr@microsoft.com
Differential D8238
expose 64 bit addresses through MI ki.stfu on Mar 10 2015, 4:47 PM. Authored by
Details This changes all reporting of addresses from lldb-mi to be 64 bit capable. There could have been cases where a 64 bit address was getting truncated to 32 bit format. Patch from chuckr@microsoft.com
Diff Detail Event TimelineComment Actions Hi Chuck, can you resubmit this patch attached to the other review? The
against origin (or whatever you created the *original* patch against), not
default value is "Create new revision". Change this to "Attach to existing Comment Actions Should we print address as "%016llx" everywhere? Previously I supposed that we should use %08llx for 32bit & %016llx for 64bit app. Comment Actions As you may understood, I'm not sure about this patch. Comment Actions I also thought about that when testing the patch. The address in some frame was printed as 32-bit. It will be a good cleanup going forward. Comment Actions These are the files that have the string '%08' in them, should I fix all of them up as part of this patch? .//MICmdCmdBreak.cpp: // "^done,bkpt={number=\"%d\",type=\"breakpoint\",disp=\"%s\",enabled=\"%c\",addr=\"0x%08x\",func=\"%s\",file=\"%s\",fullname=\"%s/%s\",line=\"%d\",thread-groups=[\"%s\"],times=\"%d\",original-location=\"%s\"}" .//MICmdCmdData.cpp: // MI "{address=\"0x%08llx\",func-name=\"%s\",offset=\"%lld\",inst=\"%s %s\"}" .//MICmdCmdData.cpp: const CMICmnMIValueConst miValueConst(CMIUtilString::Format("0x%08llx", addr)); .//MICmdCmdData.cpp: // MI: memory=[{begin=\"0x%08x\",offset=\"0x%08x\",end=\"0x%08x\",contents=\" \" }]" .//MICmdCmdData.cpp: const CMICmnMIValueConst miValueConst(CMIUtilString::Format("0x%08llx", m_nAddrStart)); .//MICmdCmdData.cpp: const CMICmnMIValueConst miValueConst2(CMIUtilString::Format("0x%08llx", m_nAddrOffset)); .//MICmdCmdData.cpp: const CMICmnMIValueConst miValueConst3(CMIUtilString::Format("0x%08llx", m_nAddrStart + m_nAddrNumBytesToRead)); .//MICmdCmdGdbInfo.cpp: rStdout.TextToStdout(CMIUtilString::Format("~\"0x%08x\t0x%08x\t%s\t\t%s\"", addrLoadS, addrLoadS + addrLoadSize, .//MICmnLLDBDebuggerHandleEvents.cpp: // MI print "=breakpoint-modified,bkpt={number=\"%d\",type=\"breakpoint\",disp=\"%s\",enabled=\"%c\",addr=\"0x%08x\", .//MICmnLLDBDebuggerHandleEvents.cpp: // "=breakpoint-modified,bkpt={number=\"%d\",type=\"breakpoint\",disp=\"%s\",enabled=\"%c\",addr=\"0x%08x\",func=\"%s\",file=\"%s\",fullname=\"%s/%s\",line=\"%d\",times=\"%d\",original-location=\"%s\"}" .//MICmnLLDBDebuggerHandleEvents.cpp: // "=breakpoint-created,bkpt={number=\"%d\",type=\"breakpoint\",disp=\"%s\",enabled=\"%c\",addr=\"0x%08x\",func=\"%s\",file=\"%s\",fullname=\"%s/%s\",line=\"%d\",times=\"%d\",original-location=\"%s\"}" .//MICmnLLDBDebuggerHandleEvents.cpp: // "*stopped,reason=\"breakpoint-hit\",disp=\"del\",bkptno=\"%d\",frame={addr=\"0x%08x\",func=\"%s\",args=[],file=\"%s\",fullname=\"%s\",line=\"%d\"},thread-id=\"%d\",stopped-threads=\"all\"" .//MICmnLLDBDebuggerHandleEvents.cpp: // frame={addr=\"0x%08x\",func=\"%s\",args=[],file=\"%s\",fullname=\"%s\",line=\"%d\"} .//MICmnLLDBDebuggerHandleEvents.cpp: // "*stopped,reason=\"end-stepping-range\",frame={addr=\"0x%08x\",func=\"%s\",args=[\"%s\"],file=\"%s\",fullname=\"%s\",line=\"%d\"},thread-id=\"%d\",stopped-threads=\"all\"" .//MICmnLLDBDebugSessionInfo.cpp: // "frame={level=\"%d\",addr=\"0x%08llx\",func=\"%s\",args=[%s],file=\"%s\",fullname=\"%s\",line=\"%d\"},frame={level=\"%d\",addr=\"0x%08llx\",func=\"%s\",args=[%s],file=\"%s\",fullname=\"%s\",line=\"%d\"}, .//MICmnLLDBDebugSessionInfo.cpp: // "frame={level=\"%d\",addr=\"0x%08llx\",func=\"%s\",args=[%s],file=\"%s\",fullname=\"%s\",line=\"%d\"},frame={level=\"%d\",addr=\"0x%08llx\",func=\"%s\",args=[%s],file=\"%s\",fullname=\"%s\",line=\"%d\"}, .//MICmnLLDBDebugSessionInfo.cpp: // MI print "{level=\"0\",addr=\"0x%08llx\",func=\"%s\",file=\"%s\",fullname=\"%s\",line=\"%d\"}" .//MICmnLLDBDebugSessionInfo.cpp: const CMIUtilString strAddr(CMIUtilString::Format("0x%08llx", vPc)); .//MICmnLLDBDebugSessionInfo.cpp: const CMIUtilString strAddr(CMIUtilString::Format("0x%08llx", vPc)); .//MICmnLLDBDebugSessionInfo.cpp: // MI print "=breakpoint-modified,bkpt={number=\"%d\",type=\"breakpoint\",disp=\"%s\",enabled=\"%c\",addr=\"0x%08x\", .//MICmnResources.cpp: {IDS_CMD_ERR_LLDB_ERR_NOT_READ_WHOLE_BLK, "Command '%s'. LLDB unable to read entire memory block of %u bytes at address 0x%08x"}, .//MICmnResources.cpp: {IDS_CMD_ERR_LLDB_ERR_READ_MEM_BYTES, "Command '%s'. Unable to read memory block of %u bytes at address 0x%08x: %s "}, .//MICmnResources.cpp: {IDS_CMD_ERR_LLDB_ERR_READ_MEM_BYTES, "Command '%s'. Unable to write memory block of %u bytes at address 0x%08x: %s "}, .//MICmnResources.cpp: {IDS_CMD_ERR_LLDB_ERR_NOT_WRITE_WHOLEBLK, "Command '%s'. LLDB unable to write entire memory block of %u bytes at address 0x%08x"}, Comment Actions In some places address is printed as "int" instead of "long long". I suppose that we should use "%llx" instead of "%x". But perhaps would be better to use PRIx64 (or PRIxPTR) macro.
Comment Actions It depends on how an address type was specified. If it's uint64_t then use PRIx64, but if it was specified like "void*" then use PRIxPTR. Comment Actions I am now using the PRIx64 macro in all locations. I checked and made sure that every type being used is either an MIUint64 or and lldb::addr_t, both of with are uint64s. I also noticed that IDS_CMD_ERR_LLDB_ERR_READ_MEM_BYTES was being initialized twice, and switched the second initialization to the correct IDS_CMD_ERR_LLDB_ERR_NOT_WRITE_WHOLEBLK Comment Actions lgtm apart few comments
Comment Actions I fixed the comments based on feedback from Ilia K. Can somebody please check this in on my behalf? |
address should be printed as a long long value: