From 65f7e0c4279d2b901eab3ab5e5f9f9a96c6aa8d3 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Sat, 27 Dec 2014 14:43:07 +0100 Subject: ortho-lang.c: use absolute path for debugging. --- src/ortho/gcc/ortho-lang.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/ortho') diff --git a/src/ortho/gcc/ortho-lang.c b/src/ortho/gcc/ortho-lang.c index 7e33c8c4b..020c9e5ea 100644 --- a/src/ortho/gcc/ortho-lang.c +++ b/src/ortho/gcc/ortho-lang.c @@ -474,13 +474,23 @@ static void ortho_parse_file (void) { const char *filename; + const char *dbg_filename; if (num_in_fnames == 0) filename = NULL; else filename = in_fnames[0]; - linemap_add (line_table, LC_ENTER, 0, filename ? filename :"*no-file*", 1); + /* Use absolute filenames for debug info. Works better than relative + filenames with some debuggers/tools. */ + if (filename == NULL) + dbg_filename = "*stdin*"; + else if (IS_ABSOLUTE_PATH (filename)) + dbg_filename = filename; + else + dbg_filename = concat (getpwd (), "/", filename, NULL); + + linemap_add (line_table, LC_ENTER, 0, dbg_filename, 1); input_location = linemap_line_start (line_table, 1, 252); if (!lang_parse_file (filename)) -- cgit v1.2.3