aboutsummaryrefslogtreecommitdiff
path: root/gdb/xcoffread.c
diff options
context:
space:
mode:
authorPeter Schauer <Peter.Schauer@mytum.de>1994-11-25 21:46:52 +0000
committerPeter Schauer <Peter.Schauer@mytum.de>1994-11-25 21:46:52 +0000
commite8abe489a03ca09accfad3d19e85bfd53a007db6 (patch)
tree59349c54d35d21873c5a2031d0e9a4df2432ab09 /gdb/xcoffread.c
parentfb14975b7036a91db9c096572fc267e3b5b1b99e (diff)
downloadgdb-e8abe489a03ca09accfad3d19e85bfd53a007db6.zip
gdb-e8abe489a03ca09accfad3d19e85bfd53a007db6.tar.gz
gdb-e8abe489a03ca09accfad3d19e85bfd53a007db6.tar.bz2
* coffread.c, symfile.h (coff_getfilename): Make it static again.
* xcoffread.c (coff_getfilename): Use a static copy from coffread.c, modified for accessing the static xcoff strtbl.
Diffstat (limited to 'gdb/xcoffread.c')
-rw-r--r--gdb/xcoffread.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index 0cb2f3a..7ab1035 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -32,6 +32,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <sys/types.h>
#include <fcntl.h>
#include <ctype.h>
+#include <string.h>
#include "obstack.h"
#include <sys/param.h>
@@ -186,6 +187,9 @@ free_linetab PARAMS ((void));
static void
find_linenos PARAMS ((bfd *, sec_ptr, PTR));
+static char *
+coff_getfilename PARAMS ((union internal_auxent *));
+
static void
read_symbol PARAMS ((struct internal_syment *, int));
@@ -1762,6 +1766,35 @@ process_xcoff_symbol (cs, objfile)
return sym2;
}
+/* Extract the file name from the aux entry of a C_FILE symbol. Return
+ only the last component of the name. Result is in static storage and
+ is only good for temporary use. */
+
+static char *
+coff_getfilename (aux_entry)
+ union internal_auxent *aux_entry;
+{
+ static char buffer[BUFSIZ];
+ register char *temp;
+ char *result;
+
+ if (aux_entry->x_file.x_n.x_zeroes == 0)
+ strcpy (buffer, strtbl + aux_entry->x_file.x_n.x_offset);
+ else
+ {
+ strncpy (buffer, aux_entry->x_file.x_fname, FILNMLEN);
+ buffer[FILNMLEN] = '\0';
+ }
+ result = buffer;
+
+ /* FIXME: We should not be throwing away the information about what
+ directory. It should go into dirname of the symtab, or some such
+ place. */
+ if ((temp = strrchr (result, '/')) != NULL)
+ result = temp + 1;
+ return (result);
+}
+
/* Set *SYMBOL to symbol number symno in symtbl. */
static void
read_symbol (symbol, symno)