1 | /* This file is debug.c
|
---|
2 | Copyright 1987, 1988, 1989, 1990, 1991, 1992, 2000
|
---|
3 | Free Software Foundation, Inc.
|
---|
4 |
|
---|
5 | This file is part of GAS, the GNU Assembler.
|
---|
6 |
|
---|
7 | GAS is free software; you can redistribute it and/or modify
|
---|
8 | it under the terms of the GNU General Public License as published by
|
---|
9 | the Free Software Foundation; either version 2, or (at your option)
|
---|
10 | any later version.
|
---|
11 |
|
---|
12 | GAS is distributed in the hope that it will be useful,
|
---|
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
15 | GNU General Public License for more details.
|
---|
16 |
|
---|
17 | You should have received a copy of the GNU General Public License
|
---|
18 | along with GAS; see the file COPYING. If not, write to
|
---|
19 | the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
---|
20 |
|
---|
21 | /* Routines for debug use only. */
|
---|
22 |
|
---|
23 | #include "as.h"
|
---|
24 | #include "subsegs.h"
|
---|
25 |
|
---|
26 | dmp_frags ()
|
---|
27 | {
|
---|
28 | frchainS *chp;
|
---|
29 | char *p;
|
---|
30 |
|
---|
31 | for (chp = frchain_root; chp; chp = chp->frch_next)
|
---|
32 | {
|
---|
33 | switch (chp->frch_seg)
|
---|
34 | {
|
---|
35 | case SEG_DATA:
|
---|
36 | p = "Data";
|
---|
37 | break;
|
---|
38 | case SEG_TEXT:
|
---|
39 | p = "Text";
|
---|
40 | break;
|
---|
41 | default:
|
---|
42 | p = "???";
|
---|
43 | break;
|
---|
44 | }
|
---|
45 | printf ("\nSEGMENT %s %d\n", p, chp->frch_subseg);
|
---|
46 | dmp_frag (chp->frch_root, "\t");
|
---|
47 | }
|
---|
48 | }
|
---|
49 |
|
---|
50 | dmp_frag (fp, indent)
|
---|
51 | struct frag *fp;
|
---|
52 | char *indent;
|
---|
53 | {
|
---|
54 | for (; fp; fp = fp->fr_next)
|
---|
55 | {
|
---|
56 | printf ("%sFRAGMENT @ 0x%x\n", indent, fp);
|
---|
57 | switch (fp->fr_type)
|
---|
58 | {
|
---|
59 | case rs_align:
|
---|
60 | printf ("%srs_align(%d)\n", indent, fp->fr_offset);
|
---|
61 | break;
|
---|
62 | case rs_fill:
|
---|
63 | printf ("%srs_fill(%d)\n", indent, fp->fr_offset);
|
---|
64 | printf ("%s", indent);
|
---|
65 | var_chars (fp, fp->fr_var + fp->fr_fix);
|
---|
66 | printf ("%s\t repeated %d times,", indent, fp->fr_offset);
|
---|
67 | printf (" fixed length if # chars == 0)\n");
|
---|
68 | break;
|
---|
69 | case rs_org:
|
---|
70 | printf ("%srs_org(%d+sym @0x%x)\n", indent,
|
---|
71 | fp->fr_offset, fp->fr_symbol);
|
---|
72 | printf ("%sfill with ", indent);
|
---|
73 | var_chars (fp, 1);
|
---|
74 | printf ("\n");
|
---|
75 | break;
|
---|
76 | case rs_machine_dependent:
|
---|
77 | printf ("%smachine_dep\n", indent);
|
---|
78 | break;
|
---|
79 | default:
|
---|
80 | printf ("%sunknown type\n", indent);
|
---|
81 | break;
|
---|
82 | }
|
---|
83 | printf ("%saddr=%d(0x%x)\n", indent, fp->fr_address, fp->fr_address);
|
---|
84 | printf ("%sfr_fix=%d\n", indent, fp->fr_fix);
|
---|
85 | printf ("%sfr_var=%d\n", indent, fp->fr_var);
|
---|
86 | printf ("%sfr_offset=%d\n", indent, fp->fr_offset);
|
---|
87 | printf ("%schars @ 0x%x\n", indent, fp->fr_literal);
|
---|
88 | printf ("\n");
|
---|
89 | }
|
---|
90 | }
|
---|
91 |
|
---|
92 | var_chars (fp, n)
|
---|
93 | struct frag *fp;
|
---|
94 | int n;
|
---|
95 | {
|
---|
96 | unsigned char *p;
|
---|
97 |
|
---|
98 | for (p = (unsigned char *) fp->fr_literal; n; n--, p++)
|
---|
99 | {
|
---|
100 | printf ("%02x ", *p);
|
---|
101 | }
|
---|
102 | }
|
---|
103 |
|
---|
104 | /* end of debug.c */
|
---|