File tree 5 files changed +37
-3
lines changed
5 files changed +37
-3
lines changed Original file line number Diff line number Diff line change @@ -124,6 +124,15 @@ void init_MachO_Binary_class(py::module& m) {
124
124
" Return binary's " RST_CLASS_REF (lief.MachO .DylinkerCommand ) " if any." ,
125
125
py::return_value_policy::reference)
126
126
127
+ .def_property_readonly (" has_dyld_info" ,
128
+ &Binary::has_dyld_info,
129
+ " ``True`` if the binary has a " RST_CLASS_REF (lief.MachO .DyldInfo ) " command." ,
130
+ py::return_value_policy::reference_internal)
131
+
132
+ .def_property_readonly (" dyld_info" ,
133
+ static_cast <no_const_getter<DyldInfo&>>(&Binary::dyld_info),
134
+ " Return binary's " RST_CLASS_REF (lief.MachO .DyldInfo ) " if any." ,
135
+ py::return_value_policy::reference)
127
136
128
137
129
138
.def (" __str__" ,
Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ void init_MachO_DyldInfo_class(py::module& m) {
137
137
" If there is no exported symbol, the byte is zero. If there\n "
138
138
" is exported info, it follows the length byte. The exported\n "
139
139
" info normally consists of a flags and offset both encoded\n "
140
- " in uleb128. The offset is location of the content named\n "
140
+ " in ` uleb128 <https://en.wikipedia.org/wiki/LEB128>`_ . The offset is location of the content named\n "
141
141
" by the symbol. It is the offset from the mach_header for\n "
142
142
" the image.\n\n "
143
143
Original file line number Diff line number Diff line change @@ -217,6 +217,10 @@ def main():
217
217
action = 'store_true' , dest = 'show_dylinker' ,
218
218
help = 'Display the Dylinker command' )
219
219
220
+ parser .add_argument ('--dyldinfo' ,
221
+ action = 'store_true' , dest = 'show_dyldinfo' ,
222
+ help = 'Display the DyldInfo command' )
223
+
220
224
parser .add_argument ("binary" ,
221
225
metavar = "<macho-file>" ,
222
226
help = 'Target Mach-O File' )
Original file line number Diff line number Diff line change 35
35
#include " LIEF/MachO/SymbolCommand.hpp"
36
36
#include " LIEF/MachO/MainCommand.hpp"
37
37
#include " LIEF/MachO/DynamicSymbolCommand.hpp"
38
+ #include " LIEF/MachO/DyldInfo.hpp"
38
39
39
40
namespace LIEF {
40
41
namespace MachO {
@@ -172,20 +173,27 @@ class DLL_PUBLIC Binary : public LIEF::Binary {
172
173
UUIDCommand& uuid (void );
173
174
const UUIDCommand& uuid (void ) const ;
174
175
175
- // ! @brief ``true`` if the binary has an MachO::MainCommand command.
176
+ // ! @brief ``true`` if the binary has a MachO::MainCommand command.
176
177
bool has_main_command (void ) const ;
177
178
178
179
// ! @brief Return the MachO::MainCommand
179
180
MainCommand& main_command (void );
180
181
const MainCommand& main_command (void ) const ;
181
182
182
- // ! @brief ``true`` if the binary has an MachO::DylinkerCommand.
183
+ // ! @brief ``true`` if the binary has a MachO::DylinkerCommand.
183
184
bool has_dylinker (void ) const ;
184
185
185
186
// ! @brief Return the MachO::DylinkerCommand
186
187
DylinkerCommand& dylinker (void );
187
188
const DylinkerCommand& dylinker (void ) const ;
188
189
190
+ // ! @brief ``true`` if the binary has a MachO::DyldInfo command.
191
+ bool has_dyld_info (void ) const ;
192
+
193
+ // ! @brief Return the MachO::Dyl
194
+ DyldInfo& dyld_info (void );
195
+ const DyldInfo& dyld_info (void ) const ;
196
+
189
197
template <class T >
190
198
bool has_command (void ) const ;
191
199
Original file line number Diff line number Diff line change @@ -526,6 +526,19 @@ const DylinkerCommand& Binary::dylinker(void) const {
526
526
return this ->get_command <DylinkerCommand>();
527
527
}
528
528
529
+ // DyldInfo
530
+ // ++++++++
531
+ bool Binary::has_dyld_info (void ) const {
532
+ return this ->has_command <DyldInfo>();
533
+ }
534
+
535
+ DyldInfo& Binary::dyld_info (void ) {
536
+ return this ->get_command <DyldInfo>();
537
+ }
538
+
539
+ const DyldInfo& Binary::dyld_info (void ) const {
540
+ return this ->get_command <DyldInfo>();
541
+ }
529
542
530
543
531
544
You can’t perform that action at this time.
0 commit comments