Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
java-class-file-disassembler/class_reader.h at main · a1usha/java-class-file-disassembler · GitHub
Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
See all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
a1usha
java-class-file-disassembler
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
main
Breadcrumbs
java-class-file-disassembler
/
class_reader.h
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
165 lines (131 loc) · 3.19 KB
main
Breadcrumbs
java-class-file-disassembler
/
class_reader.h
Copy path
Top
File metadata and controls
Code
Blame
165 lines (131 loc) · 3.19 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
#ifndef
CLASS_READER_H
#define
CLASS_READER_H
#include
<stdio.h>
#include
<stdint.h>
#include
<stdbool.h>
#include
<stdlib.h>
#include
<endian.h>
#include
<string.h>
#define
MAGIC_NUMBER
0xcafebabe
typedef
struct
CONSTANT_Ref_info_s
{
uint8_t
tag
;
uint16_t
class_index
;
uint16_t
name_and_type_index
;
}
CONSTANT_Ref_info
;
typedef
struct
CONSTANT_Class_info_s
{
uint8_t
tag
;
uint16_t
name_index
;
}
CONSTANT_Class_info
;
typedef
struct
CONSTANT_String_info_s
{
uint8_t
tag
;
uint16_t
string_index
;
}
CONSTANT_String_info
;
typedef
struct
CONSTANT_IntFloat_info_s
{
uint8_t
tag
;
uint32_t
bytes
;
}
CONSTANT_IntFloat_info
;
typedef
struct
CONSTANT_LongDouble_info_s
{
uint8_t
tag
;
uint32_t
high_bytes
;
uint32_t
low_bytes
;
}
CONSTANT_LongDouble_info
;
typedef
struct
CONSTANT_Utf8_info_s
{
uint8_t
tag
;
uint16_t
length
;
char
*
bytes
;
}
CONSTANT_Utf8_info
;
typedef
struct
CONSTANT_MethodHandle_info_s
{
uint8_t
tag
;
uint8_t
reference_kind
;
uint16_t
reference_index
;
}
CONSTANT_MethodHandle_info
;
typedef
struct
CONSTANT_MethodType_info_s
{
uint8_t
tag
;
uint16_t
descriptor_index
;
}
CONSTANT_MethodType_info
;
typedef
struct
CONSTANT_InvokeDynamic_info_s
{
uint8_t
tag
;
uint16_t
bootstrap_method_attr_index
;
uint16_t
name_and_type_index
;
}
CONSTANT_InvokeDynamic_info
;
typedef
union
constant_info_u
{
CONSTANT_Ref_info
ref_i
;
CONSTANT_Class_info
class_i
;
CONSTANT_String_info
string_i
;
CONSTANT_IntFloat_info
int_float_i
;
CONSTANT_LongDouble_info
long_double_i
;
CONSTANT_Utf8_info
utf_i
;
CONSTANT_MethodHandle_info
method_handle_i
;
CONSTANT_MethodType_info
method_type_i
;
CONSTANT_InvokeDynamic_info
invoke_dynamic_i
;
}
constant_info
;
typedef
enum
constant_pool_tag_e
{
CONSTANT_Class
=
7
,
CONSTANT_Fieldref
=
9
,
CONSTANT_Methodref
=
10
,
CONSTANT_InterfaceMethodref
=
11
,
CONSTANT_String
=
8
,
CONSTANT_Integer
=
3
,
CONSTANT_Float
=
4
,
CONSTANT_Long
=
5
,
CONSTANT_Double
=
6
,
CONSTANT_NameAndType
=
12
,
CONSTANT_Utf8
=
1
,
CONSTANT_MethodHandle
=
15
,
CONSTANT_MethodType
=
16
,
CONSTANT_InvokeDynamic
=
18
}
constant_pool_tag
;
static
char
*
reference_kind
[]
=
{
"REF_getField"
,
// 1
"REF_getStatic"
,
// 2
"REF_putField"
,
// 3
"REF_putStatic"
,
// 4
"REF_invokeVirtual"
,
// 5
"REF_invokeStatic"
,
// 6
"REF_invokeSpecial"
,
// 7
"REF_newInvokeSpecial"
,
// 8
"REF_invokeInterface"
// 9
};
typedef
enum
inf_nan_e
{
NORMAL
=
0
,
POSITIVE_INFINITY
=
1
,
NEGATIVE_INFINITY
=
2
,
NAN
=
3
}
inf_nan
;
typedef
struct
class_s
{
uint16_t
minor_version
;
uint16_t
major_version
;
uint16_t
constant_pool_count
;
constant_info
*
constant_pool
;
}
class
;
typedef
union
double_cast_u
{
double
d
;
struct
parts_s
{
uint64_t
mantisa
:
52
;
uint32_t
exponent
:
11
;
uint32_t
sign
:
1
;
}
parts
;
}
double_cast
;
FILE
*
open_class_file
(
char
*
path
);
bool
is_class_file
(
FILE
*
file
);
class
*
parse_class_file
(
FILE
*
class_file
);
void
parse_u2
(
FILE
*
class_file
,
uint16_t
*
cls
);
void
parse_constant_pool
(
FILE
*
class_file
,
class
*
cls
);
void
print_constant_pool
(
FILE
*
stream
,
class
*
cls
);
#endif
You can’t perform that action at this time.