* [PATCH] gdb/amd64: clean up unused variable
@ 2022-07-31 4:14 Enze Li via Gdb-patches
2022-08-01 17:55 ` John Baldwin
2022-08-01 22:23 ` [PATCH v2] " Enze Li via Gdb-patches
0 siblings, 2 replies; 5+ messages in thread
From: Enze Li via Gdb-patches @ 2022-07-31 4:14 UTC (permalink / raw)
To: gdb-patches; +Cc: enze.li
When building with clang 15, I got this,
CXX amd64-tdep.o
amd64-tdep.c:1410:13: error: variable 'insn' set but not used[-Werror,-Wunused-but-set-variable]
gdb_byte *insn = insn_details->raw_insn + modrm_offset;
^
1 error generated.
The function that uses this variable has been removed in this commit,
commit 870f88f7551b0f2d6aaaa36fb684b5ff8f468107
Date: Mon Apr 18 13:16:27 2016 -0400
remove trivialy unused variables
Fix this by removing unused variable.
Tested by rebuilding on x86_64-linux with clang 15 and gcc 12.
---
gdb/amd64-tdep.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index 0563b32a54bf..3fbbf20fc2b1 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -1407,14 +1407,12 @@ fixup_riprel (struct gdbarch *gdbarch,
{
const struct amd64_insn *insn_details = &dsc->insn_details;
int modrm_offset = insn_details->modrm_offset;
- gdb_byte *insn = insn_details->raw_insn + modrm_offset;
CORE_ADDR rip_base;
int insn_length;
int arch_tmp_regno, tmp_regno;
ULONGEST orig_value;
/* %rip+disp32 addressing mode, displacement follows ModRM byte. */
- ++insn;
/* Compute the rip-relative address. */
insn_length = gdb_buffered_insn_length (gdbarch, dsc->insn_buf.data (),
--
2.37.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gdb/amd64: clean up unused variable
2022-07-31 4:14 [PATCH] gdb/amd64: clean up unused variable Enze Li via Gdb-patches
@ 2022-08-01 17:55 ` John Baldwin
2022-08-01 22:23 ` [PATCH v2] " Enze Li via Gdb-patches
1 sibling, 0 replies; 5+ messages in thread
From: John Baldwin @ 2022-08-01 17:55 UTC (permalink / raw)
To: Enze Li, gdb-patches; +Cc: enze.li
On 7/30/22 9:14 PM, Enze Li via Gdb-patches wrote:
> When building with clang 15, I got this,
>
> CXX amd64-tdep.o
> amd64-tdep.c:1410:13: error: variable 'insn' set but not used[-Werror,-Wunused-but-set-variable]
> gdb_byte *insn = insn_details->raw_insn + modrm_offset;
> ^
> 1 error generated.
>
> The function that uses this variable has been removed in this commit,
>
> commit 870f88f7551b0f2d6aaaa36fb684b5ff8f468107
> Date: Mon Apr 18 13:16:27 2016 -0400
>
> remove trivialy unused variables
>
> Fix this by removing unused variable.
>
> Tested by rebuilding on x86_64-linux with clang 15 and gcc 12.
> ---
> gdb/amd64-tdep.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
> index 0563b32a54bf..3fbbf20fc2b1 100644
> --- a/gdb/amd64-tdep.c
> +++ b/gdb/amd64-tdep.c
> @@ -1407,14 +1407,12 @@ fixup_riprel (struct gdbarch *gdbarch,
> {
> const struct amd64_insn *insn_details = &dsc->insn_details;
> int modrm_offset = insn_details->modrm_offset;
> - gdb_byte *insn = insn_details->raw_insn + modrm_offset;
> CORE_ADDR rip_base;
> int insn_length;
> int arch_tmp_regno, tmp_regno;
> ULONGEST orig_value;
>
> /* %rip+disp32 addressing mode, displacement follows ModRM byte. */
> - ++insn;
This seems to orphan the comment. I think the comment can go. insn here
was orphaned by commit 870f88f7551b0f2d6aaaa36fb684b5ff8f468107 which
removed a different unused variable (disp) fetched from the modified
insn location and which held the displacement value referenced by the comment.
> /* Compute the rip-relative address. */
> insn_length = gdb_buffered_insn_length (gdbarch, dsc->insn_buf.data (),
--
John Baldwin
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] gdb/amd64: clean up unused variable
2022-07-31 4:14 [PATCH] gdb/amd64: clean up unused variable Enze Li via Gdb-patches
2022-08-01 17:55 ` John Baldwin
@ 2022-08-01 22:23 ` Enze Li via Gdb-patches
2022-08-02 15:44 ` John Baldwin
1 sibling, 1 reply; 5+ messages in thread
From: Enze Li via Gdb-patches @ 2022-08-01 22:23 UTC (permalink / raw)
To: gdb-patches; +Cc: enze.li
When building with clang 15, I got this,
CXX amd64-tdep.o
amd64-tdep.c:1410:13: error: variable 'insn' set but not used[-Werror,-Wunused-but-set-variable]
gdb_byte *insn = insn_details->raw_insn + modrm_offset;
^
1 error generated.
The function that uses this variable has been removed in this commit,
commit 870f88f7551b0f2d6aaaa36fb684b5ff8f468107
Date: Mon Apr 18 13:16:27 2016 -0400
remove trivialy unused variables
Fix this by removing unused variable.
Tested by rebuilding on x86_64-linux with clang 15 and gcc 12.
---
gdb/amd64-tdep.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index 0563b32a54b..d89e06d27cb 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -1407,15 +1407,11 @@ fixup_riprel (struct gdbarch *gdbarch,
{
const struct amd64_insn *insn_details = &dsc->insn_details;
int modrm_offset = insn_details->modrm_offset;
- gdb_byte *insn = insn_details->raw_insn + modrm_offset;
CORE_ADDR rip_base;
int insn_length;
int arch_tmp_regno, tmp_regno;
ULONGEST orig_value;
- /* %rip+disp32 addressing mode, displacement follows ModRM byte. */
- ++insn;
-
/* Compute the rip-relative address. */
insn_length = gdb_buffered_insn_length (gdbarch, dsc->insn_buf.data (),
dsc->insn_buf.size (), from);
--
2.37.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] gdb/amd64: clean up unused variable
2022-08-01 22:23 ` [PATCH v2] " Enze Li via Gdb-patches
@ 2022-08-02 15:44 ` John Baldwin
2022-08-03 12:30 ` Enze Li via Gdb-patches
0 siblings, 1 reply; 5+ messages in thread
From: John Baldwin @ 2022-08-02 15:44 UTC (permalink / raw)
To: Enze Li, gdb-patches; +Cc: enze.li
On 8/1/22 3:23 PM, Enze Li wrote:
> When building with clang 15, I got this,
>
> CXX amd64-tdep.o
> amd64-tdep.c:1410:13: error: variable 'insn' set but not used[-Werror,-Wunused-but-set-variable]
> gdb_byte *insn = insn_details->raw_insn + modrm_offset;
> ^
> 1 error generated.
>
> The function that uses this variable has been removed in this commit,
LGTM, and I think this is obvious enough you can push it.
--
John Baldwin
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] gdb/amd64: clean up unused variable
2022-08-02 15:44 ` John Baldwin
@ 2022-08-03 12:30 ` Enze Li via Gdb-patches
0 siblings, 0 replies; 5+ messages in thread
From: Enze Li via Gdb-patches @ 2022-08-03 12:30 UTC (permalink / raw)
To: John Baldwin, gdb-patches; +Cc: enze.li
On Tue, 2022-08-02 at 08:44 -0700, John Baldwin wrote:
> On 8/1/22 3:23 PM, Enze Li wrote:
> > When building with clang 15, I got this,
> >
> > CXX amd64-tdep.o
> > amd64-tdep.c:1410:13: error: variable 'insn' set but not used[-
> > Werror,-Wunused-but-set-variable]
> > gdb_byte *insn = insn_details->raw_insn + modrm_offset;
> > ^
> > 1 error generated.
> >
> > The function that uses this variable has been removed in this
> > commit,
>
> LGTM, and I think this is obvious enough you can push it.
>
Thanks, John. Pushed.
Enze
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-08-03 12:31 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-31 4:14 [PATCH] gdb/amd64: clean up unused variable Enze Li via Gdb-patches
2022-08-01 17:55 ` John Baldwin
2022-08-01 22:23 ` [PATCH v2] " Enze Li via Gdb-patches
2022-08-02 15:44 ` John Baldwin
2022-08-03 12:30 ` Enze Li via Gdb-patches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox