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
Just send a ELF file for debug/elf to parse it. Then call SectionByType(elf.SHT_PROGBITS), it will return first section with type equals to elf.SHT_PROGBITS. But in a normal ELF file on Linux, there is more than on elf.SHT_PROGBITS section in fact.
What did you expect to see?
returns a list of matched sections.
What did you see instead?
None
The text was updated successfully, but these errors were encountered:
Unfortunately we can't change the current method, as that would break existing programs. SectionByType is only useful for section types that normally only occur once, such as SHT_DYNAMIC.
That kind of new API should go through the proposal process: see https://go.dev/s/proposal. But I'm not sure it's really helpful; why not just loop through the sections yourself? Would anybody really call SectionAllByType?
Yeah, sure I can iterate all sections and find out what I need. But, I am a live sample that I was confused by SectionByType(), literally, it implies that user just need to specify section type and get what they need. I am not sure this will continue to confuse other developers as well. :-)
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes, there is no change between go 1.19.5 to the latest. The affected file and line number is here: https://github.com/golang/go/blob/master/src/debug/elf/file.go#L246
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Just send a ELF file for debug/elf to parse it. Then call SectionByType(elf.SHT_PROGBITS), it will return first section with type equals to elf.SHT_PROGBITS. But in a normal ELF file on Linux, there is more than on elf.SHT_PROGBITS section in fact.
What did you expect to see?
returns a list of matched sections.
What did you see instead?
None
The text was updated successfully, but these errors were encountered: