-
Notifications
You must be signed in to change notification settings - Fork 0
/
gdb.c
107 lines (84 loc) · 2.46 KB
/
gdb.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/* gdb.c -as supports gdb-
Copyright (C) 1987 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
GAS is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
GAS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GAS; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* This code is independent of the underlying operating system. */
#include "as.h"
static long int size; /* 0 or size of GDB symbol file. */
static char * where; /* Where we put symbol file in memory. */
#define SUSPECT /* JF */
long int /* 0 means don't call gdb_... routines */
gdb_begin (filename) /* because we failed to establish file */
/* in memory. */
char * filename; /* NULL: we have nothing to do. */
{
long int gdb_file_size();
char * xmalloc();
void gdb_file_begin();
void gdb_file_read();
void gdb_block_begin();
void gdb_symbols_begin();
gdb_file_begin();
size = 0;
if (filename && (size = gdb_file_size (filename)))
{
where = xmalloc( (long) size );
gdb_file_read (where, filename); /* Read, then close file. */
gdb_block_begin();
gdb_symbols_begin();
}
return (size);
}
void
gdb_end()
{
void gdb_file_end();
gdb_file_end();
}
void
gdb_emit (filename) /* Append GDB symbols to object file. */
char * filename;
{
void gdb_block_emit();
void gdb_symbols_emit();
void gdb_lines_emit();
void output_file_append();
gdb_block_emit ();
gdb_symbols_emit ();
gdb_lines_emit();
output_file_append (where, size, filename);
}
/*
Notes: We overwrite what was there.
We assume all overwrites are 4-char numbers.
*/
void
gdb_alter (offset, value) /* put value into GDB file + offset. */
long int offset;
long int value;
{
void md_number_to_chars();
#ifdef SUSPECT
if (offset > size - sizeof(long int) || offset < 0)
{
as_warn( "gdb_alter: offset=%d. size=%ld.\n", offset, size );
}
else
{
#endif
md_number_to_chars (where + offset, value, 4);
#ifdef SUSPECT
}
#endif
}
/* end: gdb.c */