diff --git a/Windows/winunwind.cpp b/Windows/winunwind.cpp index e550957..0870698 100644 --- a/Windows/winunwind.cpp +++ b/Windows/winunwind.cpp @@ -1,3 +1,21 @@ +/* +Copyright 2021 Google LLC + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +https ://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +#ifdef _WIN64 + #include "winunwind.h" WinUnwindData::~WinUnwindData() { @@ -674,4 +692,6 @@ void WinUnwindGenerator::OnBasicBlockEnd(ModuleInfo* module, WinUnwindData* unwind_data = (WinUnwindData*)module->unwind_data; if (unwind_data->last_translated_entry) unwind_data->last_translated_entry->function_end = translated_address; -} \ No newline at end of file +} + +#endif // _WIN64 diff --git a/Windows/winunwind.h b/Windows/winunwind.h index a592189..865e624 100644 --- a/Windows/winunwind.h +++ b/Windows/winunwind.h @@ -1,7 +1,24 @@ +/* +Copyright 2021 Google LLC + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +https ://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ #ifndef WINUNWIND_H #define WINUNWIND_H +#ifdef _WIN64 + #include "unwind.h" #include "tinyinst.h" @@ -146,4 +163,6 @@ class WinUnwindGenerator : public UnwindGenerator { size_t RtlAddFunctionTable_addr; }; +#endif // _WIN64 + #endif // WINUNWIND_H diff --git a/tinyinst.cpp b/tinyinst.cpp index 2c5cf77..c9630e9 100644 --- a/tinyinst.cpp +++ b/tinyinst.cpp @@ -1174,7 +1174,7 @@ void TinyInst::Init(int argc, char **argv) { } else { #ifdef __APPLE__ unwind_generator = new UnwindGeneratorMacOS(*this); -#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32) +#elif defined(_WIN64) unwind_generator = new WinUnwindGenerator(*this); #else WARN("Unwind generator not implemented for the current platform"); diff --git a/tinyinst.h b/tinyinst.h index 23feb38..7e93a8b 100644 --- a/tinyinst.h +++ b/tinyinst.h @@ -33,7 +33,7 @@ limitations under the License. #include "instruction.h" #include "unwind.h" -#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) +#if defined(_WIN64) #include "Windows/winunwind.h" @@ -243,7 +243,7 @@ class TinyInst : public Debugger { friend class Arm64Assembler; friend class ModuleInfo; friend class UnwindGenerator; -#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) +#if defined(_WIN64) friend class WinUnwindGenerator; #elif __APPLE__ friend class UnwindGeneratorMacOS;