Print this page
saveargs: let disasm do the lifting

@@ -22,12 +22,10 @@
 /*
  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-#pragma ident   "%Z%%M% %I%     %E% SMI"
-
 #include <libdisasm.h>
 #include <stdlib.h>
 #include <stdio.h>
 
 #include "dis_tables.h"

@@ -243,5 +241,14 @@
 
 done:
         dis_free(hist, sizeof (uint64_t) * n);
         return (res);
 }
+
+int
+dis_instrlen(dis_handle_t *dhp, uint64_t pc)
+{
+        if (dis_disassemble(dhp, pc, NULL, 0) != 0)
+                return (-1);
+
+        return (dhp->dh_addr - pc);
+}