Hi Thomas,
So that's a limitation of source maps, it only provides source code
information, not compiled type layout. I'm currently working on a PR that
can generate supplemental type layout at compile time for dumping objects
while debugging, and should have some code available for that later
today/tomorrow. You'll need to compile a custom version of Emscripten at
this point to leverage that.
Another solution that I have used in the past is to define a virtual class
with a dump method that can pretty print for you.
class Dumpable
{
virtual std::string dump() {}
}
Then you have a method that can take a pointer to dumpable and expose it to
Javascript
void dump_obj(Dumpable *d) {
printf("%s", d->dump()->c_str());
}
EMSCRIPTEN_BINDINGS(dumper) {
function("dump_obj", &dump_obj);
}
In any classes you want to be able to visualize that way, you just have
them inherit from Dumpable and implement the dump funciton.
On Tuesday, March 15, 2016 at 5:30:17 AM UTC-7, Thomas Arnbjerg wrote:
>
> Hi all,
>
> I've the following code elements:
>
> Class1
> {
> private:
> int member;
> public:
> Class1(int _initialValueOfmember); // Sets member to
> _initialValueOfMember
> int getMember();
>
> }
>
>
> The main function is:
>
> #include <iostream>
>
> int main(int argc, char** argv)
> {
> Class1 cl1(10), cl2(20);
> std::cout<< cl1.getMember()<<std::endl;
> std::cout<< cl2.getMember()<<std::endl;
> }
>
>
> How do I see the value of 'member' for cl1 and cl2 in the browser, when
> debugging with source maps in the browser? I can see the 'address' of cl1
> and cl2 as numbers.
>
> Thanks
>
> Thomas
>
--
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].
For more options, visit https://groups.google.com/d/optout.