Yes, that's correct. WebAssembly is a Harvard architecture <https://en.wikipedia.org/wiki/Harvard_architecture>, so there is no program counter. In Emscripten there are APIs to parse the WebAssembly binary and compute fake PC values as offsets into the binary, but I do not recommend using them for anything. They are very low-level and heavyweight. They were essentially added as a hack to make AddressSanitizer error reporting work correctly.
On Fri, Dec 13, 2019 at 9:55 AM yowl yowlxx <[email protected]> wrote: > Thanks, I dont need to read it, and the virtual memory addresses are what > I want. Are you saying there is no equivalent of a program counter? > > On Friday, December 13, 2019 at 12:33:21 PM UTC-5, Thomas Lively wrote: >> >> WebAssembly's code does not live in linear memory, so instructions and >> functions do not have addresses at all. You could make up some numbers to >> make your code work, but you will never be able to read the code out of >> memory. >> >> On Fri, Dec 13, 2019 at 9:24 AM yowl yowlxx <[email protected]> wrote: >> >>> Hi, >>> >>> I'm porting some code to wasm, and wondered if there was anything >>> equivalent to >>> >>> extern char __managedcode_a __asm("section$start$__TEXT$__managedcode"); >>> extern char __managedcode_z __asm("section$end$__TEXT$__managedcode") >>> >>> ? >>> >>> This is getting the start and end of code section in memory, so I guess >>> the start will always be 0, but the end? I could do 0xffffffff which might >>> be ok for my purposes, but is there anything like the actual end of the >>> wasm code? >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "emscripten-discuss" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/emscripten-discuss/ef3f23a8-33d1-463e-9de4-50725eef2624%40googlegroups.com >>> <https://groups.google.com/d/msgid/emscripten-discuss/ef3f23a8-33d1-463e-9de4-50725eef2624%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/emscripten-discuss/b4bb2d64-f5e4-4369-8b2d-61217cdf09a7%40googlegroups.com > <https://groups.google.com/d/msgid/emscripten-discuss/b4bb2d64-f5e4-4369-8b2d-61217cdf09a7%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CAJZD_EWUDaQmSrmbq31PAzpVTv0fWf5EsO-Ebhxq1s%2BsaPxZ5w%40mail.gmail.com.
