lief-project / LIEF

LIEF - Library to Instrument Executable Formats
https://lief.re
Apache License 2.0
4.43k stars 620 forks source link

'Header' object has no attribute 'flags_list' and 'lief._lief.ELF' has no attribute 'PROCESSOR_FLAGS' #1062

Closed Timonheu closed 4 months ago

Timonheu commented 4 months ago

Describe the bug According to the header documentation, a header object has the property flags_list, but this appears to not be true. (I get AttributeError: 'Header' object has no attribute 'flags_list')

I can get the processor flags as an integer using the processor_flag property, but when I want to parse this with lief.ELF.PROCESSOR_FLAGS.from_value(), (found in the documentation on this class) it appears that the class PROCESSOR_FLAGS does not exist either. (I get AttributeError: 'lief._lief.ELF' has no attribute 'PROCESSOR_FLAGS').

To Reproduce Steps to reproduce the behavior:

import lief

bin = lief.ELF.parse("ls")
header = bin.header

# Gives integer form of processor flags
proc_flag = header.processor_flag

# This gives an attribute errror:
proc_flags = header.flags_list

# This also gives an attribute error
flag = elf.ELF.PROCESSOR_FLAGS.from_value(proc_flags)

Expected behavior For flags_list to give a list of lief.ELF.PROCESSOR_FLAG objects, and for lief.ELF.PROCESSOR_FLAG to exist, in accordance with the documentation.

Environment (please complete the following information):

Additional context Is there another way to parse the processor flags that is not in the documentation/documented elsewhere?

I did find that attributes like arm_flags_list do exist in a Header object, but I only found this under the header of version 0.8.0 in the changelog.

romainthomas commented 4 months ago

Hi @Timonheu

The documentation you are pointing is actually for the nightly build. For the latest release you should use the stable dir: https://lief.re/doc/stable/

Note that on the left bar you have the exact commit/version for which the documentation is generated.

Timonheu commented 4 months ago

Ah I completely missed that, and did not manage to find the stable docs. Thank you very much!