new gas main line
[deliverable/binutils-gdb.git] / gas / obsolete / gdb.c
1 /* gdb.c -as supports gdb-
2 Copyright (C) 1987 Free Software Foundation, Inc.
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
8 the Free Software Foundation; either version 1, or (at your option)
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
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
19
20 /* This code is independent of the underlying operating system. */
21
22 #include "as.h"
23
24 static long int size; /* 0 or size of GDB symbol file. */
25 static char * where; /* Where we put symbol file in memory. */
26
27 #define SUSPECT /* JF */
28
29 long int /* 0 means don't call gdb_... routines */
30 gdb_begin (filename) /* because we failed to establish file */
31 /* in memory. */
32 char * filename; /* NULL: we have nothing to do. */
33 {
34 long int gdb_file_size();
35 char * xmalloc();
36 void gdb_file_begin();
37 void gdb_file_read();
38 void gdb_block_begin();
39 void gdb_symbols_begin();
40
41 gdb_file_begin();
42 size = 0;
43 if (filename && (size = gdb_file_size (filename)))
44 {
45 where = xmalloc( (long) size );
46 gdb_file_read (where, filename); /* Read, then close file. */
47 gdb_block_begin();
48 gdb_symbols_begin();
49 }
50 return (size);
51 }
52
53 void
54 gdb_end()
55 {
56 void gdb_file_end();
57
58 gdb_file_end();
59 }
60 \f
61 void
62 gdb_emit (filename) /* Append GDB symbols to object file. */
63 char * filename;
64 {
65 void gdb_block_emit();
66 void gdb_symbols_emit();
67 void gdb_lines_emit();
68 void output_file_append();
69
70 gdb_block_emit ();
71 gdb_symbols_emit ();
72 gdb_lines_emit();
73 output_file_append (where, size, filename);
74 }
75
76
77
78 /*
79 Notes: We overwrite what was there.
80 We assume all overwrites are 4-char numbers.
81 */
82
83 void
84 gdb_alter (offset, value) /* put value into GDB file + offset. */
85 long int offset;
86 long int value;
87 {
88 void md_number_to_chars();
89
90 #ifdef SUSPECT
91 if (offset > size - sizeof(long int) || offset < 0)
92 {
93 as_warn( "gdb_alter: offset=%d. size=%ld.\n", offset, size );
94 return;
95 }
96 #endif
97
98 #ifdef B_OUT
99 /* Symbol info will be used on the host machine only (only executable
100 * code is actually downloaded to the i80960). Therefore, leave it
101 * in host byte order.
102 */
103
104 *(long int *)(where + offset) = value;
105 #else
106 md_number_to_chars (where + offset, value, 4);
107 #endif
108 }
109
110 /* end: gdb.c */
This page took 0.03232 seconds and 4 git commands to generate.