File tree 4 files changed +19
-8
lines changed
4 files changed +19
-8
lines changed Original file line number Diff line number Diff line change @@ -392,11 +392,9 @@ void init_ELF_Structures_enum(py::module& m) {
392
392
393
393
// ! Enum for the *p_flags* field of ElfXX_Phdr
394
394
py::enum_<SEGMENT_FLAGS>(m, " SEGMENT_FLAGS" , py::arithmetic ())
395
- .value (" PF_X" , SEGMENT_FLAGS::PF_X)
396
- .value (" PF_W" , SEGMENT_FLAGS::PF_W)
397
- .value (" PF_R" , SEGMENT_FLAGS::PF_R)
398
- .value (" PF_MASKOS" , SEGMENT_FLAGS::PF_MASKOS)
399
- .value (" PF_MASKPROC" , SEGMENT_FLAGS::PF_MASKPROC)
395
+ .value (PY_ENUM (SEGMENT_FLAGS::PF_X))
396
+ .value (PY_ENUM (SEGMENT_FLAGS::PF_W))
397
+ .value (PY_ENUM (SEGMENT_FLAGS::PF_R))
400
398
.export_values ();
401
399
402
400
Original file line number Diff line number Diff line change @@ -129,13 +129,13 @@ def print_segments(binary):
129
129
sections = segment .sections
130
130
s = ", " .join ([section .name for section in sections ])
131
131
flags_str = ["-" ] * 3
132
- if ELF .SEGMENT_FLAGS .PF_R in segment :
132
+ if ELF .SEGMENT_FLAGS .R in segment :
133
133
flags_str [0 ] = "r"
134
134
135
- if ELF .SEGMENT_FLAGS .PF_W in segment :
135
+ if ELF .SEGMENT_FLAGS .W in segment :
136
136
flags_str [1 ] = "w"
137
137
138
- if ELF .SEGMENT_FLAGS .PF_X in segment :
138
+ if ELF .SEGMENT_FLAGS .X in segment :
139
139
flags_str [2 ] = "x"
140
140
flags_str = "" .join (flags_str )
141
141
Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ DLL_PUBLIC const char* to_string(IDENTITY e);
45
45
DLL_PUBLIC const char * to_string (SYMBOL_SECTION_INDEX e);
46
46
DLL_PUBLIC const char * to_string (DYNAMIC_FLAGS e);
47
47
DLL_PUBLIC const char * to_string (DYNAMIC_FLAGS_1 e);
48
+ DLL_PUBLIC const char * to_string (SEGMENT_FLAGS e);
48
49
49
50
DLL_PUBLIC const char * to_string (PPC64_EFLAGS e);
50
51
DLL_PUBLIC const char * to_string (ARM_EFLAGS e);
Original file line number Diff line number Diff line change @@ -1133,6 +1133,18 @@ const char* to_string(DYNAMIC_FLAGS_1 e) {
1133
1133
return it == enum_strings_flags1.end () ? " UNDEFINED" : it->second ;
1134
1134
}
1135
1135
1136
+ const char * to_string (SEGMENT_FLAGS e) {
1137
+ const std::map<SEGMENT_FLAGS, const char *> enum_strings {
1138
+ { SEGMENT_FLAGS::PF_X, " X" },
1139
+ { SEGMENT_FLAGS::PF_W, " W" },
1140
+ { SEGMENT_FLAGS::PF_R, " R" },
1141
+ };
1142
+
1143
+ auto it = enum_strings.find (e);
1144
+ return it == enum_strings.end () ? " UNDEFINED" : it->second ;
1145
+ }
1146
+
1147
+
1136
1148
1137
1149
1138
1150
} // namespace ELF
You can’t perform that action at this time.
0 commit comments