Skip to content

Commit

Permalink
Unwind generator is used in 64 bit build only
Browse files Browse the repository at this point in the history
  • Loading branch information
ifratric committed Dec 10, 2021
1 parent f74b1dc commit 92ee0ce
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 4 deletions.
22 changes: 21 additions & 1 deletion Windows/winunwind.cpp
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down Expand Up @@ -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;
}
}

#endif // _WIN64
19 changes: 19 additions & 0 deletions Windows/winunwind.h
Original file line number Diff line number Diff line change
@@ -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"

Expand Down Expand Up @@ -146,4 +163,6 @@ class WinUnwindGenerator : public UnwindGenerator {
size_t RtlAddFunctionTable_addr;
};

#endif // _WIN64

#endif // WINUNWIND_H
2 changes: 1 addition & 1 deletion tinyinst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
4 changes: 2 additions & 2 deletions tinyinst.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 92ee0ce

Please sign in to comment.