2017-03-10 7 views
-1

私は以下のメソッドを呼び出すことができます。 Cの文字列を返します。WinDBGでC++メソッドインスタンスを呼び出して結果を出力する

GDBでは、この呼び出しを使用して結果を出力します。 kCurrentScopeインスタンスが利用できるように、呼び出す前に適切なスレッドとフレームを設定する必要があることに注意してください。

printf "%s\n", mongo::mozjs::kCurrentScope->buildStackString().c_str() 

CDB/WinDbgの中でこれを行う方法はありますか?

0:002> x mongo!mongo::mozjs::kCurrentScope 
000000bb`46c318f0 mongo!mongo::mozjs::kCurrentScope = 0x000000bb`4b7088a0 

興味深いことに、Windowsではこの機能が表示されません。それは関数がインライン化されていることが考えられ

0:002> x mongo!*buildStackString* 
00007ff7`c387db40 mongo!JS::BuildStackString (struct JSContext *, class JS::Handle<JSObject *>, class JS::MutableHandle<JSString *>, unsigned int64) 
00007ff7`c3b266cc mongo!`JS::BuildStackString'::`1'::dtor$9 (class JS::Handle<JSObject *>, class JS::MutableHandle<JSString *>) 
00007ff7`c3b266c0 mongo!`JS::BuildStackString'::`1'::dtor$8 (class JS::Handle<JSObject *>, class JS::MutableHandle<JSString *>) 
00007ff7`c3b266b4 mongo!`JS::BuildStackString'::`1'::dtor$1 (class JS::Handle<JSObject *>, class JS::MutableHandle<JSString *>) 
00007ff7`c3b26680 mongo!`JS::BuildStackString'::`1'::dtor$0 (class JS::Handle<JSObject *>, class JS::MutableHandle<JSString *>) 
00007ff7`c3b266e4 mongo!`JS::BuildStackString'::`1'::dtor$3 (class JS::Handle<JSObject *>, class JS::MutableHandle<JSString *>) 
00007ff7`c3b266d8 mongo!`JS::BuildStackString'::`1'::dtor$2 (class JS::Handle<JSObject *>, class JS::MutableHandle<JSString *>) 
00007ff7`c3b266fc mongo!`JS::BuildStackString'::`1'::dtor$5 (class JS::Handle<JSObject *>, class JS::MutableHandle<JSString *>) 
00007ff7`c3b266f0 mongo!`JS::BuildStackString'::`1'::dtor$4 (class JS::Handle<JSObject *>, class JS::MutableHandle<JSString *>) 
00007ff7`c3b26698 mongo!`JS::BuildStackString'::`1'::dtor$7 (class JS::Handle<JSObject *>, class JS::MutableHandle<JSString *>) 
00007ff7`c3b2668c mongo!`JS::BuildStackString'::`1'::dtor$6 (class JS::Handle<JSObject *>, class JS::MutableHandle<JSString *>) 


0:002> .call mongo!mongo::mozjs::buildStackString(kCurrentScope) 
Couldn't resolve error at 'mongo!mongo::mozjs::buildStackString(kCurrentScope)' 
0:002> .call mongo!mongo::mozjs::buildStackString(mongo!mongo::mozjs::kCurrentScope) 
Couldn't resolve error at 'mongo!mongo::mozjs::buildStackString(mongo!mongo::mozjs::kCurrentScope)' 
+2

を試すことができ、シンボルの検索

std::string MozJSImplScope::buildStackString() { JS::RootedObject stack(_context); if (! JS::CaptureCurrentStack(_context, &stack)) { return {}; } JS::RootedString out(_context); if (JS::BuildStackString(_context, stack, &out, 0)) { return JSStringWrapper(_context, out.get()).toString(); } else { return {}; } } 

として定義されますすべての発信者と体は未使用として最適化されていますか? –

+0

インライン化されていないようです。シンボルから伝える方法はありますか? –

答えて

0

を返します(一部制限あり)pykdでそれを行うために See example

+0

WinDBGから関数を呼び出すことができると仮定します。 PyKdは、元の質問を解決できる場合には素晴らしいものです。 –

+0

PyKDは関数とクラスのメソッドを呼び出すことができます(いくつかの制限があります:パラメータの整数型のみがサポートされています)。 – ussrhero

+0

これはどのように動作するかを実例で説明できますか? –

関連する問題