This commit was generated by cvs2svn to track changes on a CVS vendor
[external/binutils.git] / gas / debug.c
1 /* Routines for debug use only.  Don't link into product.
2  */
3
4 #include "as.h"
5 #include "subsegs.h"
6
7 dmp_frags()
8 {
9     frchainS *chp;
10     char *p;
11     
12     for ( chp=frchain_root; chp; chp = chp->frch_next ){
13         switch ( chp->frch_seg ){
14         case SEG_DATA:
15             p ="Data";
16             break;
17         case SEG_TEXT:
18             p ="Text";
19             break;
20         default:
21             p ="???";
22             break;
23         }
24         printf("\nSEGMENT %s %d\n", p, chp->frch_subseg);
25         dmp_frag( chp->frch_root,"\t");
26     }
27 }
28
29 dmp_frag( fp, indent )
30     struct frag *fp;
31     char *indent;
32 {
33     for ( ; fp; fp = fp->fr_next ){
34         printf("%sFRAGMENT @ 0x%x\n", indent, fp);
35         switch( fp->fr_type ){
36         case rs_align:
37             printf("%srs_align(%d)\n",indent, fp->fr_offset);
38             break;
39         case rs_fill:
40             printf("%srs_fill(%d)\n",indent, fp->fr_offset);
41             printf("%s", indent);
42             var_chars( fp, fp->fr_var + fp->fr_fix );
43             printf("%s\t repeated %d times,",
44                    indent, fp->fr_offset);
45             printf(" fixed length if # chars == 0)\n");
46             break;
47         case rs_org:
48             printf("%srs_org(%d+sym @0x%x)\n",indent,
49                    fp->fr_offset, fp->fr_symbol);
50             printf("%sfill with ",indent);
51             var_chars( fp, 1 );
52             printf("\n");
53             break;
54         case rs_machine_dependent:
55             printf("%smachine_dep\n",indent);
56             break;
57         default:
58             printf("%sunknown type\n",indent);
59             break;
60         }
61         printf("%saddr=%d(0x%x)\n",indent,fp->fr_address,fp->fr_address);
62         printf("%sfr_fix=%d\n",indent,fp->fr_fix);
63         printf("%sfr_var=%d\n",indent,fp->fr_var);
64         printf("%sfr_offset=%d\n",indent,fp->fr_offset);
65         printf("%schars @ 0x%x\n",indent,fp->fr_literal);
66         printf("\n");
67     }
68 }
69
70 var_chars( fp, n )
71     struct frag *fp;
72     int n;
73 {
74     unsigned char *p;
75     
76     for ( p=(unsigned char*)fp->fr_literal; n; n-- , p++ ){
77         printf("%02x ", *p );
78     }
79 }
80
81 /* end of debug.c */