diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2017-04-13 14:37:53 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2017-04-13 14:13:02 +0000 |
commit | bcd4af193f4453c7e27de4a25249e884f4aff8a7 (patch) | |
tree | cf02836fa894b683013ff0cf307141538a84e0ef | |
parent | f24e674832bd678d22906e37be89c0e9017b7f65 (diff) |
Fix some compile errors on windows
Change-Id: Ie8073c6f32cd0184ab666ced9d10cf48e59f11c3
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
-rw-r--r-- | app/perfdata.cpp | 4 | ||||
-rw-r--r-- | app/perfregisterinfo.cpp | 2 | ||||
-rw-r--r-- | app/perfsymboltable.cpp | 13 |
3 files changed, 10 insertions, 9 deletions
diff --git a/app/perfdata.cpp b/app/perfdata.cpp index d8a4791..d73f31c 100644 --- a/app/perfdata.cpp +++ b/app/perfdata.cpp @@ -419,11 +419,11 @@ PerfRecordSample::PerfRecordSample(const PerfEventHeader *header, quint64 PerfRecordSample::registerValue(uint reg) const { - Q_ASSERT(m_registerAbi && m_registerMask & (1 << reg)); + Q_ASSERT(m_registerAbi && m_registerMask & (1ull << reg)); int index = 0; for (uint i = 0; i < reg; i++) { - if (m_registerMask & (1 << i)) + if (m_registerMask & (1ull << i)) index++; } diff --git a/app/perfregisterinfo.cpp b/app/perfregisterinfo.cpp index 227e35c..aa2e9e2 100644 --- a/app/perfregisterinfo.cpp +++ b/app/perfregisterinfo.cpp @@ -43,7 +43,7 @@ static uint aarch64[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, static uint x86[] = {0, 2, 3, 1, 7, 6, 4, 5, 8}; static uint x86_64[] = {0, 3, 2, 1, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 23, 8}; -static uint none[] = {}; +static uint none[] = {0}; const uint *PerfRegisterInfo::s_perfToDwarf[PerfRegisterInfo::ARCH_INVALID][PerfRegisterInfo::s_numAbis] = { {arm, arm }, diff --git a/app/perfsymboltable.cpp b/app/perfsymboltable.cpp index 69abe38..95be45d 100644 --- a/app/perfsymboltable.cpp +++ b/app/perfsymboltable.cpp @@ -126,10 +126,11 @@ static bool setInitialRegisters(Dwfl_Thread *thread, void *arg) Q_ASSERT(abi < PerfRegisterInfo::s_numAbis); uint architecture = ui->unwind->architecture(); uint numRegs = PerfRegisterInfo::s_numRegisters[architecture][abi]; - Dwarf_Word dwarfRegs[numRegs]; - for (uint i = 0; i < numRegs; ++i) + QVarLengthArray<Dwarf_Word, 64> dwarfRegs(numRegs); + for (uint i = 0; i < numRegs; ++i) { dwarfRegs[i] = ui->sample->registerValue( PerfRegisterInfo::s_perfToDwarf[architecture][abi][i]); + } // Go one frame up to get the rest of the stack at interworking veneers. if (ui->isInterworking) { @@ -141,13 +142,13 @@ static bool setInitialRegisters(Dwfl_Thread *thread, void *arg) uint dummyNum = PerfRegisterInfo::s_dummyRegisters[architecture][1] - dummyBegin; if (dummyNum > 0) { - Dwarf_Word dummyRegs[dummyNum]; - std::memset(dummyRegs, 0, dummyNum * sizeof(Dwarf_Word)); - if (!dwfl_thread_state_registers(thread, dummyBegin, dummyNum, dummyRegs)) + QVarLengthArray<Dwarf_Word, 64> dummyRegs(dummyNum); + std::memset(dummyRegs.data(), 0, dummyNum * sizeof(Dwarf_Word)); + if (!dwfl_thread_state_registers(thread, dummyBegin, dummyNum, dummyRegs.data())) return false; } - return dwfl_thread_state_registers(thread, 0, numRegs, dwarfRegs); + return dwfl_thread_state_registers(thread, 0, numRegs, dwarfRegs.data()); } static const Dwfl_Thread_Callbacks threadCallbacks = { |