summaryrefslogtreecommitdiff
path: root/gdb/dwarf2/frame.c
diff options
context:
space:
mode:
authorPedro Alves <pedro@palves.net>2022-10-17 17:12:20 +0100
committerPedro Alves <pedro@palves.net>2022-10-19 15:32:36 +0100
commitf34652de0b68c4ee3050828b43a2839b852b5821 (patch)
tree851720f14f2ac022c3e82428254edf161d619e91 /gdb/dwarf2/frame.c
parent5c831a3c7f3ca98d6aba1200353311e1a1f84c70 (diff)
downloadbinutils-gdb-f34652de0b68c4ee3050828b43a2839b852b5821.tar.gz
internal_error: remove need to pass __FILE__/__LINE__
Currently, every internal_error call must be passed __FILE__/__LINE__ explicitly, like: internal_error (__FILE__, __LINE__, "foo %d", var); The need to pass in explicit __FILE__/__LINE__ is there probably because the function predates widespread and portable variadic macros availability. We can use variadic macros nowadays, and in fact, we already use them in several places, including the related gdb_assert_not_reached. So this patch renames the internal_error function to something else, and then reimplements internal_error as a variadic macro that expands __FILE__/__LINE__ itself. The result is that we now should call internal_error like so: internal_error ("foo %d", var); Likewise for internal_warning. The patch adjusts all calls sites. 99% of the adjustments were done with a perl/sed script. The non-mechanical changes are in gdbsupport/errors.h, gdbsupport/gdb_assert.h, and gdb/gdbarch.py. Approved-By: Simon Marchi <simon.marchi@efficios.com> Change-Id: Ia6f372c11550ca876829e8fd85048f4502bdcf06
Diffstat (limited to 'gdb/dwarf2/frame.c')
-rw-r--r--gdb/dwarf2/frame.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/gdb/dwarf2/frame.c b/gdb/dwarf2/frame.c
index 83565ea7c99..d4bc53e5dd8 100644
--- a/gdb/dwarf2/frame.c
+++ b/gdb/dwarf2/frame.c
@@ -500,8 +500,7 @@ bad CFI data; mismatched DW_CFA_restore_state at %s"),
insn);
}
else
- internal_error (__FILE__, __LINE__,
- _("Unknown CFI encountered."));
+ internal_error (_("Unknown CFI encountered."));
}
}
}
@@ -827,7 +826,7 @@ dwarf2_fetch_cfa_info (struct gdbarch *gdbarch, CORE_ADDR pc,
return 0;
default:
- internal_error (__FILE__, __LINE__, _("Unknown CFA rule."));
+ internal_error (_("Unknown CFA rule."));
}
}
@@ -974,7 +973,7 @@ dwarf2_frame_cache (frame_info_ptr this_frame, void **this_cache)
break;
default:
- internal_error (__FILE__, __LINE__, _("Unknown CFA rule."));
+ internal_error (_("Unknown CFA rule."));
}
}
catch (const gdb_exception_error &ex)
@@ -1218,7 +1217,7 @@ dwarf2_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
return cache->reg[regnum].loc.fn (this_frame, this_cache, regnum);
default:
- internal_error (__FILE__, __LINE__, _("Unknown register rule."));
+ internal_error (_("Unknown register rule."));
}
}
@@ -1405,7 +1404,7 @@ encoding_for_size (unsigned int size)
case 8:
return DW_EH_PE_udata8;
default:
- internal_error (__FILE__, __LINE__, _("Unsupported address size"));
+ internal_error (_("Unsupported address size"));
}
}
@@ -1421,8 +1420,7 @@ read_encoded_value (struct comp_unit *unit, gdb_byte encoding,
/* GCC currently doesn't generate DW_EH_PE_indirect encodings for
FDE's. */
if (encoding & DW_EH_PE_indirect)
- internal_error (__FILE__, __LINE__,
- _("Unsupported encoding: DW_EH_PE_indirect"));
+ internal_error (_("Unsupported encoding: DW_EH_PE_indirect"));
*bytes_read_ptr = 0;
@@ -1454,8 +1452,7 @@ read_encoded_value (struct comp_unit *unit, gdb_byte encoding,
}
break;
default:
- internal_error (__FILE__, __LINE__,
- _("Invalid or unsupported encoding"));
+ internal_error (_("Invalid or unsupported encoding"));
}
if ((encoding & 0x07) == 0x00)
@@ -1502,8 +1499,7 @@ read_encoded_value (struct comp_unit *unit, gdb_byte encoding,
*bytes_read_ptr += 8;
return (base + bfd_get_signed_64 (unit->abfd, (bfd_byte *) buf));
default:
- internal_error (__FILE__, __LINE__,
- _("Invalid or unsupported encoding"));
+ internal_error (_("Invalid or unsupported encoding"));
}
}