aboutsummaryrefslogtreecommitdiff
path: root/gdb/tracepoint.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>1998-07-15 18:00:49 +0000
committerNick Clifton <nickc@redhat.com>1998-07-15 18:00:49 +0000
commite1f1ed1ad75d43e928ce1fa347659d3490b539aa (patch)
treed194dcf828c8889b0a661009c09324daea99cb3d /gdb/tracepoint.c
parentc3da0ebf3ea534ac9ae0b8312ceaed6297cc6600 (diff)
downloadgdb-e1f1ed1ad75d43e928ce1fa347659d3490b539aa.zip
gdb-e1f1ed1ad75d43e928ce1fa347659d3490b539aa.tar.gz
gdb-e1f1ed1ad75d43e928ce1fa347659d3490b539aa.tar.bz2
Cope with setting trace points on symbols which do not have an associated directory.
Diffstat (limited to 'gdb/tracepoint.c')
-rw-r--r--gdb/tracepoint.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index fa5ac4d..20379c1 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -333,18 +333,26 @@ set_raw_tracepoint (sal)
t->source_file = NULL;
else
{
- char *p;
-
- t->source_file = (char *) xmalloc (strlen (sal.symtab->filename) +
- strlen (sal.symtab->dirname) + 2);
-
- strcpy (t->source_file, sal.symtab->dirname);
- p = t->source_file;
- while (*p)
- p++;
- if (*(--p) != '/') /* Will this work on Windows? */
- strcat (t->source_file, "/");
- strcat (t->source_file, sal.symtab->filename);
+ if (sal.symtab->dirname == NULL)
+ {
+ t->source_file = (char *) xmalloc (strlen (sal.symtab->filename) + 1);
+ strcpy (t->source_file, sal.symtab->filename);
+ }
+ else
+ {
+ char *p;
+
+ t->source_file = (char *) xmalloc (strlen (sal.symtab->filename) +
+ strlen (sal.symtab->dirname) + 2);
+
+ strcpy (t->source_file, sal.symtab->dirname);
+ p = t->source_file;
+ while (*p)
+ p++;
+ if (*(--p) != '/') /* Will this work on Windows? */
+ strcat (t->source_file, "/");
+ strcat (t->source_file, sal.symtab->filename);
+ }
}
t->language = current_language->la_language;