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
|
/* gdb_file.c -o/s specific-
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. */
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
static long file_len;
static FILE *file;
extern long get_len();
void
gdb_file_begin ()
{
}
void
gdb_file_end()
{
}
long int /* Open file, return size. 0: failed. */
gdb_file_size (filename)
char *filename;
{
struct stat stat_buf;
void as_perror();
file= fopen (filename, "r");
if (file == (FILE *)NULL)
{
as_perror ("Can't read GDB symbolic information file", filename);
file_len=0;
} else {
(void)fstat (fileno(file), &stat_buf);
file_len=stat_buf . st_size;
}
return ((long int)file_len );
}
void /* Read the file, don't return if failed. */
gdb_file_read (buffer, filename)
char * buffer;
char * filename;
{
register off_t size_wanted;
void as_perror();
size_wanted = file_len;
if (fread (buffer, size_wanted, 1, file) != 1)
{
as_perror ("Can't read GDB symbolic info file", filename);
as_fatal ("Failed to read %ld. chars of GDB symbolic information",
size_wanted);
}
if (fclose(file)==EOF)
{
as_perror ("Can't close GDB symbolic info file", filename);
as_fatal ("I quit in disgust");
}
}
/* end: gdb_file.c */
|