forked from gdbinit/MachOView
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes to generate arm64 native version
Fix the LC_UNIXTHREAD processing Add the thread_status includes because they depend on the target build arch and we need them all Remove mach-o includes from Prefix.pch and move them to each source file that requires them
- Loading branch information
Showing
15 changed files
with
474 additions
and
231 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
// | ||
// thread_status.h | ||
// MachOView | ||
// | ||
// Created by reverser on 10/05/2023. | ||
// | ||
|
||
/* | ||
* Copyright (c) 1999-2010 Apple Inc. All Rights Reserved. | ||
* | ||
* @APPLE_LICENSE_HEADER_START@ | ||
* | ||
* This file contains Original Code and/or Modifications of Original Code | ||
* as defined in and that are subject to the Apple Public Source License | ||
* Version 2.0 (the 'License'). You may not use this file except in | ||
* compliance with the License. Please obtain a copy of the License at | ||
* http://www.opensource.apple.com/apsl/ and read it before using this | ||
* file. | ||
* | ||
* The Original Code and all software distributed under the License are | ||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | ||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | ||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | ||
* Please see the License for the specific language governing rights and | ||
* limitations under the License. | ||
* | ||
* @APPLE_LICENSE_HEADER_END@ | ||
*/ | ||
|
||
#ifndef thread_status_h | ||
#define thread_status_h | ||
|
||
#include <stdint.h> | ||
|
||
#define __STRUCT_X86_THREAD_STATE32 struct ___darwin_i386_thread_state | ||
__STRUCT_X86_THREAD_STATE32 | ||
{ | ||
unsigned int eax; | ||
unsigned int ebx; | ||
unsigned int ecx; | ||
unsigned int edx; | ||
unsigned int edi; | ||
unsigned int esi; | ||
unsigned int ebp; | ||
unsigned int esp; | ||
unsigned int ss; | ||
unsigned int eflags; | ||
unsigned int eip; | ||
unsigned int cs; | ||
unsigned int ds; | ||
unsigned int es; | ||
unsigned int fs; | ||
unsigned int gs; | ||
}; | ||
|
||
#define __STRUCT_X86_THREAD_STATE64 struct ___darwin_x86_thread_state64 | ||
__STRUCT_X86_THREAD_STATE64 | ||
{ | ||
uint64_t rax; | ||
uint64_t rbx; | ||
uint64_t rcx; | ||
uint64_t rdx; | ||
uint64_t rdi; | ||
uint64_t rsi; | ||
uint64_t rbp; | ||
uint64_t rsp; | ||
uint64_t r8; | ||
uint64_t r9; | ||
uint64_t r10; | ||
uint64_t r11; | ||
uint64_t r12; | ||
uint64_t r13; | ||
uint64_t r14; | ||
uint64_t r15; | ||
uint64_t rip; | ||
uint64_t rflags; | ||
uint64_t cs; | ||
uint64_t fs; | ||
uint64_t gs; | ||
}; | ||
|
||
/* | ||
* THREAD_STATE_FLAVOR_LIST 0 | ||
* these are the supported flavors | ||
*/ | ||
#define _x86_THREAD_STATE32 1 | ||
#define _x86_FLOAT_STATE32 2 | ||
#define _x86_EXCEPTION_STATE32 3 | ||
#define _x86_THREAD_STATE64 4 | ||
#define _x86_FLOAT_STATE64 5 | ||
#define _x86_EXCEPTION_STATE64 6 | ||
#define _x86_THREAD_STATE 7 | ||
#define _x86_FLOAT_STATE 8 | ||
#define _x86_EXCEPTION_STATE 9 | ||
#define _x86_DEBUG_STATE32 10 | ||
#define _x86_DEBUG_STATE64 11 | ||
#define _x86_DEBUG_STATE 12 | ||
#define _x86_THREAD_STATE_NONE 13 | ||
/* 14 and 15 are used for the internal x86_SAVED_STATE flavours */ | ||
/* Arrange for flavors to take sequential values, 32-bit, 64-bit, non-specific */ | ||
#define _x86_AVX_STATE32 16 | ||
#define _x86_AVX_STATE64 (_x86_AVX_STATE32 + 1) | ||
#define _x86_AVX_STATE (_x86_AVX_STATE32 + 2) | ||
#define _x86_AVX512_STATE32 19 | ||
#define _x86_AVX512_STATE64 (_x86_AVX512_STATE32 + 1) | ||
#define _x86_AVX512_STATE (_x86_AVX512_STATE32 + 2) | ||
#define _x86_PAGEIN_STATE 22 | ||
#define _x86_THREAD_FULL_STATE64 23 | ||
#define _x86_INSTRUCTION_STATE 24 | ||
#define _x86_LAST_BRANCH_STATE 25 | ||
|
||
struct _x86_state_hdr { | ||
uint32_t flavor; | ||
uint32_t count; | ||
}; | ||
typedef struct _x86_state_hdr _x86_state_hdr_t; | ||
|
||
typedef __STRUCT_X86_THREAD_STATE32 _x86_thread_state32_t; | ||
#define x86_THREAD_STATE32_COUNT ((mach_msg_type_number_t) \ | ||
( sizeof (x86_thread_state32_t) / sizeof (int) )) | ||
|
||
typedef __STRUCT_X86_THREAD_STATE64 _x86_thread_state64_t; | ||
#define x86_THREAD_STATE64_COUNT ((mach_msg_type_number_t) \ | ||
( sizeof (x86_thread_state64_t) / sizeof (int) )) | ||
|
||
/* | ||
* Combined thread, float and exception states | ||
*/ | ||
struct _x86_thread_state { | ||
_x86_state_hdr_t tsh; | ||
union { | ||
_x86_thread_state32_t ts32; | ||
_x86_thread_state64_t ts64; | ||
} uts; | ||
}; | ||
|
||
typedef struct _x86_thread_state _x86_thread_state_t; | ||
#define _x86_THREAD_STATE_COUNT ((mach_msg_type_number_t) \ | ||
( sizeof (x86_thread_state_t) / sizeof (int) )) | ||
|
||
#endif /* thread_status_h */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
// | ||
// thread_status_arm.h | ||
// MachOView | ||
// | ||
// Created by reverser on 10/05/2023. | ||
// | ||
|
||
/* | ||
* Copyright (c) 1999-2010 Apple Inc. All Rights Reserved. | ||
* | ||
* @APPLE_LICENSE_HEADER_START@ | ||
* | ||
* This file contains Original Code and/or Modifications of Original Code | ||
* as defined in and that are subject to the Apple Public Source License | ||
* Version 2.0 (the 'License'). You may not use this file except in | ||
* compliance with the License. Please obtain a copy of the License at | ||
* http://www.opensource.apple.com/apsl/ and read it before using this | ||
* file. | ||
* | ||
* The Original Code and all software distributed under the License are | ||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | ||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | ||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | ||
* Please see the License for the specific language governing rights and | ||
* limitations under the License. | ||
* | ||
* @APPLE_LICENSE_HEADER_END@ | ||
*/ | ||
|
||
#ifndef thread_status_arm_h | ||
#define thread_status_arm_h | ||
|
||
#include <stdint.h> | ||
|
||
#define __STRUCT_ARM_THREAD_STATE struct ___darwin_arm_thread_state | ||
__STRUCT_ARM_THREAD_STATE | ||
{ | ||
uint32_t r[13]; /* General purpose register r0-r12 */ | ||
uint32_t sp; /* Stack pointer r13 */ | ||
uint32_t lr; /* Link register r14 */ | ||
uint32_t pc; /* Program counter r15 */ | ||
uint32_t cpsr; /* Current program status register */ | ||
}; | ||
|
||
#define __STRUCT_ARM_THREAD_STATE64 struct ___darwin_arm_thread_state64 | ||
__STRUCT_ARM_THREAD_STATE64 | ||
{ | ||
uint64_t x[29]; /* General purpose registers x0-x28 */ | ||
uint64_t fp; /* Frame pointer x29 */ | ||
uint64_t lr; /* Link register x30 */ | ||
uint64_t sp; /* Stack pointer x31 */ | ||
uint64_t pc; /* Program counter */ | ||
uint32_t cpsr; /* Current program status register */ | ||
uint32_t pad; /* Same size for 32-bit or 64-bit clients */ | ||
}; | ||
|
||
/* | ||
* Flavors | ||
*/ | ||
|
||
#define _ARM_THREAD_STATE 1 | ||
#define _ARM_UNIFIED_THREAD_STATE ARM_THREAD_STATE | ||
#define _ARM_VFP_STATE 2 | ||
#define _ARM_EXCEPTION_STATE 3 | ||
#define _ARM_DEBUG_STATE 4 /* pre-armv8 */ | ||
#define _ARM_THREAD_STATE_NONE 5 | ||
#define _ARM_THREAD_STATE64 6 | ||
#define _ARM_EXCEPTION_STATE64 7 | ||
// ARM_THREAD_STATE_LAST 8 /* legacy */ | ||
#define _ARM_THREAD_STATE32 9 | ||
#define _ARM_DEBUG_STATE32 14 | ||
#define _ARM_DEBUG_STATE64 15 | ||
#define _ARM_NEON_STATE 16 | ||
#define _ARM_NEON_STATE64 17 | ||
#define _ARM_CPMU_STATE64 18 | ||
#define _ARM_PAGEIN_STATE 27 | ||
|
||
#ifndef ARM_STATE_FLAVOR_IS_OTHER_VALID | ||
#define ARM_STATE_FLAVOR_IS_OTHER_VALID(_flavor_) 0 | ||
#endif | ||
|
||
struct _arm_state_hdr { | ||
uint32_t flavor; | ||
uint32_t count; | ||
}; | ||
typedef struct _arm_state_hdr _arm_state_hdr_t; | ||
|
||
typedef __STRUCT_ARM_THREAD_STATE _arm_thread_state_t; | ||
typedef __STRUCT_ARM_THREAD_STATE _arm_thread_state32_t; | ||
typedef __STRUCT_ARM_THREAD_STATE64 _arm_thread_state64_t; | ||
|
||
struct _arm_unified_thread_state { | ||
_arm_state_hdr_t ash; | ||
union { | ||
_arm_thread_state32_t ts32; | ||
_arm_thread_state64_t ts64; | ||
} uts; | ||
}; | ||
typedef struct _arm_unified_thread_state _arm_unified_thread_state_t; | ||
|
||
#define ARM_THREAD_STATE_COUNT ((mach_msg_type_number_t) \ | ||
(sizeof (arm_thread_state_t)/sizeof(uint32_t))) | ||
#define ARM_THREAD_STATE32_COUNT ((mach_msg_type_number_t) \ | ||
(sizeof (arm_thread_state32_t)/sizeof(uint32_t))) | ||
#define ARM_THREAD_STATE64_COUNT ((mach_msg_type_number_t) \ | ||
(sizeof (arm_thread_state64_t)/sizeof(uint32_t))) | ||
#define ARM_UNIFIED_THREAD_STATE_COUNT ((mach_msg_type_number_t) \ | ||
(sizeof (arm_unified_thread_state_t)/sizeof(uint32_t))) | ||
|
||
#endif /* thread_status_arm_h */ |
Oops, something went wrong.