Commits

matusz  committed 8563f0a

subprogram list sortin now takes both offset values into account

  • Participants
  • Parent commits a5ff4d0

Comments (0)

Files changed (1)

File dp_stdout.py

   dumpDict("date_dict", pcodedata.date_dict)
   dumpDict("dev_dict", pcodedata.dev_dict)
 
+def cmpSymbEntry(x,y):
+  if x['off2']==y['off2']:
+    return cmp(x['off1'],y['off1'])
+  else:
+    return cmp(x['off2'],y['off2'])
+
 def formatD(params, startpos, bytecount, format):
   '''handle declip and disass formats'''
   inputfile = ExeFile(params.get("FileName"), params.get("Linker"))
       for jj in sd[ii].keys():
         if sd[ii][jj]["symbol"] == procname:
           procdata = sd[ii][jj]
-          break
-      if procdata:
+          # print "DEBUG procdata", procdata
+          # TODO: too many times the same condition is evaluated
+          if procdata["class"]=="subprogram" or procdata["class"]=="module:main":
+            break
+      if procdata and (procdata["class"]=="subprogram" or procdata["class"]=="module:main"):
         break
     if procdata and (procdata["class"]=="subprogram" or procdata["class"]=="module:main"):
       print "FOUND:", procdata
         for jj in ii.values():
           if jj['class'] in ('subprogram', 'module:main'):
             subs.append(jj)
-      for ii in sorted(subs, cmp=lambda x,y: cmp(x['off2'], y['off2'])):
+      for ii in sorted(subs, cmp=lambda x,y: cmpSymbEntry(x, y)):
         print "%10s %7d %7d" % (ii['symbol'], ii['off1'], ii['off2'])