aboutsummaryrefslogtreecommitdiff
path: root/gas/read.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/read.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/read.c')
-rw-r--r--gas/read.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/gas/read.c b/gas/read.c
index 7723ee7..e96ce22 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -2067,7 +2067,7 @@ void
s_app_line (int appline)
{
char *file = NULL;
- int linenum;
+ int linenum, flags = 0;
/* The given number is that of the next line. */
if (appline)
@@ -2092,7 +2092,6 @@ s_app_line (int appline)
linenum);
else
{
- int flags = 0;
int length = 0;
if (!appline)
@@ -2101,6 +2100,12 @@ s_app_line (int appline)
if (*input_line_pointer == '"')
file = demand_copy_string (&length);
+ else if (*input_line_pointer == '.')
+ {
+ /* buffer_and_nest() may insert this form. */
+ ++input_line_pointer;
+ flags = 1 << 3;
+ }
if (file)
{
@@ -2147,7 +2152,7 @@ s_app_line (int appline)
}
}
- if (appline || file)
+ if (appline || file || flags)
{
linenum--;
new_logical_line_flags (file, linenum, flags);
@@ -2157,7 +2162,7 @@ s_app_line (int appline)
#endif
}
}
- if (appline || file)
+ if (appline || file || flags)
demand_empty_rest_of_line ();
else
ignore_rest_of_line ();