Revision: 969 Author: teawater Date: Mon Mar 12 22:23:19 2012 Log: Update hotcode.py http://code.google.com/p/kgtp/source/detail?r=969 Modified: /branches/hotcode/hotcode.py ======================================= --- /branches/hotcode/hotcode.py Mon Mar 12 08:18:01 2012 +++ /branches/hotcode/hotcode.py Mon Mar 12 22:23:19 2012 @@ -9,6 +9,8 @@ import os import signal +debug_dir = "/usr/lib/debug/" + from operator import itemgetter def dict_sort(d, reverse=False): #proposed in PEP 265, using the itemgetter @@ -144,6 +146,7 @@ gdb.execute("set pagination off", True, False) gdb.execute("set confirm off", True, False) gdb.execute("set circular-trace-buffer on", True, False) +gdb.execute("set debug-file-directory "+debug_dir, True, False) try: gdb.execute("kill", True, False) except: @@ -184,9 +187,11 @@ orig_user_dir = user_dir = os.path.realpath("/proc/"+str(pid)+"/exe") except: #maybe this is the kernel task- print "Cannot get the user code info of thie pid, will not parse the code symbol" + print "Cannot get the user code info of this pid, will not parse the user level code symbol"
task_list[pid] = (fid, user_dir, {}, {}) continue + if os.path.exists(debug_dir+user_dir): + user_dir = debug_dir+user_dir while 1: tmp = "" try: @@ -196,6 +201,10 @@ if tmp != "": user_dir = os.path.realpath(tmp) break + if not os.path.exists(user_dir):+ print "Cannot get the user code info of this pid, will not parse the user level code symbol"
+ task_list[pid] = (fid, user_dir, {}, {}) + continue print "Use "+user_dir+" as debug binary." fid = add_inferior() if fid < 0: @@ -476,6 +485,10 @@ filename_offset = sym.find(" of ") if filename_offset > 0: function += sym[filename_offset:] + else: + function = "" + if function == "": + function = "Unknown address" return function if no_task: