Fix dump_syms clang compilation on Windows

Clang complains about bad format strings (DWORD is an unsigned long, not
unsigned int) and signed/unsigned comparison.
This change is necessary for https://codereview.chromium.org/2712423002/

BUG=245456

Change-Id: I58da92d43d90ac535c165fca346ee6866dfce22e
Reviewed-on: https://chromium-review.googlesource.com/448037
Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
Maciej Pawlowski 2017-03-01 16:18:54 +01:00 committed by Mark Mentovai
parent 8349b97378
commit d61d49b385

View file

@ -275,7 +275,7 @@ bool PDBSourceLineWriter::PrintLines(IDiaEnumLineNumbers *lines) {
AddressRangeVector ranges;
MapAddressRange(image_map_, AddressRange(rva, length), &ranges);
for (size_t i = 0; i < ranges.size(); ++i) {
fprintf(output_, "%x %x %d %d\n", ranges[i].rva, ranges[i].length,
fprintf(output_, "%lx %lx %lu %lu\n", ranges[i].rva, ranges[i].length,
line_num, source_id);
}
line.Release();
@ -320,7 +320,7 @@ bool PDBSourceLineWriter::PrintFunction(IDiaSymbol *function,
MapAddressRange(image_map_, AddressRange(rva, static_cast<DWORD>(length)),
&ranges);
for (size_t i = 0; i < ranges.size(); ++i) {
fprintf(output_, "FUNC %x %x %x %ws\n",
fprintf(output_, "FUNC %lx %lx %x %ws\n",
ranges[i].rva, ranges[i].length, stack_param_size,
name.m_str);
}
@ -673,7 +673,7 @@ bool PDBSourceLineWriter::PrintFrameDataUsingPDB() {
for (size_t i = 0; i < frame_infos.size(); ++i) {
const FrameInfo& fi(frame_infos[i]);
fprintf(output_, "STACK WIN %x %x %x %x %x %x %x %x %x %d ",
fprintf(output_, "STACK WIN %lx %lx %lx %lx %x %lx %lx %lx %lx %d ",
type, fi.rva, fi.code_size, fi.prolog_size,
0 /* epilog_size */, parameter_size, saved_register_size,
local_size, max_stack_size, program_string_result == S_OK);
@ -819,10 +819,10 @@ bool PDBSourceLineWriter::PrintFrameDataUsingEXE() {
unwind_info = NULL;
}
} while (unwind_info);
fprintf(output_, "STACK CFI INIT %x %x .cfa: $rsp .ra: .cfa %d - ^\n",
fprintf(output_, "STACK CFI INIT %lx %lx .cfa: $rsp .ra: .cfa %lu - ^\n",
funcs[i].BeginAddress,
funcs[i].EndAddress - funcs[i].BeginAddress, rip_offset);
fprintf(output_, "STACK CFI %x .cfa: $rsp %d +\n",
fprintf(output_, "STACK CFI %lx .cfa: $rsp %lu +\n",
funcs[i].BeginAddress, stack_size);
}
@ -862,7 +862,7 @@ bool PDBSourceLineWriter::PrintCodePublicSymbol(IDiaSymbol *symbol) {
AddressRangeVector ranges;
MapAddressRange(image_map_, AddressRange(rva, 1), &ranges);
for (size_t i = 0; i < ranges.size(); ++i) {
fprintf(output_, "PUBLIC %x %x %ws\n", ranges[i].rva,
fprintf(output_, "PUBLIC %lx %x %ws\n", ranges[i].rva,
stack_param_size > 0 ? stack_param_size : 0,
name.m_str);
}
@ -894,7 +894,7 @@ bool PDBSourceLineWriter::PrintCodePublicSymbol(IDiaSymbol *symbol) {
AddressRangeVector next_ranges;
MapAddressRange(image_map_, AddressRange(rva, 1), &next_ranges);
for (size_t i = 0; i < next_ranges.size(); ++i) {
fprintf(output_, "PUBLIC %x %x %ws\n", next_ranges[i].rva,
fprintf(output_, "PUBLIC %lx %x %ws\n", next_ranges[i].rva,
stack_param_size > 0 ? stack_param_size : 0, name.m_str);
}
}
@ -980,7 +980,7 @@ bool PDBSourceLineWriter::FindPEFile() {
// Look for an EXE or DLL file.
const wchar_t *extensions[] = { L"exe", L"dll" };
for (int i = 0; i < sizeof(extensions) / sizeof(extensions[0]); i++) {
for (size_t i = 0; i < sizeof(extensions) / sizeof(extensions[0]); i++) {
size_t dot_pos = file.find_last_of(L".");
if (dot_pos != wstring::npos) {
file.replace(dot_pos + 1, wstring::npos, extensions[i]);