dbg 工具使用

主要步骤自己记下

dbg:tracer()

dbg:p(Pid,Flags)

Flags can be a single atom, or a list of flags. The available flags are:

s (send)

Traces the messages the process sends.

r (receive)

Traces the messages the process receives.

m (messages)

Traces the messages the process receives and sends.

c (call)

Traces global function calls for the process according to the trace patterns set in the system (see tp/2).

p (procs)

Traces process related events to the process.

 

官方文档http://www.erlang.org/doc/man/dbg.html

测试的例子

Eshell V5.7.4  (abort with ^G)

2> ls                    

2> ().

.test_dbg.erl.swp     test_dbg.beam         test_dbg.erl          

test_dbg.erl~         

ok

3> Pid = test_dbg:test().

<0.38.0>

4> dbg:tracer().

{ok,<0.40.0>}

5> dbg:p(Pid,[m,proces]).

{error,{bad_flags,[proces]}}

6> Pid.

<0.38.0>

7> dbg:p(Pid,[m,procs]). 

{ok,[{matched,nonode@nohost,1}]}

8> test_dbg:send(Pid).

(<0.38.0>) << {<0.35.0>,test}

(<0.38.0>) <0.35.0> ! returnok

returnok

(<0.38.0>) exit normal

9> test_dbg:send(Pid).

timeout

10> f(),Pid = test_dbg:test().

<0.48.0>

11> test_dbg:send(Pid).       

returnok

12> f(),Pid = test_dbg:test().

<0.51.0>

13> dbg:p(Pid,[m,procs]).     

{ok,[{matched,nonode@nohost,1}]}

14> test_dbg:send(Pid).       

(<0.51.0>) << {<0.35.0>,test}

(<0.51.0>) <0.35.0> ! returnok

(<0.51.0>) exit normal

returnok

15> dbg:p(Pid,[call...   

{ok,[{matched,nonode@nohost,0,{no_proc,<0.51.0>}}]}

16> f(),Pid = test_dbg:test().

<0.56.0>

17> dbg:p(Pid,[call]).        

{ok,[{matched,nonode@nohost,1}]}

18> test_dbg:send(Pid).       

returnok

19> f(),Pid = test_dbg:test().

<0.60.0>

20> dbg:p(Pid,[s]).           

{ok,[{matched,nonode@nohost,1}]}

21> test_dbg:send(Pid).       

(<0.60.0>) <0.35.0> ! returnok

returnok

22> dbg:p(Pid,[r]).    

{ok,[{matched,nonode@nohost,0,{no_proc,<0.60.0>}}]}

23> f(),Pid = test_dbg:test().

<0.65.0>

24> dbg:p(Pid,[r]).           

{ok,[{matched,nonode@nohost,1}]}

25> test_dbg:send(Pid).       

returnok

26> (<0.65.0>) << {<0.35.0>,test}

 

26> f(),Pid = test_dbg:test().

<0.69.0>

27> dbg:p(Pid,[m]).           

{ok,[{matched,nonode@nohost,1}]}

28> test_dbg:send(Pid).       

(<0.69.0>) << {<0.35.0>,test}

(<0.69.0>) <0.35.0> ! returnok

returnok

29> f(),Pid = test_dbg:test().

<0.73.0>

30> dbg:p(Pid,[c]).           

{ok,[{matched,nonode@nohost,1}]}

31> test_dbg:send(Pid).       

returnok

32> f(),Pid = test_dbg:test().

<0.77.0>

33> test_dbg:send(Pid).       

returnok

34> f(),Pid = test_dbg:test().

<0.80.0>

35> dbg:p(Pid,[p]).           

{ok,[{matched,nonode@nohost,1}]}

36> test_dbg:send(Pid).       

(<0.80.0>) exit normal

returnok

37> f(),Pid = test_dbg:test().

<0.84.0>

38> dbg:p(Pid,[sos]).         

{ok,[{matched,nonode@nohost,1}]}

39> test_dbg:send(Pid).       

returnok

40> dbg:p(Pid,[sos]).  

{ok,[{matched,nonode@nohost,0,{no_proc,<0.84.0>}}]}

41> f(),Pid = test_dbg:test().

<0.89.0>

42> dbg:p(Pid,[all]).         

{ok,[{matched,nonode@nohost,1}]}

43> test_dbg:send(Pid).       

(<0.89.0>) << {<0.35.0>,test}

(<0.89.0>) in {test_dbg,hello,0}

(<0.89.0>) <0.35.0> ! returnok

(<0.89.0>) exit normal

returnok

44> dbg:p(Pid,[clear]).

{ok,[{matched,nonode@nohost,0,{no_proc,<0.89.0>}}]}

45> f(),Pid = test_dbg:test().

<0.94.0>

46> dbg:p(Pid,[clear]).       

{ok,[{matched,nonode@nohost,1}]}

47> test_dbg:send(Pid).       

returnok

48> dbg:get_tracer().  

{ok,<0.41.0>}

49> dbg:get_tracer().

{ok,<0.41.0>}

50> dbg:get_tracer().

{ok,<0.41.0>}

51> dbg:t

tp/2                  tp/3                  tp/4                  

tpl/2                 tpl/3                 tpl/4                 

trace_client/2        trace_client/3        trace_port/2          

trace_port_control/1  trace_port_control/2  tracer/0              

tracer/2              tracer/3              transform_flags/1     

 

51> dbg:tp

tp/2   tp/3   tp/4   tpl/2  tpl/3  tpl/4  

51> dbg:tp(test_dbg,[])

51> .

{ok,[{matched,nonode@nohost,5}]}

52> f(),Pid = test_dbg:test().

<0.102.0>

53> test_dbg:send(Pid).       

returnok

54> dbg:get_tracer().         

{ok,<0.41.0>}

55> f(),Pid = test_dbg:test().

<0.106.0>

56> dbg:p(Pid,[all]).         

{ok,[{matched,nonode@nohost,1}]}

57> dbg:tp(test_dbg,[])       

57> .

{ok,[{matched,nonode@nohost,5}]}

58> test_dbg:send(Pid).       

(<0.106.0>) << {<0.35.0>,test}

(<0.106.0>) in {test_dbg,hello,0}

(<0.106.0>) <0.35.0> ! returnok

(<0.106.0>) exit normal

returnok

59> dbg:get_tracer().         

{ok,<0.41.0>}

60> f(),Pid = test_dbg:test().

<0.112.0>

61> dbg:p(Pid,[]).            

{ok,[{matched,nonode@nohost,1}]}

62> dbg:tp(test_dbgs,[])      

62> .

{ok,[{matched,nonode@nohost,0}]}

63> test_dbg:send(Pid).       

returnok

64> test_dbg:send(Pid).       

timeout


 

 1 -module(test_dbg).
  2 -export([send/1, test/0, hello/0]).
  3 
  4 test() ->
  5     Pid = spawn(?MODULE, hello, []),
  6     Pid.
  7 
  8 send(Pid) ->
  9     Pid ! {self(),test},
 10     loop().
 11 
 12 hello() ->
 13     receive 
 14         {P,test} ->
 15             P ! returnok
 16     end,
 17     ok.
 18 loop() ->
 19     receive 
 20         T ->
 21             T
 22     after 11 ->
 23         timeout
 24     end.                                                                         
"test_dbg.erl" 24L, 341C 已写入                                    24,8         全部
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: x64dbg是一款功能强大的开源反汇编器和调试器,它可以帮助程序员调试、反汇编和逆向工程Windows x64平台上的程序。但是,这款工具的英文界面也许会给不熟悉英文的用户带来困惑,因此需要中文使用文档来帮助他们更好地使用。 x64dbg中文使用文档需要包含以下内容: 1. 界面说明: x64dbg的界面相对较为复杂,包括菜单栏、工具栏、快捷键、调试窗口等。需要对每个部分进行解释和说明,让用户了解其作用和功能。 2. 基本功能: x64dbg的基本功能包括反汇编、调试、断点、跟踪、变量监视等。需要详细介绍每个功能的使用方法和注意事项。 3. 插件使用:x64dbg支持插件,插件可以扩展功能,如反混淆、加壳解壳、自动化脚本等。需要介绍常用的插件和如何安装和使用。 4. 常用场景: 需要详细介绍在具体场景下如何使用x64dbg,例如调试崩溃的程序、反汇编目标文件等等。 5. 错误处理:最后需要介绍x64dbg使用过程中可能出现的一些错误和如何处理。 总之,一份具有实际应用场景的、详细全面的x64dbg中文使用文档将使用户更快捷地掌握这款工具,更好地应对实际应用中的需求。 ### 回答2: x64dbg是一款十分优秀的反汇编工具,通过它的使用可以方便地对程序进行调试和分析。由于x64dbg的界面和操作上的设置较复杂,对于初学者而言,了解如何使用x64dbg也许是一件颇具挑战性的事情。然而,很幸运的是,我们可以很方便地找到x64dbg中文使用文档,从而帮助我们更好地掌握这一工具。 在x64dbg中文使用文档中,我们可以轻松地找到该工具的安装、启动、调试等操作的详细说明。此外,文档中还有各种截图和实例,帮助我们更加深入理解和掌握x64dbg使用方法。在文档中,一些常见的问题也有解答,这对于我们解决一些潜在的x64dbg使用难题也十分有帮助。 总之,x64dbg中文使用文档的出现对于那些打算使用这一工具的初学者而言,可以极大地减少其入门的难度。通过文档的认真学习和实践,我们可以更加熟练地使用x64dbg,并且不断探索一些更深层次的应用。同时,也希望这些文档的贡献者们能够一直坚持下去,不断更新、完善,以帮助更多的人更加深入地理解x64dbg的理论和应用。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值