I imagine you would need $arg0->SourcePrint() instead - otherwise, since Handle is an actual C++ class, it'll try to find SourcePrint in Handle instead of in String.
Thanks for the tips - hopefully this'll really help me analyze some stuff :). -Vitali On Fri, Jun 11, 2010 at 12:55 AM, zaheer ahmad <zaheer....@gmail.com> wrote: > Thanks soren for the Tip. This is what has worked so far (it prints > all Handles i.e. Handle<v8::String>, Handle<v8::internal::String>..) > > remove static qualifier from PrintLn in debug.cc (otherwise macros > dont recognize the function) > void PrintLn(v8::Local<v8::Value> value) { > > Add following to .gdbinit: > define ps > print v8::internal::PrintLn($arg0) > end > > (A simpler way would be to call $arg0.SourcePrint(), but that doesnt > work on derived objects > >> Error - Couldn't find method v8::Handle<v8::String>::SourcePrint > Its possible that GDB macros dont understand how to call virtual > functions.. > ) > > -------------Output > Breakpoint 1, ExecuteString (source={val_ = 0xa2fd6e4}, name={val_ = > 0xa2fd6e0}, print_result=false, report_exceptions=true) at > samples/shell.cc:244 > 244 v8::HandleScope handle_scope; > (gdb) ps source > function f(){print("hello");} > f(); > > $1 = void > > > Breakpoint 2, v8::internal::Compiler::Compile (source={location_ = > 0xa2fd6e4}, script_name={location_ = 0xa2fd6e0}, line_offset=0, > column_offset=0, extension=0x0, input_pre_data=0x0, script_data= > {location_ = 0x0}, natives=v8::internal::NOT_NATIVES_CODE) at > src/compiler.cc:289 > 289 int source_length = source->length(); > (gdb) ps source > function f(){print("hello");} > f(); > > $2 = void > (gdb) ps script_name > test.js > > > > 2010/6/11 Søren Gjesse <sgje...@chromium.org>: > > One option is to call one of the ShortPrint, Print or PrintLn methods on > > them (Print and PrintLn are only available in debug mode). That will > print > > their content to stdout. Note that this applies to the internal object > > types, e.g the String* in source.val_ not source itself. > > Regards, > > Søren > > On Fri, Jun 11, 2010 at 04:57, Vitali Lovich <vlov...@gmail.com> wrote: > >> > >> Hey, I'm trying to hack on v8 & I'm trying to figure out how to examine > >> the v8 variables. > >> For example, I'm trying to figure out some string parameters that are > >> passed to compile but they all come up as opaque types & I'm not sure > how to > >> retrieve the data from them. > >> (gdb) p source.val_ > >> $5 = (v8::String *) 0x8352fb4 > >> (gdb) p *(source.val_) > >> $6 = {<v8::Primitive> = {<v8::Value> = {<v8::Data> = {<No data fields>}, > >> <No data fields>}, <No data fields>}, <No data fields>} > >> Thanks, > >> Vitali > >> > >> -- > >> v8-users mailing list > >> v8-users@googlegroups.com > >> http://groups.google.com/group/v8-users > > > > -- > > v8-users mailing list > > v8-users@googlegroups.com > > http://groups.google.com/group/v8-users > > -- > v8-users mailing list > v8-users@googlegroups.com > http://groups.google.com/group/v8-users > -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users