Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Owee_buf.Invalid_format("No ELF magic number") on macOS #4

Open
aantron opened this issue Dec 10, 2016 · 4 comments
Open

Owee_buf.Invalid_format("No ELF magic number") on macOS #4

aantron opened this issue Dec 10, 2016 · 4 comments

Comments

@aantron
Copy link
Contributor

aantron commented Dec 10, 2016

This may be a known issue, but I am unable to use prof_spacetime on macOS.

touch foo.ml             # empty file
ocamlfind opt -linkpkg foo.ml
OCAML_SPACETIME_INTERVAL=100 ./a.out
prof_spacetime process -e a.out spacetime-*

results in

Processing series...prof-spacetime: internal error, uncaught exception:
                Owee_buf.Invalid_format("No ELF magic number")
                Raised at file "owee_buf.ml", line 12, characters 25-51
                Called from file "owee_elf.ml", line 15, characters 4-40
                Called from file "owee_elf.ml", line 136, characters 2-16
                Called from file "elf_locations.ml", line 19, characters 26-47
                Called from file "spacetime_lib.ml", line 727, characters 13-62
                Called from file "bin/main.ml", line 45, characters 9-56
                Called from file "src/cmdliner.ml", line 1350, characters 17-26
                Called from file "src/cmdliner.ml", line 1390, characters 6-34

Presumably since a.out is not an ELF file. Not sure if this properly belongs to prof_spacetime, spacetime_lib, or owee.

@lpw25
Copy link
Owner

lpw25 commented Dec 11, 2016

I haven't looked at this issue properly yet, but it is worth noting that you can run prof_spacetime without the -e a.out. You won't get the symbol names or the locations of c function calls (which will just show as raw addresses) but you will still have the locations of the OCaml function calls.

@aantron
Copy link
Contributor Author

aantron commented Dec 11, 2016

Thanks, this is sufficient for my purposes for the time being :)

@lpw25
Copy link
Owner

lpw25 commented Dec 12, 2016

Ok, so apparently macOS uses Mach-o format rather than ELF, which is not supported by owee yet. However, rumour has it that @let-def has been working on adding this support recently.

Even with that support, some object formats are never going to get support, so we also need to give a proper error message rather than an exception.

@let-def
Copy link

let-def commented Dec 12, 2016

I think Owee_macho is in a good enough state that we can try using it :).
This is just a reader, it extracts the basic commands of Mach-O files. More work is needed to make sense of the values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants