Commit d41e5e6994f41a27be57f3ae42212a4e264d609b

Authored by dzu
1 parent 8f713fdfeb

Removed the file tools/gdb/astest.c

Showing 1 changed file with 0 additions and 126 deletions Side-by-side Diff

tools/gdb/astest.c
1   -/*
2   - * (C) Copyright 2000
3   - * Murray Jensen <Murray.Jensen@csiro.au>
4   - *
5   - * See file CREDITS for list of people who contributed to this
6   - * project.
7   - *
8   - * This program is free software; you can redistribute it and/or
9   - * modify it under the terms of the GNU General Public License as
10   - * published by the Free Software Foundation; either version 2 of
11   - * the License, or (at your option) any later version.
12   - *
13   - * This program is distributed in the hope that it will be useful,
14   - * but WITHOUT ANY WARRANTY; without even the implied warranty of
15   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16   - * GNU General Public License for more details.
17   - *
18   - * You should have received a copy of the GNU General Public License
19   - * along with this program; if not, write to the Free Software
20   - * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21   - * MA 02111-1307 USA
22   - */
23   -
24   -#include <stdio.h>
25   -#include <stdlib.h>
26   -#include <string.h>
27   -#include <unistd.h>
28   -#include <fcntl.h>
29   -#include <bfd.h>
30   -#include "error.h"
31   -
32   -int verbose = 0;
33   -
34   -void
35   -process_section(bfd *abfd, asection *sect, PTR obj)
36   -{
37   - printf("Section '%s':\n", sect->name);
38   -
39   - printf("\tindex=%d, flags=%x\n", sect->index, sect->flags);
40   -
41   -#if 0
42   - printf("\tuser_set_vma=%u, reloc_done=%u, linker_mark=%u, gc_mark=%u\n",
43   - (unsigned long)sect->user_set_vma, (unsigned long)sect->reloc_done,
44   - (unsigned long)sect->linker_mark, (unsigned long)sect->gc_mark);
45   -#else
46   - printf("\tuser_set_vma=%u, reloc_done=%u\n",
47   - (unsigned int)sect->user_set_vma, (unsigned int)sect->reloc_done);
48   -#endif
49   -
50   - printf("\tvma=%08lx, lma=%08lx\n",
51   - (unsigned long)sect->vma, (unsigned long)sect->lma);
52   -
53   - printf("\tcooked_size=%ld, raw_size=%ld, output_offset=%ld\n",
54   - (long)sect->_cooked_size, (long)sect->_raw_size,
55   - (long)sect->output_offset);
56   -
57   - printf("\talignment_power=%d, reloc_count=%d, filepos=%ld\n",
58   - sect->alignment_power, sect->reloc_count, sect->filepos);
59   -
60   - printf("\trel_filepos=%ld, line_filepos=%ld, lineno_count=%d\n",
61   - sect->rel_filepos, sect->line_filepos, sect->lineno_count);
62   -
63   - printf("\tmoving_line_filepos=%ld, target_index=%d\n",
64   - sect->moving_line_filepos, sect->target_index);
65   -}
66   -
67   -int
68   -main(int ac, char **av)
69   -{
70   - int c, ifd;
71   - char *ifn;
72   - bfd *bfdp;
73   -
74   - if ((pname = strrchr(av[0], '/')) == NULL)
75   - pname = av[0];
76   - else
77   - pname++;
78   -
79   - while ((c = getopt(ac, av, "v")) != EOF)
80   - switch (c) {
81   -
82   - case 'v':
83   - verbose = 1;
84   - break;
85   -
86   - default:
87   - usage:
88   - fprintf(stderr, "Usage: %s [-v] imagefile\n", pname);
89   - exit(1);
90   - }
91   - if (optind != ac - 1)
92   - goto usage;
93   -
94   - ifn = av[optind];
95   -
96   - if (verbose)
97   - fprintf(stderr, "Opening file...\n");
98   -
99   - if ((ifd = open(ifn, O_RDONLY)) < 0)
100   - Perror("can't open image file '%s'", ifn);
101   -
102   - if ((bfdp = bfd_fdopenr(ifn, "elf32-powerpc", ifd)) == NULL) {
103   - bfd_perror(ifn);
104   - close(ifd);
105   - Error("bfd_fdopenr of file '%s' failed", ifn);
106   - }
107   - bfdp->cacheable = 1;
108   -
109   - if (!bfd_check_format(bfdp, bfd_object) ||
110   - (bfd_get_file_flags(bfdp) & EXEC_P) == 0) {
111   - bfd_close(bfdp);
112   - Error("file '%s' is not an executable object file (%s,0x%x)", ifn,
113   - bfd_format_string(bfd_get_format(bfdp)), bfd_get_file_flags(bfdp));
114   - }
115   -
116   - printf("file '%s' is type '%s'...\n", ifn, bfd_get_target(bfdp));
117   -
118   - bfd_map_over_sections(bfdp, process_section, NULL);;
119   -
120   - bfd_close(bfdp);
121   -
122   - if (verbose)
123   - fprintf(stderr, "Done.\n");
124   -
125   - return (0);
126   -}