* [PATCH v2 0/4] Fix various warnings from clang 3.8.0
@ 2016-07-01 17:41 John Baldwin
2016-07-01 17:41 ` [PATCH v2 2/4] Set uses_fp for frames with a valid FP register explicitly John Baldwin
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: John Baldwin @ 2016-07-01 17:41 UTC (permalink / raw)
To: gdb-patches
I've committed five of the patches from the original series that
were approved.
sh64-tdep.c has been reworked to set uses_fp explicitly when setting
the FP register.
I've also added one new patch to trim extraneous parentheses from
an expression in h8300-tdep.c. Similar expressions in the same
function do not use extra parentheses.
John Baldwin (4):
Remove check for negative size.
Set uses_fp for frames with a valid FP register explicitly.
Use unsigned integer constant with left shifts.
Remove extraneous parentheses.
gdb/ChangeLog | 19 +++++++++++++++++++
gdb/ada-lang.c | 4 ++--
gdb/h8300-tdep.c | 2 +-
gdb/score-tdep.c | 8 +-------
gdb/sh64-tdep.c | 29 ++++++++++++++++++-----------
5 files changed, 41 insertions(+), 21 deletions(-)
--
2.8.4
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 2/4] Set uses_fp for frames with a valid FP register explicitly.
2016-07-01 17:41 [PATCH v2 0/4] Fix various warnings from clang 3.8.0 John Baldwin
@ 2016-07-01 17:41 ` John Baldwin
2016-07-06 7:56 ` Yao Qi
2016-07-01 17:41 ` [PATCH v2 3/4] Use unsigned integer constant with left shifts John Baldwin
` (2 subsequent siblings)
3 siblings, 1 reply; 9+ messages in thread
From: John Baldwin @ 2016-07-01 17:41 UTC (permalink / raw)
To: gdb-patches
Since CORE_ADDR is unsigned, the saved FP register is always greater than
or equal to zero. Replace the comparison by explicitly setting uses_fp to
1 for frames with a valid FP register.
gdb/ChangeLog:
* sh64-tdep.c (sh64_analyze_prologue): Set "uses_fp" when setting
the MEDIA_FP_REGNUM register.
---
gdb/ChangeLog | 5 +++++
gdb/sh64-tdep.c | 29 ++++++++++++++++++-----------
2 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index fef34e2..727cf37 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2016-07-01 John Baldwin <jhb@FreeBSD.org>
+ * sh64-tdep.c (sh64_analyze_prologue): Set "uses_fp" when setting
+ the MEDIA_FP_REGNUM register.
+
+2016-07-01 John Baldwin <jhb@FreeBSD.org>
+
* score-tdep.c (score7_malloc_and_get_memblock): Remove check for
negative size.
diff --git a/gdb/sh64-tdep.c b/gdb/sh64-tdep.c
index e6b1e27..ee8d19c 100644
--- a/gdb/sh64-tdep.c
+++ b/gdb/sh64-tdep.c
@@ -901,8 +901,11 @@ sh64_analyze_prologue (struct gdbarch *gdbarch,
}
else if (IS_MOV_R14 (insn))
- cache->saved_regs[MEDIA_FP_REGNUM] =
- cache->sp_offset - ((((insn & 0xf) ^ 0x8) - 0x8) << 2);
+ {
+ cache->saved_regs[MEDIA_FP_REGNUM] =
+ cache->sp_offset - ((((insn & 0xf) ^ 0x8) - 0x8) << 2);
+ cache->uses_fp = 1;
+ }
else if (IS_MOV_R0 (insn))
{
@@ -931,6 +934,7 @@ sh64_analyze_prologue (struct gdbarch *gdbarch,
/* Store R14 at r0_val-4 from SP. Decrement r0 by 4. */
cache->saved_regs[MEDIA_FP_REGNUM] = cache->sp_offset
- (r0_val - 4);
+ cache->uses_fp = 1;
r0_val -= 4;
}
@@ -957,22 +961,25 @@ sh64_analyze_prologue (struct gdbarch *gdbarch,
9) << 2);
else if (IS_STQ_R14_R15 (insn))
- cache->saved_regs[MEDIA_FP_REGNUM]
- = cache->sp_offset - (sign_extend ((insn & 0xffc00) >> 10,
- 9) << 3);
+ {
+ cache->saved_regs[MEDIA_FP_REGNUM]
+ = cache->sp_offset - (sign_extend ((insn & 0xffc00) >> 10,
+ 9) << 3);
+ cache->uses_fp = 1;
+ }
else if (IS_STL_R14_R15 (insn))
- cache->saved_regs[MEDIA_FP_REGNUM]
- = cache->sp_offset - (sign_extend ((insn & 0xffc00) >> 10,
- 9) << 2);
+ {
+ cache->saved_regs[MEDIA_FP_REGNUM]
+ = cache->sp_offset - (sign_extend ((insn & 0xffc00) >> 10,
+ 9) << 2);
+ cache->uses_fp = 1;
+ }
else if (IS_MOV_SP_FP_MEDIA (insn))
break;
}
}
-
- if (cache->saved_regs[MEDIA_FP_REGNUM] >= 0)
- cache->uses_fp = 1;
}
static CORE_ADDR
--
2.8.4
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 1/4] Remove check for negative size.
2016-07-01 17:41 [PATCH v2 0/4] Fix various warnings from clang 3.8.0 John Baldwin
2016-07-01 17:41 ` [PATCH v2 2/4] Set uses_fp for frames with a valid FP register explicitly John Baldwin
2016-07-01 17:41 ` [PATCH v2 3/4] Use unsigned integer constant with left shifts John Baldwin
@ 2016-07-01 17:41 ` John Baldwin
2016-07-06 8:14 ` Yao Qi
2016-07-01 17:46 ` [PATCH v2 4/4] Remove extraneous parentheses John Baldwin
3 siblings, 1 reply; 9+ messages in thread
From: John Baldwin @ 2016-07-01 17:41 UTC (permalink / raw)
To: gdb-patches
Since CORE_ADDR is unsigned, this value can never be negative.
gdb/ChangeLog:
* score-tdep.c (score7_malloc_and_get_memblock): Remove check for
negative size.
---
gdb/ChangeLog | 5 +++++
gdb/score-tdep.c | 8 +-------
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 58c9c78..fef34e2 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2016-07-01 John Baldwin <jhb@FreeBSD.org>
+ * score-tdep.c (score7_malloc_and_get_memblock): Remove check for
+ negative size.
+
+2016-07-01 John Baldwin <jhb@FreeBSD.org>
+
* fbsd-nat.c (struct fbsd_fork_child_info): Rename to ...
(struct fbsd_fork_info): ... this.
(struct fbsd_fork_info) <child>: Rename to ...
diff --git a/gdb/score-tdep.c b/gdb/score-tdep.c
index 0d817f8..8e08d05 100644
--- a/gdb/score-tdep.c
+++ b/gdb/score-tdep.c
@@ -813,13 +813,7 @@ score7_malloc_and_get_memblock (CORE_ADDR addr, CORE_ADDR size)
int ret;
gdb_byte *memblock = NULL;
- if (size < 0)
- {
- error (_("Error: malloc size < 0 in file:%s, line:%d!"),
- __FILE__, __LINE__);
- return NULL;
- }
- else if (size == 0)
+ if (size == 0)
return NULL;
memblock = (gdb_byte *) xmalloc (size);
--
2.8.4
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 3/4] Use unsigned integer constant with left shifts.
2016-07-01 17:41 [PATCH v2 0/4] Fix various warnings from clang 3.8.0 John Baldwin
2016-07-01 17:41 ` [PATCH v2 2/4] Set uses_fp for frames with a valid FP register explicitly John Baldwin
@ 2016-07-01 17:41 ` John Baldwin
2016-07-06 8:03 ` Yao Qi
2016-07-01 17:41 ` [PATCH v2 1/4] Remove check for negative size John Baldwin
2016-07-01 17:46 ` [PATCH v2 4/4] Remove extraneous parentheses John Baldwin
3 siblings, 1 reply; 9+ messages in thread
From: John Baldwin @ 2016-07-01 17:41 UTC (permalink / raw)
To: gdb-patches
This avoids undefined behavior.
gdb/ChangeLog:
* ada-lang.c (ada_unpack_from_contents): Use unsigned constants with
left shifts.
---
gdb/ChangeLog | 5 +++++
gdb/ada-lang.c | 4 ++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 727cf37..97db7ef 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2016-07-01 John Baldwin <jhb@FreeBSD.org>
+ * ada-lang.c (ada_unpack_from_contents): Use unsigned constants with
+ left shifts.
+
+2016-07-01 John Baldwin <jhb@FreeBSD.org>
+
* sh64-tdep.c (sh64_analyze_prologue): Set "uses_fp" when setting
the MEDIA_FP_REGNUM register.
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index b22b7ac..05bfd7b 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -2525,7 +2525,7 @@ ada_unpack_from_contents (const gdb_byte *src, int bit_offset, int bit_size,
accumSize += HOST_CHAR_BIT - unusedLS;
if (accumSize >= HOST_CHAR_BIT)
{
- unpacked[unpacked_idx] = accum & ~(~0L << HOST_CHAR_BIT);
+ unpacked[unpacked_idx] = accum & ~(~0UL << HOST_CHAR_BIT);
accumSize -= HOST_CHAR_BIT;
accum >>= HOST_CHAR_BIT;
unpacked_bytes_left -= 1;
@@ -2539,7 +2539,7 @@ ada_unpack_from_contents (const gdb_byte *src, int bit_offset, int bit_size,
while (unpacked_bytes_left > 0)
{
accum |= sign << accumSize;
- unpacked[unpacked_idx] = accum & ~(~0L << HOST_CHAR_BIT);
+ unpacked[unpacked_idx] = accum & ~(~0UL << HOST_CHAR_BIT);
accumSize -= HOST_CHAR_BIT;
if (accumSize < 0)
accumSize = 0;
--
2.8.4
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 4/4] Remove extraneous parentheses.
2016-07-01 17:41 [PATCH v2 0/4] Fix various warnings from clang 3.8.0 John Baldwin
` (2 preceding siblings ...)
2016-07-01 17:41 ` [PATCH v2 1/4] Remove check for negative size John Baldwin
@ 2016-07-01 17:46 ` John Baldwin
2016-07-06 8:08 ` Yao Qi
3 siblings, 1 reply; 9+ messages in thread
From: John Baldwin @ 2016-07-01 17:46 UTC (permalink / raw)
To: gdb-patches
gdb/ChangeLog:
* h8300-tdep.c (h8300_print_register): Remove extraneous parentheses.
---
gdb/ChangeLog | 4 ++++
gdb/h8300-tdep.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 97db7ef..4ce7dd6 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
2016-07-01 John Baldwin <jhb@FreeBSD.org>
+ * h8300-tdep.c (h8300_print_register): Remove extraneous parentheses.
+
+2016-07-01 John Baldwin <jhb@FreeBSD.org>
+
* ada-lang.c (ada_unpack_from_contents): Use unsigned constants with
left shifts.
diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c
index d479a20..951f005 100644
--- a/gdb/h8300-tdep.c
+++ b/gdb/h8300-tdep.c
@@ -1051,7 +1051,7 @@ h8300_print_register (struct gdbarch *gdbarch, struct ui_file *file,
fprintf_filtered (file, "u> ");
if ((C | Z) == 1)
fprintf_filtered (file, "u<= ");
- if ((C == 0))
+ if (C == 0)
fprintf_filtered (file, "u>= ");
if (C == 1)
fprintf_filtered (file, "u< ");
--
2.8.4
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 2/4] Set uses_fp for frames with a valid FP register explicitly.
2016-07-01 17:41 ` [PATCH v2 2/4] Set uses_fp for frames with a valid FP register explicitly John Baldwin
@ 2016-07-06 7:56 ` Yao Qi
0 siblings, 0 replies; 9+ messages in thread
From: Yao Qi @ 2016-07-06 7:56 UTC (permalink / raw)
To: John Baldwin; +Cc: gdb-patches
On Fri, Jul 1, 2016 at 6:40 PM, John Baldwin <jhb@freebsd.org> wrote:
> Since CORE_ADDR is unsigned, the saved FP register is always greater than
> or equal to zero. Replace the comparison by explicitly setting uses_fp to
> 1 for frames with a valid FP register.
>
> gdb/ChangeLog:
>
> * sh64-tdep.c (sh64_analyze_prologue): Set "uses_fp" when setting
> the MEDIA_FP_REGNUM register.
Patch is OK.
--
Yao (齐尧)
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 3/4] Use unsigned integer constant with left shifts.
2016-07-01 17:41 ` [PATCH v2 3/4] Use unsigned integer constant with left shifts John Baldwin
@ 2016-07-06 8:03 ` Yao Qi
0 siblings, 0 replies; 9+ messages in thread
From: Yao Qi @ 2016-07-06 8:03 UTC (permalink / raw)
To: John Baldwin; +Cc: gdb-patches
On Fri, Jul 1, 2016 at 6:40 PM, John Baldwin <jhb@freebsd.org> wrote:
> This avoids undefined behavior.
>
> gdb/ChangeLog:
>
> * ada-lang.c (ada_unpack_from_contents): Use unsigned constants with
> left shifts.
Patch is good to me.
--
Yao (齐尧)
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 4/4] Remove extraneous parentheses.
2016-07-01 17:46 ` [PATCH v2 4/4] Remove extraneous parentheses John Baldwin
@ 2016-07-06 8:08 ` Yao Qi
0 siblings, 0 replies; 9+ messages in thread
From: Yao Qi @ 2016-07-06 8:08 UTC (permalink / raw)
To: John Baldwin; +Cc: gdb-patches
On Fri, Jul 1, 2016 at 6:40 PM, John Baldwin <jhb@freebsd.org> wrote:
> gdb/ChangeLog:
>
> * h8300-tdep.c (h8300_print_register): Remove extraneous parentheses.
Patch is good to me.
--
Yao (齐尧)
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 1/4] Remove check for negative size.
2016-07-01 17:41 ` [PATCH v2 1/4] Remove check for negative size John Baldwin
@ 2016-07-06 8:14 ` Yao Qi
0 siblings, 0 replies; 9+ messages in thread
From: Yao Qi @ 2016-07-06 8:14 UTC (permalink / raw)
To: John Baldwin; +Cc: gdb-patches
On Fri, Jul 1, 2016 at 6:40 PM, John Baldwin <jhb@freebsd.org> wrote:
> Since CORE_ADDR is unsigned, this value can never be negative.
>
score7_malloc_and_get_memblock is called like this,
/* Allocate MEMBLOCK if PC - STARTADDR > 0. */
memblock_ptr = memblock =
score7_malloc_and_get_memblock (startaddr, pc - startaddr);
and startaddr is got by find_pc_partial_function
find_pc_partial_function (pc, NULL, &start_addr, NULL);
so pc >= startaddr, so size is >= 0. Your patch is right to me.
--
Yao (齐尧)
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2016-07-06 8:14 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-01 17:41 [PATCH v2 0/4] Fix various warnings from clang 3.8.0 John Baldwin
2016-07-01 17:41 ` [PATCH v2 2/4] Set uses_fp for frames with a valid FP register explicitly John Baldwin
2016-07-06 7:56 ` Yao Qi
2016-07-01 17:41 ` [PATCH v2 3/4] Use unsigned integer constant with left shifts John Baldwin
2016-07-06 8:03 ` Yao Qi
2016-07-01 17:41 ` [PATCH v2 1/4] Remove check for negative size John Baldwin
2016-07-06 8:14 ` Yao Qi
2016-07-01 17:46 ` [PATCH v2 4/4] Remove extraneous parentheses John Baldwin
2016-07-06 8:08 ` Yao Qi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).