aboutsummaryrefslogtreecommitdiff
path: root/gdb/stap-probe.c
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2019-07-02 12:06:06 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2019-07-17 16:24:32 +0100
commit6b78c3f83c8bcbfa714aab7627ece9673b2d602a (patch)
treee8224084dbf069be1e592ea23aeefc509ddf1316 /gdb/stap-probe.c
parentd72a9b85651c872378f6dd732cb578f6f055a9b3 (diff)
downloadgdb-6b78c3f83c8bcbfa714aab7627ece9673b2d602a.zip
gdb-6b78c3f83c8bcbfa714aab7627ece9673b2d602a.tar.gz
gdb-6b78c3f83c8bcbfa714aab7627ece9673b2d602a.tar.bz2
gdb: Remove a non-const reference parameter
Non-const reference parameter should be avoided according to the GDB coding standard: https://sourceware.org/gdb/wiki/Internals%20GDB-C-Coding-Standards#Avoid_non-const_reference_parameters.2C_use_pointers_instead This commit updates the gdbarch method gdbarch_stap_adjust_register, and the one implementation i386_stap_adjust_register to avoid using a non-const reference parameter. I've also removed the kfail from the testsuite for bug 24541, as this issue is now resolved. gdb/ChangeLog: PR breakpoints/24541 * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh: Adjust return type and parameter types for 'stap_adjust_register'. (i386_stap_adjust_register): Adjust signature and return new register name. * stap-probe.c (stap_parse_register_operand): Adjust use of 'gdbarch_stap_adjust_register'. gdb/testsuite/ChangeLog: PR breakpoints/24541 * gdb.mi/mi-catch-cpp-exceptions.exp: Remove kfail due to 24541.
Diffstat (limited to 'gdb/stap-probe.c')
-rw-r--r--gdb/stap-probe.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/gdb/stap-probe.c b/gdb/stap-probe.c
index 866b41e..b6de873 100644
--- a/gdb/stap-probe.c
+++ b/gdb/stap-probe.c
@@ -774,23 +774,24 @@ stap_parse_register_operand (struct stap_parse_info *p)
code would like to perform on the register name. */
if (gdbarch_stap_adjust_register_p (gdbarch))
{
- std::string oldregname = regname;
+ std::string newregname
+ = gdbarch_stap_adjust_register (gdbarch, p, regname, regnum);
- gdbarch_stap_adjust_register (gdbarch, p, regname, regnum);
-
- if (regname != oldregname)
+ if (regname != newregname)
{
/* This is just a check we perform to make sure that the
arch-dependent code has provided us with a valid
register name. */
- regnum = user_reg_map_name_to_regnum (gdbarch, regname.c_str (),
- regname.size ());
+ regnum = user_reg_map_name_to_regnum (gdbarch, newregname.c_str (),
+ newregname.size ());
if (regnum == -1)
internal_error (__FILE__, __LINE__,
_("Invalid register name '%s' after replacing it"
" (previous name was '%s')"),
- regname.c_str (), oldregname.c_str ());
+ newregname.c_str (), regname.c_str ());
+
+ regname = newregname;
}
}