aboutsummaryrefslogtreecommitdiff
path: root/qemu-error.c
diff options
context:
space:
mode:
Diffstat (limited to 'qemu-error.c')
-rw-r--r--qemu-error.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/qemu-error.c b/qemu-error.c
index 214e4481e2..23176e16a8 100644
--- a/qemu-error.c
+++ b/qemu-error.c
@@ -113,6 +113,19 @@ void loc_set_none(void)
cur_loc->kind = LOC_NONE;
}
+/*
+ * Change the current location to file FNAME, line LNO.
+ */
+void loc_set_file(const char *fname, int lno)
+{
+ assert (fname || cur_loc->kind == LOC_FILE);
+ cur_loc->kind = LOC_FILE;
+ cur_loc->num = lno;
+ if (fname) {
+ cur_loc->ptr = fname;
+ }
+}
+
static const char *progname;
/*
@@ -136,6 +149,13 @@ void error_print_loc(void)
sep = " ";
}
switch (cur_loc->kind) {
+ case LOC_FILE:
+ error_printf("%s:", (const char *)cur_loc->ptr);
+ if (cur_loc->num) {
+ error_printf("%d:", cur_loc->num);
+ }
+ error_printf(" ");
+ break;
default:
error_printf(sep);
}