Coder Social home page Coder Social logo

Comments (11)

sbc100 avatar sbc100 commented on July 20, 2024

You can list the exports using wasm-objdump -j export.

We could add a flag to allow you to disassamble just exported functions but I'm not clear why that would be useful. Why would you only want to disassemble the exported functions?

Aside from that I'm not quite sure what you are asking for here. The data in wasm module is no generally associated with particular function. Any function can access any data. There may have been some link/assosiation in the source language but those links are not present in the binaryn.

from wabt.

walksanatora avatar walksanatora commented on July 20, 2024

In the case of a shared library and I forgot all the exported functions I included in it

from wabt.

walksanatora avatar walksanatora commented on July 20, 2024

Also I just tried wasm-objdump -j export and I had to add -x and then it told me "section not found: export" also checked the plural form

from wabt.

sbc100 avatar sbc100 commented on July 20, 2024

Also I just tried wasm-objdump -j export and I had to add -x and then it told me "section not found: export" also checked the plural form

What don't wasm-objdump -h tell you? Does the file really not have an export section?

from wabt.

walksanatora avatar walksanatora commented on July 20, 2024

all wasm-objdump -h tells me is

wasm-objdump: expected filename argument.
Try '--help' for more information.

if I try --help

usage: wasm-objdump [options] filename+

  Print information about the contents of wasm binaries.

examples:
  $ wasm-objdump test.wasm

options:
      --help                   Print this help message
      --version                Print version information
  -h, --headers                Print headers
  -j, --section=SECTION        Select just one section
  -s, --full-contents          Print raw section contents
  -d, --disassemble            Disassemble function bodies
      --debug                  Print extra debug information
  -x, --details                Show section details
  -r, --reloc                  Show relocations inline with disassembly
      --section-offsets        Print section offsets instead of file offsets in code disassembly

and idk how to check for export section (all i know is that wasm2c produces valid C code)

from wabt.

sbc100 avatar sbc100 commented on July 20, 2024

The -h or --headers flag lists the headers of a wasm file. You need to also specify the wasm file on the command line along with the -h flag. Sorry I wasn't more clear about that.

from wabt.

walksanatora avatar walksanatora commented on July 20, 2024

so it appears the propper command is wasm-objdump -j Export -x but this includes the export of memory
and also fails to include the function types (inputs/outputs)

from wabt.

sbc100 avatar sbc100 commented on July 20, 2024

Right, -j Export lists all the exports, not just the functions. There is not flag for listing just part of the export section. Each section is listed in it's entirety, or not at all.

The signatures are in a different section so you would use a different -j flag to list those.

If you are looking for other ways to introspect a wasm module you might also want to take a look at wasm-dis from the binaryen project.

from wabt.

walksanatora avatar walksanatora commented on July 20, 2024

wasm-dis imo feels like a worse wasm2wat

from wabt.

walksanatora avatar walksanatora commented on July 20, 2024

(also totally not considering implementing my own WASM VM in lua since the only wasm2lua I can find is broken and apparently abandoned)

from wabt.

walksanatora avatar walksanatora commented on July 20, 2024

afterall for my specific binary I would only have to implement 101 diffrent opcodes (not including some other important stuff)

from wabt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.