Print this page
4054 dis sometimes decides random symbols are functions


  96         }
  97 }
  98 
  99 /*
 100  * The main disassembly routine.  Given a fixed-sized buffer and starting
 101  * address, disassemble the data using the supplied target and libdisasm handle.
 102  */
 103 void
 104 dis_data(dis_tgt_t *tgt, dis_handle_t *dhp, uint64_t addr, void *data,
 105     size_t datalen)
 106 {
 107         dis_buffer_t db = { 0 };
 108         char buf[BUFSIZE];
 109         char symbuf[BUFSIZE];
 110         const char *symbol;
 111         const char *last_symbol;
 112         off_t symoffset;
 113         int i;
 114         int bytesperline;
 115         size_t symsize;
 116         int isfunc;
 117         size_t symwidth = 0;
 118 
 119         db.db_tgt = tgt;
 120         db.db_data = data;
 121         db.db_addr = addr;
 122         db.db_size = datalen;
 123 
 124         dis_set_data(dhp, &db);
 125 
 126         if ((bytesperline = dis_max_instrlen(dhp)) > 6)
 127                 bytesperline = 6;
 128 
 129         symbol = NULL;
 130 
 131         while (addr < db.db_addr + db.db_size) {
 132 
 133                 if (dis_disassemble(dhp, addr, buf, BUFSIZE) != 0) {
 134 #if defined(__sparc)
 135                         /*
 136                          * Since sparc instructions are fixed size, we




  96         }
  97 }
  98 
  99 /*
 100  * The main disassembly routine.  Given a fixed-sized buffer and starting
 101  * address, disassemble the data using the supplied target and libdisasm handle.
 102  */
 103 void
 104 dis_data(dis_tgt_t *tgt, dis_handle_t *dhp, uint64_t addr, void *data,
 105     size_t datalen)
 106 {
 107         dis_buffer_t db = { 0 };
 108         char buf[BUFSIZE];
 109         char symbuf[BUFSIZE];
 110         const char *symbol;
 111         const char *last_symbol;
 112         off_t symoffset;
 113         int i;
 114         int bytesperline;
 115         size_t symsize;
 116         int isfunc = 0;
 117         size_t symwidth = 0;
 118 
 119         db.db_tgt = tgt;
 120         db.db_data = data;
 121         db.db_addr = addr;
 122         db.db_size = datalen;
 123 
 124         dis_set_data(dhp, &db);
 125 
 126         if ((bytesperline = dis_max_instrlen(dhp)) > 6)
 127                 bytesperline = 6;
 128 
 129         symbol = NULL;
 130 
 131         while (addr < db.db_addr + db.db_size) {
 132 
 133                 if (dis_disassemble(dhp, addr, buf, BUFSIZE) != 0) {
 134 #if defined(__sparc)
 135                         /*
 136                          * Since sparc instructions are fixed size, we