·¢ÐÅÈË: lhh.bbs@argo.zsu.edu.cn (ÒÐÌì), ÐÅÇø: cnunix
±ê  Ìâ: GDB (7) Part One(ת¼Ä)
·¢ÐÅÕ¾: Yat-sen Channel BBS (Wed Jul 29 19:00:52 1998)
תÐÅÕ¾: Lilac!ustcnews!news.zsu.edu.cn!argo
³ö  ´¦: argo.zsu.edu.cn



½áÊø×Ó½ø³Ì
=========================
`kill'
     KillÃüÁî½áÊøÄã³ÌÐòÔÚgdbÏ¿ªµÄ×Ó½ø³Ì
     Õâ¸öÃüÁîµ±ÄãÏëÒªµ÷ÊÔ(¼ì²é)Ò»¸öcore dumpÎļþʱ¸üÓÐÓá£gdbÔÚµ÷ÊÔ¹ý³ÌÖÐ
»áºöÂÔËùÓеÄcore dump¡£
   ÔÚһЩ²Ù×÷ϵͳÉÏ£¬Ò»¸ö³ÌÐòµ±ÄãÔÚÉÏÃæ¼ÓÁ˶ϵãÒÔºó¾Í²»ÄÜÀ뿪gdb¶ÀÁ¢ÔËÐС£
Äã¿ÉÒÔÓÃkillÃüÁîÀ´½â¾öÕâ¸öÎÊÌâ¡£
   'kill'ÃüÁîµ±ÄãÏëÖØбàÒëºÍÁ¬½ÓÄãµÄ³ÌÐòʱҲºÜÓÐÓá£ÒòΪÓÐЩϵͳ²»ÔÊÐíÐÞ¸Ä
ÕýÔÚÖ´ÐеĿÉÖ´ÐгÌÐò¡£ÕâÑùµ±ÄãÔÙÒ»´ÎʹÓÃ'run'ÃüÁîʱgdb»áÖªµÀÄãµÄ³ÌÐòÒѾ­±»¸Ä
±äÁË£¬ÄÇôgdb»áÖØÐÂloadеķûºÅ¡£(¶øÇÒ¾¡Á¿±£³ÖÄ㵱ǰµÄ¶ÏµãÉèÖá£
¸½¼ÓµÄ½ø³ÌÐÅÏ¢
==============================
   Ò»Ð©²Ù×÷ϵͳÌṩÁËÒ»¸öÉ豸Ŀ¼½Ð×ö'/proc'µÄ£¬¹©¼ì²é½ø³ÌÓ³Ïó¡£Èç¹ûgdb±»ÔÚÕâ
ÑùµÄ²Ù×÷ϵͳÏÂÔËÐУ¬Äã¿ÉÒÔʹÓÃÃüÁî'info proc'À´²éѯ½ø³ÌµÄÐÅÏ¢¡£('info proc'Ãü
ÁîÖ»ÔÚÖ§³Ö'procfs'µÄSVR4ϵͳÉÏÓÐÓá£
`info proc'
     ÏÔʾ½ø³ÌµÄ¸ÅÒªÐÅÏ¢¡£
`info proc mappings'
     ±¨¸æÄã½ø³ÌËùÄÜ·ÃÎʵĵØÖ··¶Î§¡£
`info proc times'
     Äã½ø³ÌºÍ×Ó½ø³ÌµÄ¿ªÊ¼Ê±¼ä£¬Óû§Ê±¼ä(user CPU time),ºÍϵͳCPUʱ¼ä¡£
`info proc id'
     ±¨¸æÓйؽø³ÌidµÄÐÅÏ¢¡£
`info proc status'
     ±¨¸æÄã½ø³ÌµÄÒ»°ã״̬ÐÅÏ¢¡£Èç¹û½ø³ÌÍ£Ö¹ÁË¡£Õâ¸ö±¨¸æ»¹°üÀ¨Í£Ö¹µÄÔ­ÒòºÍÊÕµ½µÄ
Ðźš£
`info proc all'
     ÏÔʾÉÏÃæÕâЩÃüÁî·µ»ØµÄËùÓÐÐÅÏ¢¡£
¶Ô¶àÏ̳߳ÌÐòµÄµ÷ÊÔ
========================================
   Ò»Ð©²Ù×÷ϵͳÖУ¬Ò»¸öµ¥¶ÀµÄ³ÌÐò¿ÉÒÔÓÐÒ»¸öÒÔÉϵÄÏß³ÌÔÚÔËÐС£Ï̺߳ͽø³Ì¾«È·µÄ¶¨Ò
å

Ó
Ö
ÓÐ×Ô¼ºµÄ¼Ä´æÆ÷£¬ÔËÐÐʱ¶ÑÕ»»òÐí»¹»áÓÐ˽ÓÐÄÚ´æ¡£
   gdbÌṩÁËÒÔϹ©µ÷ÊÔ¶àÏ̵߳Ľø³ÌµÄ¹¦ÄÜ£º
   * ×Ô¶¯Í¨¸æÐÂÏ̡߳£
   * 'thread THREADNO'£¬Ò»¸öÓÃÀ´ÔÚÏß³ÌÖ®¼äÇл»µÄÃüÁî¡£
   * 'info threads'£¬Ò»¸öÓÃÀ´²éѯÏÖ´æÏ̵߳ÄÃüÁî¡£
   * 'thread apply [THREADNO] [ALL] ARGS',Ò»¸öÓÃÀ´ÏòÏß³ÌÌṩÃüÁîµÄÃüÁî¡£
   * Ïß³ÌÓйصĶϵãÉèÖá£
   ×¢Ò⣺ÕâЩÌØÐÔ²»ÊÇÔÚËùÓÐgdb°æ±¾¶¼ÄÜʹÓ㬹é¸ù½áµ×Òª¿´²Ù×÷ϵͳÊÇ·ñÖ§³Ö¡£
   Èç¹ûÄãµÄgdb²»Ö§³ÖÕâЩÃüÁ»áÏÔʾ³ö´íÐÅÏ¢£º
          (gdb) info threads
          (gdb) thread 1
          Thread ID 1 not known.  Use the "info threads" command to
          see the IDs of currently known threads.
   gdbµÄÏ̼߳¶µ÷ÊÔ¹¦ÄÜÔÊÐíÄã¹Û²ìÄã³ÌÐòÔËÐÐÖÐËùÓеÄỊ̈߳¬µ«ÎÞÂÛʲôʱºò
gdb¿ØÖÆ£¬×ÜÓÐÒ»¸ö¡°µ±Ç°¡±Ï̡߳£µ÷ÊÔÃüÁî¶Ô¡°µ±Ç°¡±½ø³ÌÆð×÷Óá£
   Ò»µ©gdb·¢ÏÖÁËÄã³ÌÐòÖеÄÒ»¸öеÄỊ̈߳¬Ëü»á×Ô¶¯ÏÔʾÓйشËÏ̵߳ÄϵͳÐÅ
Ï¢¡£±ÈÈ磺
     [New process 35 thread 27]
²»¹ý¸ñʽºÍ²Ù×÷ϵͳÓйء£
   ÎªÁ˵÷ÊÔµÄÄ¿µÄ£¬gdb×Ô¼ºÉèÖÃÏ̺߳š£
`info threads'
     ÏÔʾ½ø³ÌÖÐËùÓеÄÏ̵߳ĸÅÒªÐÅÏ¢¡£gdb°´Ë³ÐòÏÔʾ£º
       1.Ï̺߳Å(gdbÉèÖÃ)
       2.Ä¿±êϵͳµÄÏ̱߳êʶ¡£
       3.´ËÏ̵߳ĵ±Ç°¶ÑÕ»¡£
       Ò»Ç°Ãæ´ò'*'µÄÏ̱߳íʾÊǵ±Ç°Ï̡߳£
     ÀýÈ磺
     (gdb) info threads
       3 process 35 thread 27  0x34e5 in sigpause ()
       2 process 35 thread 23  0x34e5 in sigpause ()
     * 1 process 35 thread 13  main (argc=1, argv=0x7ffffff8)
         at threadtest.c:68

--

--
¡ù À´Ô´:£®Yat-sen Channel argo.zsu.edu.cn£®[FROM: www.ee.zsu.edu.c]
[°Ù±¦Ïä] [·µ»ØÊ×Ò³] [Éϼ¶Ä¿Â¼] [¸ùĿ¼] [·µ»Ø¶¥²¿] [Ë¢ÐÂ] [·µ»Ø]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
Ò³ÃæÖ´ÐÐʱ¼ä£º3.605ºÁÃë