From: Roger Sayle <roger@eyesopen.com>
To: Daniel Jacobowitz <drow@false.org>
Cc: gdb-patches@sourceware.org
Subject: [PATCH] Fix IRIX compilation failure in solib-irix.c (take 2)
Date: Mon, 24 Jul 2006 22:00:00 -0000 [thread overview]
Message-ID: <Pine.LNX.4.44.0607241523040.22774-200000@www.eyesopen.com> (raw)
In-Reply-To: <20060724200731.GB15759@nevyn.them.org>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 4077 bytes --]
Hi Dan,
On Mon, 24 Jul 2006, Daniel Jacobowitz wrote:
> Would it work to (A) add ".b" to the end of the expressions, and
> (B) change gdb_int32_bytes and gdb_int64_bytes to use gdb_byte?
> We try to avoid these casts; they're usually symptomatic of a type
> problem elsewhere.
Ah, clever. Yep, that fixes the build problem on IRIX for me.
The following patch has been tested by building on mips-sgi-irix6.5.
Many thanks for the suggestion.
2006-07-24 Roger Sayle <roger@eyesopen.com>
Daniel Jacobowitz <dan@codesourcery.com>
* solib-irix.c (gdb_int32_bytes): Use gdb_byte instead of char.
(gdb_int64_bytes): Likewise.
(fetch_lm_info): Use .b fields of gdb_int32_bytes and gdb_int64_bytes
as first argument to extract_unsigned_integer to silence compiler
warnings.
Index: solib-irix.c
===================================================================
RCS file: /cvs/src/src/gdb/solib-irix.c,v
retrieving revision 1.10
diff -c -3 -p -r1.10 solib-irix.c
*** solib-irix.c 18 Apr 2006 19:20:06 -0000 1.10
--- solib-irix.c 24 Jul 2006 21:45:20 -0000
*************** struct lm_info
*** 62,73 ****
typedef struct
{
! char b[4];
}
gdb_int32_bytes;
typedef struct
{
! char b[8];
}
gdb_int64_bytes;
--- 62,73 ----
typedef struct
{
! gdb_byte b[4];
}
gdb_int32_bytes;
typedef struct
{
! gdb_byte b[8];
}
gdb_int64_bytes;
*************** fetch_lm_info (CORE_ADDR addr)
*** 152,158 ****
being at the end of a page or the like.) */
read_memory (addr, (char *) &buf, sizeof (buf.ol32));
! if (extract_unsigned_integer (&buf.magic, sizeof (buf.magic)) != 0xffffffff)
{
/* Use buf.ol32... */
char obj_buf[432];
--- 152,158 ----
being at the end of a page or the like.) */
read_memory (addr, (char *) &buf, sizeof (buf.ol32));
! if (extract_unsigned_integer (buf.magic.b, sizeof (buf.magic)) != 0xffffffff)
{
/* Use buf.ol32... */
char obj_buf[432];
*************** fetch_lm_info (CORE_ADDR addr)
*** 168,174 ****
- extract_mips_address (&obj_buf[248], 4);
}
! else if (extract_unsigned_integer (&buf.oi32.oi_size,
sizeof (buf.oi32.oi_size))
== sizeof (buf.oi32))
{
--- 168,174 ----
- extract_mips_address (&obj_buf[248], 4);
}
! else if (extract_unsigned_integer (buf.oi32.oi_size.b,
sizeof (buf.oi32.oi_size))
== sizeof (buf.oi32))
{
*************** fetch_lm_info (CORE_ADDR addr)
*** 188,198 ****
sizeof (buf.oi32.oi_orig_ehdr));
li.pathname_addr = extract_mips_address (&buf.oi32.oi_pathname,
sizeof (buf.oi32.oi_pathname));
! li.pathname_len = extract_unsigned_integer (&buf.oi32.oi_pathname_len,
sizeof (buf.oi32.
oi_pathname_len));
}
! else if (extract_unsigned_integer (&buf.oi64.oi_size,
sizeof (buf.oi64.oi_size))
== sizeof (buf.oi64))
{
--- 188,198 ----
sizeof (buf.oi32.oi_orig_ehdr));
li.pathname_addr = extract_mips_address (&buf.oi32.oi_pathname,
sizeof (buf.oi32.oi_pathname));
! li.pathname_len = extract_unsigned_integer (buf.oi32.oi_pathname_len.b,
sizeof (buf.oi32.
oi_pathname_len));
}
! else if (extract_unsigned_integer (buf.oi64.oi_size.b,
sizeof (buf.oi64.oi_size))
== sizeof (buf.oi64))
{
*************** fetch_lm_info (CORE_ADDR addr)
*** 212,218 ****
sizeof (buf.oi64.oi_orig_ehdr));
li.pathname_addr = extract_mips_address (&buf.oi64.oi_pathname,
sizeof (buf.oi64.oi_pathname));
! li.pathname_len = extract_unsigned_integer (&buf.oi64.oi_pathname_len,
sizeof (buf.oi64.
oi_pathname_len));
}
--- 212,218 ----
sizeof (buf.oi64.oi_orig_ehdr));
li.pathname_addr = extract_mips_address (&buf.oi64.oi_pathname,
sizeof (buf.oi64.oi_pathname));
! li.pathname_len = extract_unsigned_integer (buf.oi64.oi_pathname_len.b,
sizeof (buf.oi64.
oi_pathname_len));
}
Roger
--
[-- Attachment #2: Type: TEXT/PLAIN, Size: 3406 bytes --]
Index: solib-irix.c
===================================================================
RCS file: /cvs/src/src/gdb/solib-irix.c,v
retrieving revision 1.10
diff -c -3 -p -r1.10 solib-irix.c
*** solib-irix.c 18 Apr 2006 19:20:06 -0000 1.10
--- solib-irix.c 24 Jul 2006 21:45:20 -0000
*************** struct lm_info
*** 62,73 ****
typedef struct
{
! char b[4];
}
gdb_int32_bytes;
typedef struct
{
! char b[8];
}
gdb_int64_bytes;
--- 62,73 ----
typedef struct
{
! gdb_byte b[4];
}
gdb_int32_bytes;
typedef struct
{
! gdb_byte b[8];
}
gdb_int64_bytes;
*************** fetch_lm_info (CORE_ADDR addr)
*** 152,158 ****
being at the end of a page or the like.) */
read_memory (addr, (char *) &buf, sizeof (buf.ol32));
! if (extract_unsigned_integer (&buf.magic, sizeof (buf.magic)) != 0xffffffff)
{
/* Use buf.ol32... */
char obj_buf[432];
--- 152,158 ----
being at the end of a page or the like.) */
read_memory (addr, (char *) &buf, sizeof (buf.ol32));
! if (extract_unsigned_integer (buf.magic.b, sizeof (buf.magic)) != 0xffffffff)
{
/* Use buf.ol32... */
char obj_buf[432];
*************** fetch_lm_info (CORE_ADDR addr)
*** 168,174 ****
- extract_mips_address (&obj_buf[248], 4);
}
! else if (extract_unsigned_integer (&buf.oi32.oi_size,
sizeof (buf.oi32.oi_size))
== sizeof (buf.oi32))
{
--- 168,174 ----
- extract_mips_address (&obj_buf[248], 4);
}
! else if (extract_unsigned_integer (buf.oi32.oi_size.b,
sizeof (buf.oi32.oi_size))
== sizeof (buf.oi32))
{
*************** fetch_lm_info (CORE_ADDR addr)
*** 188,198 ****
sizeof (buf.oi32.oi_orig_ehdr));
li.pathname_addr = extract_mips_address (&buf.oi32.oi_pathname,
sizeof (buf.oi32.oi_pathname));
! li.pathname_len = extract_unsigned_integer (&buf.oi32.oi_pathname_len,
sizeof (buf.oi32.
oi_pathname_len));
}
! else if (extract_unsigned_integer (&buf.oi64.oi_size,
sizeof (buf.oi64.oi_size))
== sizeof (buf.oi64))
{
--- 188,198 ----
sizeof (buf.oi32.oi_orig_ehdr));
li.pathname_addr = extract_mips_address (&buf.oi32.oi_pathname,
sizeof (buf.oi32.oi_pathname));
! li.pathname_len = extract_unsigned_integer (buf.oi32.oi_pathname_len.b,
sizeof (buf.oi32.
oi_pathname_len));
}
! else if (extract_unsigned_integer (buf.oi64.oi_size.b,
sizeof (buf.oi64.oi_size))
== sizeof (buf.oi64))
{
*************** fetch_lm_info (CORE_ADDR addr)
*** 212,218 ****
sizeof (buf.oi64.oi_orig_ehdr));
li.pathname_addr = extract_mips_address (&buf.oi64.oi_pathname,
sizeof (buf.oi64.oi_pathname));
! li.pathname_len = extract_unsigned_integer (&buf.oi64.oi_pathname_len,
sizeof (buf.oi64.
oi_pathname_len));
}
--- 212,218 ----
sizeof (buf.oi64.oi_orig_ehdr));
li.pathname_addr = extract_mips_address (&buf.oi64.oi_pathname,
sizeof (buf.oi64.oi_pathname));
! li.pathname_len = extract_unsigned_integer (buf.oi64.oi_pathname_len.b,
sizeof (buf.oi64.
oi_pathname_len));
}
next prev parent reply other threads:[~2006-07-24 22:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-21 5:21 [PATCH] Fix IRIX compilation failure in solib-irix.c Roger Sayle
2006-07-24 20:07 ` Daniel Jacobowitz
2006-07-24 22:00 ` Roger Sayle [this message]
2006-07-24 22:03 ` [PATCH] Fix IRIX compilation failure in solib-irix.c (take 2) Daniel Jacobowitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.44.0607241523040.22774-200000@www.eyesopen.com \
--to=roger@eyesopen.com \
--cc=drow@false.org \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox