gemoroy has asked for the wisdom of the Perl Monks concerning the following question:

Hello monks!

I've got an opera hex stack dump after crash in txt format

I'd like to put opcodes in a binary, cause it's much more convenient be able to inspect it by

biew disassembler for example, then to translate opcodes to mnemonics in mind =)

I could easily get a hex data from it, but how can i put it into binary? And is it possible to keep it's offset?

or it is easier to set an offset in a disassembler?

I am quite not shure about it, case it's would be just a raw binary, so there's nothing like e_entry

Thanks in advance

Replies are listed 'Best First'.
Re: Crashdump to binary question
by ikegami (Patriarch) on Nov 14, 2009 at 07:35 UTC
    binmode STDOUT; local $/; $_ = <>; s/\s+//g; # Adjust to filter out irrelevant stuff. print pack 'H*', $_;

    And is it possible to keep it's offset?

    Not sure what you mean by that. Did you want to prefix the bytes by $offset dummy bytes?

    print "\x00" x $offset;

    Or did you have some format in mind?

      Sorry, i've just dumbed a bit =)

      It is realy unnecessary for me to hold absolute address of loaded code, Relative is more than enough=)

      I am on unix, so i do not need binmode

      Thanks for reply!

        Actually you do. It will disable any encoding in effect on the handle.