#include <bfd.h>#include <libiberty.h>#include "bucomm.h"#include <sys/stat.h>#include <time.h>#include <varargs.h>Include dependency graph for bucomm.c:

Go to the source code of this file.
Defines | |
| #define | TARGET "elf32-i386" |
Functions | |
| void | bfd_nonfatal (CONST char *string) |
| void | bfd_fatal (CONST char *string) |
| void | fatal (va_alist) |
| void | set_default_bfd_target () |
| void | list_matching_formats (char **p) |
| void | list_supported_targets (char *name, FILE *f) const |
| void | print_arelt_descr (FILE *file, bfd *abfd, boolean verbose) |
| char * | make_tempname (char *filename) |
| bfd_vma | parse_vma (char *s, const char *arg) const |
Variables | |
| char * | program_name |
| #define TARGET "elf32-i386" |
| void bfd_fatal | ( | CONST char * | string | ) |
Definition at line 54 of file bucomm.c.
References bfd_nonfatal().
Referenced by set_default_bfd_target().
00056 { 00057 bfd_nonfatal (string); 00058 xexit (1); 00059 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void bfd_nonfatal | ( | CONST char * | string | ) |
Definition at line 42 of file bucomm.c.
References program_name.
Referenced by bfd_fatal(), and load_bfd().
00044 { 00045 CONST char *errmsg = bfd_errmsg (bfd_get_error ()); 00046 00047 if (string) 00048 fprintf (stderr, "%s: %s: %s\n", program_name, string, errmsg); 00049 else 00050 fprintf (stderr, "%s: %s\n", program_name, errmsg); 00051 }
Here is the caller graph for this function:

| void fatal | ( | va_alist | ) |
Definition at line 76 of file bucomm.c.
References args, and program_name.
00078 { 00079 char *Format; 00080 va_list args; 00081 00082 fprintf (stderr, "%s: ", program_name); 00083 va_start (args); 00084 Format = va_arg (args, char *); 00085 vfprintf (stderr, Format, args); 00086 va_end (args); 00087 putc ('\n', stderr); 00088 xexit (1); 00089 }
| void list_matching_formats | ( | char ** | p | ) |
Definition at line 119 of file bucomm.c.
References program_name.
Referenced by load_bfd().
00121 { 00122 fprintf(stderr, "%s: Matching formats:", program_name); 00123 while (*p) 00124 fprintf(stderr, " %s", *p++); 00125 fprintf(stderr, "\n"); 00126 }
Here is the caller graph for this function:

| void list_supported_targets | ( | char * | name, | |
| FILE * | f | |||
| ) | const |
Definition at line 131 of file bucomm.c.
References NULL.
Referenced by pstack_install_segv_action().
00134 { 00135 extern bfd_target *bfd_target_vector[]; 00136 int t; 00137 00138 if (name == NULL) 00139 fprintf (f, "Supported targets:"); 00140 else 00141 fprintf (f, "%s: supported targets:", name); 00142 for (t = 0; bfd_target_vector[t] != NULL; t++) 00143 fprintf (f, " %s", bfd_target_vector[t]->name); 00144 fprintf (f, "\n"); 00145 }
Here is the caller graph for this function:

| char* make_tempname | ( | char * | filename | ) |
Definition at line 186 of file bucomm.c.
References NULL, strcat(), strlen(), strrchr(), and xmalloc().
00188 { 00189 static char template[] = "stXXXXXX"; 00190 char *tmpname; 00191 char *slash = strrchr (filename, '/'); 00192 00193 #if defined (__DJGPP__) || defined (__GO32__) || defined (_WIN32) 00194 if (slash == NULL) 00195 slash = strrchr (filename, '\\'); 00196 #endif 00197 00198 if (slash != (char *) NULL) 00199 { 00200 char c; 00201 00202 c = *slash; 00203 *slash = 0; 00204 tmpname = xmalloc (strlen (filename) + sizeof (template) + 1); 00205 strcpy (tmpname, filename); 00206 strcat (tmpname, "/"); 00207 strcat (tmpname, template); 00208 mkstemp (tmpname); 00209 *slash = c; 00210 } 00211 else 00212 { 00213 tmpname = xmalloc (sizeof (template)); 00214 strcpy (tmpname, template); 00215 mkstemp (tmpname); 00216 } 00217 return tmpname; 00218 }
Here is the call graph for this function:

| bfd_vma parse_vma | ( | char * | s, | |
| const char * | arg | |||
| ) | const |
Definition at line 224 of file bucomm.c.
References exit, and program_name.
00227 { 00228 bfd_vma ret; 00229 const char *end; 00230 00231 ret = bfd_scan_vma (s, &end, 0); 00232 if (*end != '\0') 00233 { 00234 fprintf (stderr, "%s: %s: bad number: %s\n", program_name, arg, s); 00235 exit (1); 00236 } 00237 return ret; 00238 }
| void print_arelt_descr | ( | FILE * | file, | |
| bfd * | abfd, | |||
| boolean | verbose | |||
| ) |
Definition at line 152 of file bucomm.c.
References mode_string().
00156 { 00157 struct stat buf; 00158 00159 if (verbose) 00160 { 00161 if (bfd_stat_arch_elt (abfd, &buf) == 0) 00162 { 00163 char modebuf[11]; 00164 char timebuf[40]; 00165 time_t when = buf.st_mtime; 00166 CONST char *ctime_result = (CONST char *) ctime (&when); 00167 00168 /* POSIX format: skip weekday and seconds from ctime output. */ 00169 sprintf (timebuf, "%.12s %.4s", ctime_result + 4, ctime_result + 20); 00170 00171 mode_string (buf.st_mode, modebuf); 00172 modebuf[10] = '\0'; 00173 /* POSIX 1003.2/D11 says to skip first character (entry type). */ 00174 fprintf (file, "%s %ld/%ld %6ld %s ", modebuf + 1, 00175 (long) buf.st_uid, (long) buf.st_gid, 00176 (long) buf.st_size, timebuf); 00177 } 00178 } 00179 00180 fprintf (file, "%s\n", bfd_get_filename (abfd)); 00181 }
Here is the call graph for this function:

| void set_default_bfd_target | ( | ) |
Definition at line 99 of file bucomm.c.
References bfd_fatal(), strlen(), TARGET, and xmalloc().
Referenced by pstack_install_segv_action().
00100 { 00101 /* The macro TARGET is defined by Makefile. */ 00102 const char *target = TARGET; 00103 00104 if (! bfd_set_default_target (target)) 00105 { 00106 char *errmsg; 00107 00108 errmsg = (char *) xmalloc (100 + strlen (target)); 00109 sprintf (errmsg, "can't set BFD default target to `%s'", target); 00110 bfd_fatal (errmsg); 00111 } 00112 }
Here is the call graph for this function:

Here is the caller graph for this function:

| char* program_name |
Definition at line 39 of file bucomm.c.
Referenced by bfd_nonfatal(), fatal(), list_matching_formats(), parse_vma(), and pstack_install_segv_action().
1.4.7

