Print this page
3317 dis(1) should support cross-target disassembly

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/dis/dis_target.c
          +++ new/usr/src/cmd/dis/dis_target.c
↓ open down ↓ 718 lines elided ↑ open up ↑
 719  719                  tgt->dt_symcache = sym;
 720  720  
 721  721          *offset = addr - sym->se_sym.st_value;
 722  722          *size = sym->se_sym.st_size;
 723  723          if (isfunc)
 724  724                  *isfunc = (GELF_ST_TYPE(sym->se_sym.st_info) == STT_FUNC);
 725  725  
 726  726          return (sym->se_name);
 727  727  }
 728  728  
 729      -#if !defined(__sparc)
 730  729  /*
 731  730   * Given an address, return the starting offset of the next symbol in the file.
 732  731   * Only needed on variable length instruction architectures.
 733  732   */
 734  733  off_t
 735  734  dis_tgt_next_symbol(dis_tgt_t *tgt, uint64_t addr)
 736  735  {
 737  736          sym_entry_t *sym;
 738  737  
 739  738          sym = (tgt->dt_symcache != NULL) ? tgt->dt_symcache : tgt->dt_symtab;
 740  739  
 741  740          while (sym != (tgt->dt_symtab + tgt->dt_symcount)) {
 742  741                  if (sym->se_sym.st_value >= addr)
 743  742                          return (sym->se_sym.st_value - addr);
 744  743                  sym++;
 745  744          }
 746  745  
 747  746          return (0);
 748  747  }
 749      -#endif
 750  748  
 751  749  /*
 752  750   * Iterate over all sections in the target, executing the given callback for
 753  751   * each.
 754  752   */
 755  753  void
 756  754  dis_tgt_section_iter(dis_tgt_t *tgt, section_iter_f func, void *data)
 757  755  {
 758  756          dis_scn_t sdata;
 759  757          Elf_Scn *scn;
↓ open down ↓ 219 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX