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