Changeset 1038
- Timestamp:
- 07/15/10 15:12:39 (3 years ago)
- Files:
-
- 1 modified
-
trunk/size/size.c (modified) (21 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/size/size.c
r1037 r1038 88 88 }; 89 89 90 uint64_t bss_size, data_size, text_size, total_size; 91 uint64_t bss_size_total, data_size_total, text_size_total; 92 93 int show_totals; 94 95 enum radix_style radix = RADIX_DECIMAL; 96 enum output_style style = STYLE_BERKELEY; 97 98 const char *default_args[2] = { "a.out", NULL }; 99 100 enum { 101 OPT_FORMAT, 102 OPT_RADIX 103 }; 104 105 struct { 90 static uint64_t bss_size, data_size, text_size, total_size; 91 static uint64_t bss_size_total, data_size_total, text_size_total; 92 static int show_totals; 93 static int size_option; 94 static enum radix_style radix = RADIX_DECIMAL; 95 static enum output_style style = STYLE_BERKELEY; 96 static const char *default_args[2] = { "a.out", NULL }; 97 98 static struct { 106 99 int row; 107 100 int col; … … 110 103 } *tb; 111 104 112 int size_option; 105 enum { 106 OPT_FORMAT, 107 OPT_RADIX 108 }; 113 109 114 110 static struct option size_longopts[] = { … … 121 117 }; 122 118 123 void berkeley_calc(GElf_Shdr *);124 void berkeley_footer(const char *, const char *, const char *);125 void berkeley_header(void);126 void berkeley_totals(void);127 int handle_core(char const *, Elf *elf, GElf_Ehdr *);128 void handle_core_note(Elf *, GElf_Ehdr *, GElf_Phdr *, char **);129 int handle_elf(char const *);130 void handle_phdr(Elf *, GElf_Ehdr *, GElf_Phdr *, uint32_t,131 const char *);132 void show_version(void);133 void sysv_header(const char *, Elf_Arhdr *);134 void sysv_footer(void);135 void sysv_calc(Elf *, GElf_Ehdr *, GElf_Shdr *);136 void usage(void);137 void tbl_new(int);138 void tbl_print(const char *, int);139 void tbl_print_num(uint64_t, enum radix_style, int);140 void tbl_append(void);141 void tbl_flush(void);119 static void berkeley_calc(GElf_Shdr *); 120 static void berkeley_footer(const char *, const char *, const char *); 121 static void berkeley_header(void); 122 static void berkeley_totals(void); 123 static int handle_core(char const *, Elf *elf, GElf_Ehdr *); 124 static void handle_core_note(Elf *, GElf_Ehdr *, GElf_Phdr *, char **); 125 static int handle_elf(char const *); 126 static void handle_phdr(Elf *, GElf_Ehdr *, GElf_Phdr *, uint32_t, 127 const char *); 128 static void show_version(void); 129 static void sysv_header(const char *, Elf_Arhdr *); 130 static void sysv_footer(void); 131 static void sysv_calc(Elf *, GElf_Ehdr *, GElf_Shdr *); 132 static void usage(void); 133 static void tbl_new(int); 134 static void tbl_print(const char *, int); 135 static void tbl_print_num(uint64_t, enum radix_style, int); 136 static void tbl_append(void); 137 static void tbl_flush(void); 142 138 143 139 /* … … 288 284 * Parse individual note entries inside a PT_NOTE segment. 289 285 */ 290 void286 static void 291 287 handle_core_note(Elf *elf, GElf_Ehdr *elfhdr, GElf_Phdr *phdr, 292 288 char **cmd_line) … … 459 455 * data, bss size is calculated for them. 460 456 */ 461 void457 static void 462 458 handle_phdr(Elf *elf, GElf_Ehdr *elfhdr, GElf_Phdr *phdr, 463 459 uint32_t idx, const char *name) … … 511 507 * Given a core dump file, this function maps program headers to segments. 512 508 */ 513 int509 static int 514 510 handle_core(char const *name, Elf *elf, GElf_Ehdr *elfhdr) 515 511 { … … 595 591 * or the size of the text, data, bss sections will be printed out. 596 592 */ 597 int593 static int 598 594 handle_elf(char const *name) 599 595 { … … 675 671 * Sysv formatting helper functions. 676 672 */ 677 void673 static void 678 674 sysv_header(const char *name, Elf_Arhdr *arhdr) 679 675 { … … 691 687 } 692 688 693 void689 static void 694 690 sysv_calc(Elf *elf, GElf_Ehdr *elfhdr, GElf_Shdr *shdr) 695 691 { … … 709 705 } 710 706 711 void707 static void 712 708 sysv_footer(void) 713 709 { … … 721 717 * berkeley style output formatting helper functions. 722 718 */ 723 void719 static void 724 720 berkeley_header(void) 725 721 { … … 743 739 } 744 740 745 void741 static void 746 742 berkeley_calc(GElf_Shdr *shdr) 747 743 { … … 762 758 } 763 759 764 void760 static void 765 761 berkeley_totals(void) 766 762 { … … 779 775 } 780 776 781 void777 static void 782 778 berkeley_footer(const char *name, const char *ar_name, const char *msg) 783 779 { … … 811 807 812 808 813 void809 static void 814 810 tbl_new(int col) 815 811 { … … 827 823 } 828 824 829 void825 static void 830 826 tbl_print(const char *s, int col) 831 827 { … … 841 837 } 842 838 843 void839 static void 844 840 tbl_print_num(uint64_t num, enum radix_style rad, int col) 845 841 { … … 851 847 } 852 848 853 void849 static void 854 850 tbl_append(void) 855 851 { … … 866 862 } 867 863 868 void864 static void 869 865 tbl_flush(void) 870 866 { … … 922 918 -x Equivalent to `--radix=16'.\n"; 923 919 924 void920 static void 925 921 usage(void) 926 922 { … … 929 925 } 930 926 931 void927 static void 932 928 show_version(void) 933 929 {