* [PATCH] Fix IRIX compilation failure in solib-irix.c
@ 2006-07-21 5:21 Roger Sayle
2006-07-24 20:07 ` Daniel Jacobowitz
0 siblings, 1 reply; 4+ messages in thread
From: Roger Sayle @ 2006-07-21 5:21 UTC (permalink / raw)
To: gdb-patches
Building mainline gdb on mips-sgi-irix6.5 during the compilation of
gdb/solib-irix.c due to the interaction of -Werror and the compilation
warnings caused by the implicit cases of the first argument in the
calls to extract_unsigned_integer.
The obvious fix is to cast the problematic arguments to gdb_byte*
as expected by extract_unsigned_integer. This allows the build of
gdb to complete without MIPS/IRIX.
Ok for mainline? Although I have a gdb copyright assignment on file,
I don't have write access to src, so I'd appreciate it if someone could
commit this for me. Thanks in advance,
2006-07-20 Roger Sayle <roger@eyesopen.com>
* solib-irix.c (fetch_lm_info): Cast the first argument of
extract_unsigned_integer to "const gdb_byte*" to silence 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 21 Jul 2006 05:03:31 -0000
*************** 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,160 ----
being at the end of a page or the like.) */
read_memory (addr, (char *) &buf, sizeof (buf.ol32));
! if (extract_unsigned_integer ((const gdb_byte*) &buf.magic,
! 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))
{
--- 170,176 ----
- extract_mips_address (&obj_buf[248], 4);
}
! else if (extract_unsigned_integer ((const gdb_byte *) &buf.oi32.oi_size,
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))
{
--- 190,200 ----
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
! ((const gdb_byte *) &buf.oi32.oi_pathname_len,
! sizeof (buf.oi32.oi_pathname_len));
}
! else if (extract_unsigned_integer ((const gdb_byte *) &buf.oi64.oi_size,
sizeof (buf.oi64.oi_size))
== sizeof (buf.oi64))
{
*************** fetch_lm_info (CORE_ADDR addr)
*** 212,220 ****
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));
}
else
{
--- 214,222 ----
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
! ((const gdb_byte *) &buf.oi64.oi_pathname_len,
! sizeof (buf.oi64.oi_pathname_len));
}
else
{
Roger
--
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] Fix IRIX compilation failure in solib-irix.c 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 ` [PATCH] Fix IRIX compilation failure in solib-irix.c (take 2) Roger Sayle 0 siblings, 1 reply; 4+ messages in thread From: Daniel Jacobowitz @ 2006-07-24 20:07 UTC (permalink / raw) To: Roger Sayle; +Cc: gdb-patches On Thu, Jul 20, 2006 at 10:52:21PM -0600, Roger Sayle wrote: > > Building mainline gdb on mips-sgi-irix6.5 during the compilation of > gdb/solib-irix.c due to the interaction of -Werror and the compilation > warnings caused by the implicit cases of the first argument in the > calls to extract_unsigned_integer. > > The obvious fix is to cast the problematic arguments to gdb_byte* > as expected by extract_unsigned_integer. This allows the build of > gdb to complete without MIPS/IRIX. > > Ok for mainline? Although I have a gdb copyright assignment on file, > I don't have write access to src, so I'd appreciate it if someone could > commit this for me. Thanks in advance, 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. -- Daniel Jacobowitz CodeSourcery ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] Fix IRIX compilation failure in solib-irix.c (take 2) 2006-07-24 20:07 ` Daniel Jacobowitz @ 2006-07-24 22:00 ` Roger Sayle 2006-07-24 22:03 ` Daniel Jacobowitz 0 siblings, 1 reply; 4+ messages in thread From: Roger Sayle @ 2006-07-24 22:00 UTC (permalink / raw) To: Daniel Jacobowitz; +Cc: gdb-patches [-- 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)); } ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Fix IRIX compilation failure in solib-irix.c (take 2) 2006-07-24 22:00 ` [PATCH] Fix IRIX compilation failure in solib-irix.c (take 2) Roger Sayle @ 2006-07-24 22:03 ` Daniel Jacobowitz 0 siblings, 0 replies; 4+ messages in thread From: Daniel Jacobowitz @ 2006-07-24 22:03 UTC (permalink / raw) To: Roger Sayle; +Cc: gdb-patches On Mon, Jul 24, 2006 at 03:29:36PM -0600, Roger Sayle wrote: > > 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. And thanks in turn for the patch. I've committed this. -- Daniel Jacobowitz CodeSourcery ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-07-24 22:03 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 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 ` [PATCH] Fix IRIX compilation failure in solib-irix.c (take 2) Roger Sayle 2006-07-24 22:03 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox