aboutsummaryrefslogtreecommitdiff
path: root/gas/input-scrub.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2022-04-12 09:03:13 +0200
committerJan Beulich <jbeulich@suse.com>2022-04-12 09:03:13 +0200
commit2ee1792bec225ea19c71095cee5a3a9ae6df7c59 (patch)
treece92065f05ebf6d086191bcb901306c07fa64b5d /gas/input-scrub.c
parent1a42a9fe4e60599bba1f047743a5b8b2ba96ee1f (diff)
downloadgdb-2ee1792bec225ea19c71095cee5a3a9ae6df7c59.zip
gdb-2ee1792bec225ea19c71095cee5a3a9ae6df7c59.tar.gz
gdb-2ee1792bec225ea19c71095cee5a3a9ae6df7c59.tar.bz2
gas: further adjust file/line handling for .irp and alike
Commit 7992631e8c0b ("gas/Dwarf: improve debug info generation from .irp and alike blocks"), while dealing okay with actual assembly source files not using .file/.line and alike outside but not inside of .irp et al, has undue effects when the logical file/line pair was already overridden: Line numbers would continuously increment upon every iteration, thus potentially getting far off. Furthermore it left it to the user to actually insert .file/.line inside such constructs. Note though that before aforementioned change things weren't pretty either: Diagnostics (and debug info) would be associated with the directive terminating the iteration construct, rather than with the actual lines. Handle this automatically by simply latching the present line and then re-instating coordinates first thing on every iteration; note that the file can't change from what was previously pushed on the scrubber's state stack, and hence can be taken from there by using a new flavor of .linefile (which is far better memory-footprint-wise than recording the full path in the inserted directive). (This then leaves undisturbed any file/line control occurring in the body of the construct, as these will only be seen and processed afterwards.)
Diffstat (limited to 'gas/input-scrub.c')
-rw-r--r--gas/input-scrub.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/gas/input-scrub.c b/gas/input-scrub.c
index d9f1694..a4d7f68 100644
--- a/gas/input-scrub.c
+++ b/gas/input-scrub.c
@@ -440,7 +440,8 @@ bump_line_counters (void)
number. If it is -2, we decrement the logical line number (this is
to support the .appfile pseudo-op inserted into the stream by
do_scrub_chars).
- If the fname is NULL, we don't change the current logical file name.
+ If fname is NULL, we don't change the current logical file name, unless
+ bit 3 of flags is set.
Returns nonzero if the filename actually changes. */
int
@@ -460,6 +461,14 @@ new_logical_line_flags (const char *fname, /* DON'T destroy it! We point to it!
case 1 << 2:
/* FIXME: we could check that include nesting is correct. */
break;
+ case 1 << 3:
+ if (line_number < 0 || fname != NULL || next_saved_file == NULL)
+ abort ();
+ if (next_saved_file->logical_input_file)
+ fname = next_saved_file->logical_input_file;
+ else
+ fname = next_saved_file->physical_input_file;
+ break;
default:
abort ();
}