itmediaã®ãmain()é¢æ°ã®åã«ã¯ä½ãããã®ãããèªãã§ã¿ãï¼ç¬¬äºåï¼
itmediaã®ãmain()é¢æ°ã®åã«ã¯ä½ãããã®ããã®é£è¼ãèªãã§ããããªãã£ããã¨ãã調ã¹ããã¨ãã¡ã¢ãã
ï¼ä½è ãµãã¼ããã¼ã¸ï¼
Â
第äºåã¯"ãHello Worldï¼ãã®ä¸»å½¹printf()ã®å é¨åä½ããããã¬GDBã§è¿½ã"
Â
gdbserverã使ã話ãåºã¦ãã
https://www.codeproject.com/KB/mcpp/remote_debugging/3.jpg
Â
Â
printfã®éã¢ã»ã³ãã«çµæã®ãã¼ã¢ããã¯leaãããããªãã£ã
movã¯ã©ãã«ãæå®ããã¨ãã©ãã«ã®å ã«ããä¸èº«ãã³ãã¼ããã
leaã¯ãã¢ãã¬ã¹ã®å ã®ä¸èº«ã§ã¯ãªããã¢ãã¬ã¹ãã®ãã®ãã³ãã¼ããã
movã¯ä¸èº«ã®å¤ãleaã¯ã¢ãã¬ã¹ãã³ãã¼ããã¿ãã
Â
ãã¼ã¢ããã¯leaveãç¥ããªããª
調ã¹ã¦ã¿ãã¨ã
leave
å½ä»¤ã¯ã以ä¸ã®ï¼ã¤ã®å½ä»¤ãçµã¿åãããã®ã¨åçã®å¦çããã¾ããmov esp, ebp pop ebp
https://vanya.jp.net/os/x86call/#enterleave:~:text=leave%E5%91%BD%E4%BB%A4%E3%81%AF,ebp%0Apop%20ebp
ã¨ã®ãã¨ã
retã®åã«å¿ è¦ãªå¦çã¿ãã
retã¯ã¹ã¿ãã¯ã«ç©ã¾ãã¦ãã¢ãã¬ã¹ããå¼ã³åºããã¨ã«æ»ãå½ä»¤
ä¸ã§ãåç §ãã以ä¸ã®ãµã¤ããé¢æ°å¼ã³åºãã«ã¤ãã¦ããããããã£ã
x86ã¢ã»ã³ããªè¨èªã§ã®é¢æ°ã³ã¼ã« (vanya.jp.net)
Â
Â