From: jtc@redback.com (J.T. Conklin)
To: Kevin Buettner <kevinb@cygnus.com>
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: [PATCH RFC] Protoize m32r-stub.c, m88k-nat.c, m88k-tdep.c
Date: Fri, 15 Sep 2000 12:07:00 -0000 [thread overview]
Message-ID: <5mitrxxyn5.fsf@jtc.redback.com> (raw)
In-Reply-To: <1000915185022.ZM5331@ocotillo.lan>
>>>>> "Kevin" == Kevin Buettner <kevinb@cygnus.com> writes:
Kevin> Okay. However, just so that we have some patches to look at while
Kevin> we conduct our deliberations, I've appended a patch below which
Kevin> shows what the reversion patch would look like.
Thanks. At the very least, that make sure we're all on the same page.
>> I'm pretty ambivilent about it myself. In my experience, beyond toy
>> programs, stubs get hacked quite extensively to integrate them into
>> the target system. Removing protototypes would be the least of the
>> user's worries.
Kevin> I see. I knew that the stubs were examples, but I was also
Kevin> under the impression that the examples that we include would
Kevin> (or did at one time) compile on some real system.
I'm pretty sure the stubs build and are usable as is. I recently
built i386-stub.c for some tests.
What I was trying to say is that when a stub is integrated into a
system, it may be modified to fit the conventions already being used.
For example, if a system has a constant exception handler, the stubs
code that installs exception vectors is probably going to be ripped
out and the appropriate entries in the table will be made to point to
the stub. If the target system's exception stack frame saves
registers in a different order, the stub may be modified to
fetch/store registers in the target's order instead of imposing the
GDB order on the target, etc. There are a lot of implementation
details that might necessitate hacking the stub.
--jtc
--
J.T. Conklin
RedBack Networks
From jtc@redback.com Fri Sep 15 12:13:00 2000
From: jtc@redback.com (J.T. Conklin)
To: Stan Shebs <shebs@apple.com>
Cc: Kevin Buettner <kevinb@cygnus.com>, gdb-patches@sourceware.cygnus.com
Subject: Re: [PATCH RFC] Protoize m32r-stub.c, m88k-nat.c, m88k-tdep.c
Date: Fri, 15 Sep 2000 12:13:00 -0000
Message-id: <5mem2lxycm.fsf@jtc.redback.com>
References: <1000915073306.ZM4195@ocotillo.lan> <5mk8cdzgri.fsf@jtc.redback.com> <1000915181249.ZM5172@ocotillo.lan> <5mwvgdy09h.fsf@jtc.redback.com> <39C26F82.288A4D27@apple.com>
X-SW-Source: 2000-09/msg00146.html
Content-length: 1213
>>>>> "Stan" == Stan Shebs <shebs@apple.com> writes:
Stan> So can you imagine any possible circumstance in which having a
Stan> prototyped and/or ISO stub would be a problem for an actual
Stan> embedded system developer today? The only example I can
Stan> synthesize involves somebody that can only use GDB with one of
Stan> Sun's old compilers adapted for embedded use, but not GCC.
Stan> That's pretty farfetched though, and I've never heard of an
Stan> actual case like that.
I have :-(.
When I went to Cisco, the project I worked on had once used BSD/OS's
native toolchain to generate the image for the target system. Then
they switched to Plan 9 and used the Plan 9 native tools to generate
the image. While both BSD/OS (gnu-based) toolchain and the Plan 9
tools understood prototypes; I mention this just to confirm that there
are folks out there that do *really wierd things*.
I have to agree, it's hard to imagine a situation where a prototyped
stub would be problem. As I mentioned in earlier messages, even if a
developer worked in an environment without prototypes, fixing that is
nothing compared to integrating it into his/her target system.
--jtc
--
J.T. Conklin
RedBack Networks
From fnasser@cygnus.com Fri Sep 15 13:59:00 2000
From: Fernando Nasser <fnasser@cygnus.com>
To: gdb-patches@sourceware.cygnus.com
Subject: RFA: Patch to remote.c - Fix to recovery from lost ACK
Date: Fri, 15 Sep 2000 13:59:00 -0000
Message-id: <39C28D98.D067DF65@cygnus.com>
X-SW-Source: 2000-09/msg00147.html
Content-length: 2423
Andrew and me were looking at this code and we saw something that did not looked
right. I created this patch that I think straights things up.
2000-09-15 Fernando Nasser <fnasser@totem.to.cygnus.com>
* remote.c (putpkt_binary): Call read_frame, not getpkt. Log message.
(read_frame): Do not call error() on communication error when
reading checksum, but return failure instead and log message.
--
Fernando Nasser
Red Hat - Toronto E-Mail: fnasser@cygnus.com
Index: remote.c
===================================================================
RCS file: /cvs/src/src/gdb/remote.c,v
retrieving revision 1.23
diff -c -p -r1.23 remote.c
*** remote.c 2000/09/01 00:12:10 1.23
--- remote.c 2000/09/15 20:48:13
*************** putpkt_binary (char *buf, int cnt)
*** 3796,3804 ****
break; /* Retransmit buffer */
case '$':
{
/* It's probably an old response, and we're out of sync.
Just gobble up the packet and ignore it. */
! getpkt (junkbuf, sizeof_junkbuf, 0);
continue; /* Now, go look for + */
}
default:
--- 3796,3806 ----
break; /* Retransmit buffer */
case '$':
{
+ if (remote_debug)
+ fprintf_unfiltered (gdb_stdlog, "Packet instead of Ack, ignoring it\n");
/* It's probably an old response, and we're out of sync.
Just gobble up the packet and ignore it. */
! read_frame (junkbuf, sizeof_junkbuf);
continue; /* Now, go look for + */
}
default:
*************** read_frame (char *buf,
*** 3887,3893 ****
return -1;
}
else if (check_0 < 0 || check_1 < 0)
! error ("Communication error in checksum");
pktcsum = (fromhex (check_0) << 4) | fromhex (check_1);
if (csum == pktcsum)
--- 3889,3899 ----
return -1;
}
else if (check_0 < 0 || check_1 < 0)
! {
! if (remote_debug)
! fputs_filtered ("Communication error in checksum\n", gdb_stdlog);
! return -1;
! }
pktcsum = (fromhex (check_0) << 4) | fromhex (check_1);
if (csum == pktcsum)
From Peter.Schauer@regent.e-technik.tu-muenchen.de Sun Sep 17 04:03:00 2000
From: "Peter.Schauer" <Peter.Schauer@regent.e-technik.tu-muenchen.de>
To: gdb-patches@sourceware.cygnus.com
Subject: RFD: Testsuite cases for inferior function calls
Date: Sun, 17 Sep 2000 04:03:00 -0000
Message-id: <200009171103.NAA24702@reisser.regent.e-technik.tu-muenchen.de>
X-SW-Source: 2000-09/msg00148.html
Content-length: 14787
Fernando Nasser wrote:
> Probably because there is no testcase for this... (hint hint hint)
I have spent some time to come up with testsuite cases for this,
and fixing all the GDB bugs that turned up in the targets I have access to
(Solaris sparc, Solaris x86, AIX 4.3, Linux x86).
I suspect that many more targets might fail on these testcases, so before I
go to all the trouble for submitting proper RFAs for the changes (adding
more comments and ChangeLog entries), is there any chance that the new
testsuite cases get accepted ?
I'd also be interested in the test results on other targets for the new
testcases.
Here are my current diffs versus CVS GDB from Sep 15:
*** ./testsuite/gdb.base/callfuncs.c.orig Mon Jun 28 18:02:51 1999
--- ./testsuite/gdb.base/callfuncs.c Fri Sep 15 21:36:51 2000
***************
*** 172,192 ****
(i5 == 5) && (i6 == 6) && (i7 == 7) && (i8 == 8) && (i9 == 9);
}
-
- /* Gotta have a main to be able to generate a linked, runnable
- executable, and also provide a useful place to set a breakpoint. */
- extern void * malloc() ;
- int main ()
- {
- #ifdef usestubs
- set_debug_traps();
- breakpoint();
- #endif
- malloc(1);
- t_structs_c(struct_val1);
- return 0 ;
- }
-
/* Functions that expect specific values to be passed and return
either 0 or 1, depending upon whether the values were
passed incorrectly or correctly, respectively. */
--- 172,177 ----
***************
*** 356,359 ****
--- 341,360 ----
#endif
{
return ((*func_arg1)(a, b));
+ }
+
+
+ /* Gotta have a main to be able to generate a linked, runnable
+ executable, and also provide a useful place to set a breakpoint. */
+ extern void * malloc() ;
+ int main ()
+ {
+ #ifdef usestubs
+ set_debug_traps();
+ breakpoint();
+ #endif
+ malloc(1);
+ t_double_values(double_val1, double_val2);
+ t_structs_c(struct_val1);
+ return 0 ;
}
*** ./testsuite/gdb.base/callfuncs.exp.orig Thu Jan 6 04:06:51 2000
--- ./testsuite/gdb.base/callfuncs.exp Fri Sep 15 21:36:51 2000
***************
*** 237,242 ****
--- 237,260 ----
"call inferior func with struct - returns char *"
}
+ # Procedure to get current content of all registers.
+ global all_registers_content
+ set all_registers_content ""
+ proc do_get_all_registers { } {
+ global gdb_prompt
+ global expect_out
+ global all_registers_content
+
+ set all_registers_content ""
+ send_gdb "info all-registers\n"
+ gdb_expect {
+ -re "info all-registers\r\n(.*)$gdb_prompt $" {
+ set all_registers_content $expect_out(1,string)
+ }
+ default {}
+ }
+ }
+
# Start with a fresh gdb.
gdb_exit
***************
*** 271,277 ****
--- 289,368 ----
}
}
+ # Make sure that malloc gets called and that the floating point unit
+ # is initialized via a call to t_double_values.
+ gdb_test "next" "t_double_values\\(double_val1, double_val2\\);.*"
gdb_test "next" "t_structs_c\\(struct_val1\\);.*"
+
+ # Save all register contents.
+ do_get_all_registers
+ set old_reg_content $all_registers_content
+
+ # Perform function calls.
do_function_calls
+ # Check if all registers still have the same value.
+ do_get_all_registers
+ set new_reg_content $all_registers_content
+ if [string match $old_reg_content $new_reg_content] then {
+ pass "gdb function calls preserve register contents"
+ } else {
+ set old_reg_content $all_registers_content
+ fail "gdb function calls preserve register contents"
+ }
+
+ # Set breakpoint at a function we will call from gdb.
+ gdb_breakpoint add
+
+ # Call function (causing a breakpoint hit in the call dummy) and do a continue,
+ # make sure we are back at main and still have the same register contents.
+ gdb_test "print add(4,5)" "The program being debugged stopped while.*" ""
+ gdb_test "continue" "Continuing.*" "continue from call dummy breakpoint"
+ if ![gdb_test "bt 2" \
+ "#0 main.*" \
+ "bt after continuing from call dummy breakpoint"] then {
+ do_get_all_registers
+ set new_reg_content $all_registers_content
+ if [string match $old_reg_content $new_reg_content] then {
+ pass "continue after stop in call dummy preserves register contents"
+ } else {
+ fail "continue after stop in call dummy preserves register contents"
+ }
+ }
+
+ # Call function (causing a breakpoint hit in the call dummy) and do a finish,
+ # make sure we are back at main and still have the same register contents.
+ gdb_test "print add(4,5)" "The program being debugged stopped while.*" ""
+ gdb_test "finish" \
+ "Value returned is.* = 9" \
+ "finish from call dummy breakpoint returns correct value"
+ if ![gdb_test "bt 2" \
+ "#0 main.*" \
+ "bt after finishing from call dummy breakpoint"] then {
+ do_get_all_registers
+ set new_reg_content $all_registers_content
+ if [string match $old_reg_content $new_reg_content] then {
+ pass "finish after stop in call dummy preserves register contents"
+ } else {
+ fail "finish after stop in call dummy preserves register contents"
+ }
+ }
+
+ # Call function (causing a breakpoint hit in the call dummy) and do a return
+ # with a value, make sure we are back at main with the same register contents.
+ gdb_test "print add(4,5)" "The program being debugged stopped while.*" ""
+ if ![gdb_test "return 7" \
+ "#0 main.*" \
+ "back at main after return from call dummy breakpoint" \
+ "Make add return now. .y or n.*" \
+ "y"] then {
+ do_get_all_registers
+ set new_reg_content $all_registers_content
+ if [string match $old_reg_content $new_reg_content] then {
+ pass "return after stop in call dummy preserves register contents"
+ } else {
+ fail "return after stop in call dummy preserves register contents"
+ }
+ }
+
return 0
*** ./config/i386/nm-linux.h.orig Fri Sep 15 21:27:38 2000
--- ./config/i386/nm-linux.h Sun Sep 17 12:24:45 2000
***************
*** 65,76 ****
/* Override copies of {fetch,store}_inferior_registers in `infptrace.c'. */
#define FETCH_INFERIOR_REGISTERS
! /* Nevertheless, define CANNOT_{FETCH,STORE}_REGISTER, because we fall
back on the code `infptrace.c' (well a copy of that code in
`i386-linux-nat.c' for now) and we can access only the
general-purpose registers in that way. */
! #define CANNOT_FETCH_REGISTER(regno) ((regno) >= NUM_GREGS)
! #define CANNOT_STORE_REGISTER(regno) CANNOT_FETCH_REGISTER (regno)
/* Override child_resume in `infptrace.c'. */
#define CHILD_RESUME
--- 65,78 ----
/* Override copies of {fetch,store}_inferior_registers in `infptrace.c'. */
#define FETCH_INFERIOR_REGISTERS
! /* Nevertheless, define CANNOT_{FETCH,STORE}_REGISTER, because we might fall
back on the code `infptrace.c' (well a copy of that code in
`i386-linux-nat.c' for now) and we can access only the
general-purpose registers in that way. */
! extern int cannot_fetch_register (int regno);
! extern int cannot_store_register (int regno);
! #define CANNOT_FETCH_REGISTER(regno) cannot_store_register (regno)
! #define CANNOT_STORE_REGISTER(regno) cannot_fetch_register (regno)
/* Override child_resume in `infptrace.c'. */
#define CHILD_RESUME
*** ./i386-linux-nat.c.orig Fri Sep 15 21:27:11 2000
--- ./i386-linux-nat.c Sun Sep 17 12:20:48 2000
***************
*** 133,141 ****
#endif
/* Registers we shouldn't try to fetch. */
! #if !defined (CANNOT_FETCH_REGISTER)
! #define CANNOT_FETCH_REGISTER(regno) 0
! #endif
/* Fetch one register. */
--- 133,139 ----
#endif
/* Registers we shouldn't try to fetch. */
! #define OLD_CANNOT_FETCH_REGISTER(regno) ((regno) >= NUM_GREGS)
/* Fetch one register. */
***************
*** 150,156 ****
char buf[MAX_REGISTER_RAW_SIZE];
int tid;
! if (CANNOT_FETCH_REGISTER (regno))
{
memset (buf, '\0', REGISTER_RAW_SIZE (regno)); /* Supply zeroes */
supply_register (regno, buf);
--- 148,154 ----
char buf[MAX_REGISTER_RAW_SIZE];
int tid;
! if (OLD_CANNOT_FETCH_REGISTER (regno))
{
memset (buf, '\0', REGISTER_RAW_SIZE (regno)); /* Supply zeroes */
supply_register (regno, buf);
***************
*** 201,209 ****
}
/* Registers we shouldn't try to store. */
! #if !defined (CANNOT_STORE_REGISTER)
! #define CANNOT_STORE_REGISTER(regno) 0
! #endif
/* Store one register. */
--- 199,205 ----
}
/* Registers we shouldn't try to store. */
! #define OLD_CANNOT_STORE_REGISTER(regno) ((regno) >= NUM_GREGS)
/* Store one register. */
***************
*** 217,223 ****
unsigned int offset; /* Offset of registers within the u area. */
int tid;
! if (CANNOT_STORE_REGISTER (regno))
{
return;
}
--- 213,219 ----
unsigned int offset; /* Offset of registers within the u area. */
int tid;
! if (OLD_CANNOT_STORE_REGISTER (regno))
{
return;
}
***************
*** 513,518 ****
--- 509,529 ----
/* Transferring arbitrary registers between GDB and inferior. */
+ int
+ cannot_fetch_register (int regno)
+ {
+ if (! have_ptrace_getregs)
+ return OLD_CANNOT_FETCH_REGISTER (regno);
+ return 0;
+ }
+ int
+ cannot_store_register (int regno)
+ {
+ if (! have_ptrace_getregs)
+ return OLD_CANNOT_STORE_REGISTER (regno);
+ return 0;
+ }
+
/* Fetch register REGNO from the child process. If REGNO is -1, do
this for all registers (including the floating point and SSE
registers). */
*** ./rs6000-tdep.c.orig Sat Aug 5 11:37:42 2000
--- ./rs6000-tdep.c Fri Sep 15 21:36:51 2000
***************
*** 671,679 ****
frames, etc.
*************************************************************************/
- extern int stop_stack_dummy;
-
/* Pop the innermost frame, go back to the caller. */
static void
--- 671,677 ----
***************
*** 687,693 ****
pc = read_pc ();
sp = FRAME_FP (frame);
! if (stop_stack_dummy)
{
generic_pop_dummy_frame ();
flush_cached_frames ();
--- 685,691 ----
pc = read_pc ();
sp = FRAME_FP (frame);
! if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
{
generic_pop_dummy_frame ();
flush_cached_frames ();
***************
*** 2140,2145 ****
--- 2138,2144 ----
set_gdbarch_get_saved_register (gdbarch, generic_get_saved_register);
set_gdbarch_fix_call_dummy (gdbarch, rs6000_fix_call_dummy);
set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
+ set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
set_gdbarch_push_return_address (gdbarch, ppc_push_return_address);
set_gdbarch_believe_pcc_promotion (gdbarch, 1);
set_gdbarch_coerce_float_to_double (gdbarch, rs6000_coerce_float_to_double);
*** ./sparc-tdep.c.orig Fri Sep 15 21:27:31 2000
--- ./sparc-tdep.c Fri Sep 15 21:36:51 2000
***************
*** 2138,2148 ****
/* Comply with strange Sun cc calling convention for struct-returning
functions. */
! if (!using_gcc
! && (TYPE_CODE (value_type) == TYPE_CODE_STRUCT
! || TYPE_CODE (value_type) == TYPE_CODE_UNION))
! store_unsigned_integer (dummy + CALL_DUMMY_CALL_OFFSET + 8, 4,
! TYPE_LENGTH (value_type) & 0x1fff);
if (!(GDB_TARGET_IS_SPARC64))
{
--- 2138,2152 ----
/* Comply with strange Sun cc calling convention for struct-returning
functions. */
! if (TYPE_CODE (value_type) == TYPE_CODE_STRUCT
! || TYPE_CODE (value_type) == TYPE_CODE_UNION)
! {
! store_unsigned_integer (dummy + CALL_DUMMY_CALL_OFFSET + 8, 4,
! TYPE_LENGTH (value_type) & 0x1fff);
! set_gdbarch_call_dummy_breakpoint_offset (current_gdbarch, 0x30);
! }
! else
! set_gdbarch_call_dummy_breakpoint_offset (current_gdbarch, 0x2c);
if (!(GDB_TARGET_IS_SPARC64))
{
***************
*** 2961,2971 ****
set_gdbarch_long_long_bit (gdbarch, 8 * TARGET_CHAR_BIT);
set_gdbarch_max_register_raw_size (gdbarch, 8);
set_gdbarch_max_register_virtual_size (gdbarch, 8);
- #ifdef DO_CALL_DUMMY_ON_STACK
- set_gdbarch_pc_in_call_dummy (gdbarch, pc_in_call_dummy_on_stack);
- #else
- set_gdbarch_pc_in_call_dummy (gdbarch, pc_in_call_dummy_at_entry_point);
- #endif
set_gdbarch_pop_frame (gdbarch, sparc_pop_frame);
set_gdbarch_push_return_address (gdbarch, sparc_push_return_address);
set_gdbarch_push_dummy_frame (gdbarch, sparc_push_dummy_frame);
--- 2965,2970 ----
***************
*** 2999,3004 ****
--- 2998,3004 ----
/* 32-bit machine types: */
#ifdef SPARC32_CALL_DUMMY_ON_STACK
+ set_gdbarch_pc_in_call_dummy (gdbarch, pc_in_call_dummy_on_stack);
set_gdbarch_call_dummy_address (gdbarch, sparc_call_dummy_address);
set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0x30);
set_gdbarch_call_dummy_length (gdbarch, 0x38);
***************
*** 3005,3010 ****
--- 3005,3011 ----
set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
set_gdbarch_call_dummy_words (gdbarch, call_dummy_32);
#else
+ set_gdbarch_pc_in_call_dummy (gdbarch, pc_in_call_dummy_at_entry_point);
set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
set_gdbarch_call_dummy_length (gdbarch, 0);
***************
*** 3053,3058 ****
--- 3054,3060 ----
default: /* Any new machine type is likely to be 64-bit. */
#ifdef SPARC64_CALL_DUMMY_ON_STACK
+ set_gdbarch_pc_in_call_dummy (gdbarch, pc_in_call_dummy_on_stack);
set_gdbarch_call_dummy_address (gdbarch, sparc_call_dummy_address);
set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 8 * 4);
set_gdbarch_call_dummy_length (gdbarch, 192);
***************
*** 3060,3065 ****
--- 3062,3068 ----
set_gdbarch_call_dummy_start_offset (gdbarch, 148);
set_gdbarch_call_dummy_words (gdbarch, call_dummy_64);
#else
+ set_gdbarch_pc_in_call_dummy (gdbarch, pc_in_call_dummy_at_entry_point);
set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
set_gdbarch_call_dummy_length (gdbarch, 0);
*** ./stack.c.orig Sat Aug 5 11:37:49 2000
--- ./stack.c Fri Sep 15 21:36:51 2000
***************
*** 1892,1897 ****
--- 1892,1903 ----
if (retval_exp)
set_return_value (return_value);
+ /* If we are at the end of a call dummy now, pop the dummy frame too. */
+
+ if (CALL_DUMMY_HAS_COMPLETED (read_pc(), read_sp (),
+ FRAME_FP (get_current_frame ())))
+ POP_FRAME;
+
/* If interactive, print the frame that is now current. */
if (from_tty)
--
Peter Schauer pes@regent.e-technik.tu-muenchen.de
From kettenis@wins.uva.nl Sun Sep 17 14:09:00 2000
From: Mark Kettenis <kettenis@wins.uva.nl>
To: Peter.Schauer@regent.e-technik.tu-muenchen.de
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: RFD: Testsuite cases for inferior function calls
Date: Sun, 17 Sep 2000 14:09:00 -0000
Message-id: <200009172109.e8HL9YM00808@delius.kettenis.local>
References: <200009171103.NAA24702@reisser.regent.e-technik.tu-muenchen.de>
X-SW-Source: 2000-09/msg00149.html
Content-length: 499
From: "Peter.Schauer" <Peter.Schauer@regent.e-technik.tu-muenchen.de>
Date: Sun, 17 Sep 2000 13:03:19 MET DST
Fernando Nasser wrote:
> Probably because there is no testcase for this... (hint hint hint)
I have spent some time to come up with testsuite cases for this,
and fixing all the GDB bugs that turned up in the targets I have access to
(Solaris sparc, Solaris x86, AIX 4.3, Linux x86).
The Linux/x86 changes look fine to me, so consider those to be
approved :-).
Mark
From kevinb@cygnus.com Sun Sep 17 17:37:00 2000
From: Kevin Buettner <kevinb@cygnus.com>
To: gdb-patches@sourceware.cygnus.com
Subject: Re: [PATCH RFC] Protoize m32r-stub.c, m88k-nat.c, m88k-tdep.c
Date: Sun, 17 Sep 2000 17:37:00 -0000
Message-id: <1000918003730.ZM28153@ocotillo.lan>
References: <1000915073306.ZM4195@ocotillo.lan> <kevinb@cygnus.com>
X-SW-Source: 2000-09/msg00150.html
Content-length: 268
On Sep 15, 12:33am, Kevin Buettner wrote:
> * m32r-stub.c (prepare_to_step): Protoize.
Withdrawn until we decide whether to protoize stubs or not...
> * m88k-nat.c (fetch_inferior_registers): Protoize.
> * m88k-tdep.c (m88k_skip_prologue): Protoize.
Committed.
From kevinb@cygnus.com Sun Sep 17 18:20:00 2000
From: Kevin Buettner <kevinb@cygnus.com>
To: gdb-patches@sourceware.cygnus.com
Subject: [PATCH] Enable new linux thread support for GNU/Linux/PPC gdb
Date: Sun, 17 Sep 2000 18:20:00 -0000
Message-id: <1000918012003.ZM28247@ocotillo.lan>
X-SW-Source: 2000-09/msg00151.html
Content-length: 5300
I've committed the patches below. They enable, for GNU/Linux/PPC, the
new Linux thread support that Mark Kettenis recently contributed. I
also tried to enable thread support for Linux/IA-64 and Linux/ARM, but
had problems with getting the latter to work. (On Linux/IA64, the
simple threads test program didn't even run. I probably need to
upgrade something...)
* ppc-linux-nat.c (fill_gregset, fill_fpregset): New functions.
* config/powerpc/linux.mh (NATDEPFILES): Remove linux-thread.o.
Add proc-service.o, thread-db.o, and lin-lwp.o.
(LOADLIBES): Define.
* config/powerpc/nm-linux.h (ATTACH_DETACH, SVR4_SHARED_LIBS):
Remove defines which are already present in ../nm-linux.h.
(solib.h): Don't include this file; it's already included by
../nm-linux.h.
(PREPARE_TO_PROCEED, GET_THREAD_SIGNALS, ATTACH_LWP): Define
to use the following lin-lwp.c functions...
(lin_lwp_prepare_to_proceed, lin_thread_get_thread_signals,
lin_lwp_attach_lwp): Declare.
Index: ppc-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/ppc-linux-nat.c,v
retrieving revision 1.4
diff -u -p -r1.4 ppc-linux-nat.c
--- ppc-linux-nat.c 2000/07/30 01:48:26 1.4
+++ ppc-linux-nat.c 2000/09/18 00:39:58
@@ -71,11 +71,56 @@ supply_gregset (gregset_t * gregsetp)
}
void
+fill_gregset (gregset_t *gregsetp, int regno)
+{
+ int regi;
+ greg_t *regp = (greg_t *) gregsetp;
+
+#define COPY_REG(_idx_,_regi_) \
+ if ((regno == -1) || regno == _regi_) \
+ memcpy (regp + _idx_, ®isters[REGISTER_BYTE (_regi_)], \
+ REGISTER_RAW_SIZE (_regi_))
+
+ for (regi = 0; regi < 32; regi++)
+ {
+ COPY_REG (regmap[regi], regi);
+ }
+
+ for (regi = FIRST_UISA_SP_REGNUM; regi <= LAST_UISA_SP_REGNUM; regi++)
+ {
+ COPY_REG (regmap[regi], regi);
+ }
+}
+
+void
supply_fpregset (fpregset_t * fpregsetp)
{
int regi;
for (regi = 0; regi < 32; regi++)
{
supply_register (FP0_REGNUM + regi, (char *) (*fpregsetp + regi));
+ }
+}
+
+/* Given a pointer to a floating point register set in /proc format
+ (fpregset_t *), update the register specified by REGNO from gdb's idea
+ of the current floating point register set. If REGNO is -1, update
+ them all. */
+
+void
+fill_fpregset (fpregset_t *fpregsetp, int regno)
+{
+ int regi;
+ char *to;
+ char *from;
+
+ for (regi = 0; regi < 32; regi++)
+ {
+ if ((regno == -1) || (regno == FP0_REGNUM + regi))
+ {
+ from = (char *) ®isters[REGISTER_BYTE (FP0_REGNUM + regi)];
+ to = (char *) (*fpregsetp + regi);
+ memcpy (to, from, REGISTER_RAW_SIZE (FP0_REGNUM + regi));
+ }
}
}
Index: config/powerpc/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/powerpc/linux.mh,v
retrieving revision 1.3
diff -u -p -r1.3 linux.mh
--- config/powerpc/linux.mh 2000/06/12 06:09:05 1.3
+++ config/powerpc/linux.mh 2000/09/18 00:39:58
@@ -5,6 +5,9 @@ XDEPFILES=
XM_CLIBS=
NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o solib.o inftarg.o fork-child.o corelow.o core-aout.o core-regset.o ppc-linux-nat.o linux-thread.o
+NATDEPFILES= infptrace.o solib.o inftarg.o fork-child.o corelow.o \
+core-aout.o core-regset.o ppc-linux-nat.o proc-service.o thread-db.o lin-lwp.o
+
+LOADLIBES = -ldl -rdynamic
GDBSERVER_DEPFILES= low-linux.o
Index: config/powerpc/nm-linux.h
===================================================================
RCS file: /cvs/src/src/gdb/config/powerpc/nm-linux.h,v
retrieving revision 1.3
diff -u -p -r1.3 nm-linux.h
--- config/powerpc/nm-linux.h 2000/05/28 01:12:37 1.3
+++ config/powerpc/nm-linux.h 2000/09/18 00:39:58
@@ -28,9 +28,6 @@ Foundation, Inc., 675 Mass Ave, Cambridg
#define KERNEL_U_SIZE kernel_u_size()
extern int kernel_u_size (void);
-/* Tell gdb that we can attach and detach other processes */
-#define ATTACH_DETACH
-
#define U_REGS_OFFSET 0
#define REGISTER_U_ADDR(addr, blockend, regno) \
@@ -39,26 +36,21 @@ extern int kernel_u_size (void);
/* No <sys/reg.h> */
#define NO_SYS_REG_H
-
-#ifdef HAVE_LINK_H
-#include "solib.h" /* Support for shared libraries. */
-#define SVR4_SHARED_LIBS
-#endif
-
-/* Support for Linuxthreads. */
-#ifdef __STDC__
-struct objfile;
-#endif
+/* FIXME: kettenis/2000-09-03: This should be moved to ../nm-linux.h
+ once we have converted all Linux targets to use the new threads
+ stuff (without the #undef of course). */
-extern void linuxthreads_new_objfile (struct objfile *objfile);
-#define target_new_objfile(OBJFILE) linuxthreads_new_objfile (OBJFILE)
+extern int lin_lwp_prepare_to_proceed (void);
+#undef PREPARE_TO_PROCEED
+#define PREPARE_TO_PROCEED(select_it) lin_lwp_prepare_to_proceed ()
-extern char *linuxthreads_pid_to_str (int pid);
-#define target_pid_to_str(PID) linuxthreads_pid_to_str (PID)
+extern void lin_lwp_attach_lwp (int pid, int verbose);
+#define ATTACH_LWP(pid, verbose) lin_lwp_attach_lwp ((pid), (verbose))
-extern int linuxthreads_prepare_to_proceed (int step);
-#define PREPARE_TO_PROCEED(select_it) linuxthreads_prepare_to_proceed (1)
+#include <signal.h>
+extern void lin_thread_get_thread_signals (sigset_t *mask);
+#define GET_THREAD_SIGNALS(mask) lin_thread_get_thread_signals (mask)
#endif /* #ifndef NM_LINUX_H */
prev parent reply other threads:[~2000-09-15 12:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1000915073306.ZM4195@ocotillo.lan>
2000-09-15 10:50 ` J.T. Conklin
[not found] ` <1000915181249.ZM5172@ocotillo.lan>
[not found] ` <5mwvgdy09h.fsf@jtc.redback.com>
[not found] ` <1000915185022.ZM5331@ocotillo.lan>
2000-09-15 12:07 ` J.T. Conklin [this message]
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=5mitrxxyn5.fsf@jtc.redback.com \
--to=jtc@redback.com \
--cc=gdb-patches@sourceware.cygnus.com \
--cc=kevinb@cygnus.com \
/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