version 1.6, 2002/03/29 19:32:18 |
version 1.7, 2002/06/09 04:59:04 |
|
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
*/ |
|
|
|
#include <sys/param.h> |
|
#include <sys/ptrace.h> |
|
#include <sys/mman.h> |
|
#include <sys/stat.h> |
|
|
#include <stdio.h> |
#include <stdio.h> |
#include <stdlib.h> |
#include <stdlib.h> |
#include <unistd.h> |
#include <unistd.h> |
|
|
#include <string.h> |
#include <string.h> |
#include <err.h> |
#include <err.h> |
|
|
#include <sys/param.h> |
|
#include <sys/ptrace.h> |
|
#include <sys/mman.h> |
|
|
|
#include <sys/types.h> |
|
#include <a.out.h> |
#include <a.out.h> |
#include <link.h> |
#include <link.h> |
|
|
|
|
aout_open(const char *name) |
aout_open(const char *name) |
{ |
{ |
struct aout_symbol_handle *ash; |
struct aout_symbol_handle *ash; |
|
struct stat sb; |
u_int32_t symoff, stroff; |
u_int32_t symoff, stroff; |
struct exec ahdr; |
struct exec ahdr; |
|
|
|
|
warnx("Bad magic."); |
warnx("Bad magic."); |
goto fail; |
goto fail; |
} |
} |
|
|
|
/* Don't go further for stripped files. */ |
|
if (fstat(ash->ash_fd, &sb) < 0 || N_SYMOFF(ahdr) == sb.st_size || |
|
N_STROFF(ahdr) == sb.st_size) |
|
goto fail; |
|
|
symoff = N_SYMOFF(ahdr); |
symoff = N_SYMOFF(ahdr); |
ash->ash_symsize = ahdr.a_syms; |
ash->ash_symsize = ahdr.a_syms; |