Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH 0/3] Fix nto, spu and win32 builds of GDBServer.
@ 2015-10-23 16:50 Antoine Tremblay
  2015-10-23 17:02 ` [PATCH 2/3] Fix nto,spu " Antoine Tremblay
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Antoine Tremblay @ 2015-10-23 16:50 UTC (permalink / raw)
  To: gdb-patches

Fix nto, spu and win32 builds of GDBServer.

This patch series fixes the build that was broken by :
https://sourceware.org/ml/gdb-patches/2015-10/msg00369.html

1st patch refactors default_breakpoint_kind to make this easier.

2nd patch fixes nto,spu and win32 builds.

3rd patch is cleaning up the set_breakpoint_data definition.

I tested win32 with mingw but could not test nto and spu, if anyone
can test it's apreciated ?

Thank you,
Antoine


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/3] Fix nto,spu and win32 builds of GDBServer.
  2015-10-23 16:50 [PATCH 0/3] Fix nto, spu and win32 builds of GDBServer Antoine Tremblay
@ 2015-10-23 17:02 ` Antoine Tremblay
  2015-10-23 17:09 ` [PATCH 3/3] Remove set_breakpoint_data definition in GDBServer Antoine Tremblay
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Antoine Tremblay @ 2015-10-23 17:02 UTC (permalink / raw)
  To: gdb-patches; +Cc: Antoine Tremblay

This patch fixes the build that was broken by :
https://sourceware.org/ml/gdb-patches/2015-10/msg00369.html

It implements the sw_breakpoint_from_kind operation on these targets and removes
the calls to set_breakpoint_data.

Compiliation tested on win32.

Not tested : nto, spu.

gdb/gdbserver/ChangeLog:

	* nto-low.c (nto_sw_breakpoint_from_kind): New function.
	(struct target_ops) <sw_breakpoint_from_kind>: Initialize.
	(initialize_low): Remove set_breakpoint_data call.
	* spu-low.c (spu_sw_breakpoint_from_kind): New function.
	(struct target_ops) <sw_breakpoint_from_kind>: Iniitalize.
	(initialize_low): Remove set_breakpoint_data call.
	* win32-low.c (win32_sw_breakpoint_from_kind): New function.
	(struct target_ops) <sw_breakpoint_from_kind>: Initialize.
	(initialize_low): Remove set_breakpoint_data call.
---
 gdb/gdbserver/nto-low.c   | 47 +++++++++++++++++++++++++++++++++++++---
 gdb/gdbserver/spu-low.c   | 55 ++++++++++++++++++++++++++++++++++++++++++++---
 gdb/gdbserver/win32-low.c | 35 ++++++++++++++++++++++++++----
 3 files changed, 127 insertions(+), 10 deletions(-)

diff --git a/gdb/gdbserver/nto-low.c b/gdb/gdbserver/nto-low.c
index 97bd1e9..d72c465 100644
--- a/gdb/gdbserver/nto-low.c
+++ b/gdb/gdbserver/nto-low.c
@@ -921,6 +921,14 @@ nto_supports_non_stop (void)
   return 0;
 }
 
+/* Implementation of the target_ops method "sw_breakpoint_from_kind".  */
+
+static const gdb_byte *
+nto_sw_breakpoint_from_kind (int kind, int *size)
+{
+  *size = the_low_target.breakpoint_len;
+  return the_low_target.breakpoint;
+}
 
 
 static struct target_ops nto_target_ops = {
@@ -961,7 +969,42 @@ static struct target_ops nto_target_ops = {
   NULL, /* xfer_siginfo */
   nto_supports_non_stop,
   NULL, /* async */
-  NULL  /* start_non_stop */
+  NULL, /* start_non_stop */
+  NULL, /* supports_multi_process */
+  NULL, /* supports_fork_events */
+  NULL, /* supports_vfork_events */
+  NULL, /* supports_exec_events */
+  NULL, /* handle_new_gdb_connection */
+  NULL, /* handle_monitor_command */
+  NULL, /* core_of_thread */
+  NULL, /* read_loadmap */
+  NULL, /* process_qsupported */
+  NULL, /* supports_tracepoints */
+  NULL, /* read_pc */
+  NULL, /* write_pc */
+  NULL, /* thread_stopped */
+  NULL, /* get_tib_address */
+  NULL, /* pause_all */
+  NULL, /* unpause_all */
+  NULL, /* stabilize_threads */
+  NULL, /* install_fast_tracepoint_jump_pad */
+  NULL, /* emit_ops */
+  NULL, /* supports_disable_randomization */
+  NULL, /* get_min_fast_tracepoint_insn_len */
+  NULL, /* qxfer_libraries_svr4 */
+  NULL, /* support_agent */
+  NULL, /* support_btrace */
+  NULL, /* enable_btrace */
+  NULL, /* disable_btrace */
+  NULL, /* read_btrace */
+  NULL, /* read_btrace_conf */
+  NULL, /* supports_range_stepping */
+  NULL, /* pid_to_exec_file */
+  NULL, /* multifs_open */
+  NULL, /* multifs_unlink */
+  NULL, /* multifs_readlink */
+  NULL, /* breakpoint_kind_from_pc */
+  nto_sw_breakpoint_from_kind,
 };
 
 
@@ -975,8 +1018,6 @@ initialize_low (void)
 
   TRACE ("%s\n", __func__);
   set_target_ops (&nto_target_ops);
-  set_breakpoint_data (the_low_target.breakpoint,
-		       the_low_target.breakpoint_len);
 
   /* We use SIGUSR1 to gain control after we block waiting for a process.
      We use sigwaitevent to wait.  */
diff --git a/gdb/gdbserver/spu-low.c b/gdb/gdbserver/spu-low.c
index 074417a..89bed7a 100644
--- a/gdb/gdbserver/spu-low.c
+++ b/gdb/gdbserver/spu-low.c
@@ -56,6 +56,9 @@ int using_threads = 0;
 void init_registers_spu (void);
 extern const struct target_desc *tdesc_spu;
 
+/* Software breakpoint instruction.  */
+static const gdb_byte breakpoint[] = { 0x00, 0x00, 0x3f, 0xff };
+
 /* Fetch PPU register REGNO.  */
 static CORE_ADDR
 fetch_ppc_register (int regno)
@@ -639,6 +642,15 @@ spu_request_interrupt (void)
   syscall (SYS_tkill, lwpid_of (thr), SIGINT);
 }
 
+/* Implementation of the target_ops method "sw_breakpoint_from_kind".  */
+
+static const gdb_byte *
+spu_sw_breakpoint_from_kind (int kind, int *size)
+{
+  *size = sizeof breakpoint;
+  return breakpoint;
+}
+
 static struct target_ops spu_target_ops = {
   spu_create_inferior,
   NULL,  /* arch_setup */
@@ -673,14 +685,51 @@ static struct target_ops spu_target_ops = {
   NULL,
   spu_proc_xfer_spu,
   hostio_last_error_from_errno,
+  NULL, /* qxfer_osdata */
+  NULL, /* qxfer_siginfo */
+  NULL, /* supports_non_stop */
+  NULL, /* async */
+  NULL, /* start_non_stop */
+  NULL, /* supports_multi_process */
+  NULL, /* supports_fork_events */
+  NULL, /* supports_vfork_events */
+  NULL, /* supports_exec_events */
+  NULL, /* handle_new_gdb_connection */
+  NULL, /* handle_monitor_command */
+  NULL, /* core_of_thread */
+  NULL, /* read_loadmap */
+  NULL, /* process_qsupported */
+  NULL, /* supports_tracepoints */
+  NULL, /* read_pc */
+  NULL, /* write_pc */
+  NULL, /* thread_stopped */
+  NULL, /* get_tib_address */
+  NULL, /* pause_all */
+  NULL, /* unpause_all */
+  NULL, /* stabilize_threads */
+  NULL, /* install_fast_tracepoint_jump_pad */
+  NULL, /* emit_ops */
+  NULL, /* supports_disable_randomization */
+  NULL, /* get_min_fast_tracepoint_insn_len */
+  NULL, /* qxfer_libraries_svr4 */
+  NULL, /* support_agent */
+  NULL, /* support_btrace */
+  NULL, /* enable_btrace */
+  NULL, /* disable_btrace */
+  NULL, /* read_btrace */
+  NULL, /* read_btrace_conf */
+  NULL, /* supports_range_stepping */
+  NULL, /* pid_to_exec_file */
+  NULL, /* multifs_open */
+  NULL, /* multifs_unlink */
+  NULL, /* multifs_readlink */
+  NULL, /* breakpoint_kind_from_pc */
+  spu_sw_breakpoint_from_kind,
 };
 
 void
 initialize_low (void)
 {
-  static const unsigned char breakpoint[] = { 0x00, 0x00, 0x3f, 0xff };
-
   set_target_ops (&spu_target_ops);
-  set_breakpoint_data (breakpoint, sizeof breakpoint);
   init_registers_spu ();
 }
diff --git a/gdb/gdbserver/win32-low.c b/gdb/gdbserver/win32-low.c
index 550a8e9..6e33509 100644
--- a/gdb/gdbserver/win32-low.c
+++ b/gdb/gdbserver/win32-low.c
@@ -1783,6 +1783,15 @@ win32_get_tib_address (ptid_t ptid, CORE_ADDR *addr)
   return 1;
 }
 
+/* Implementation of the target_ops method "sw_breakpoint_from_kind".  */
+
+static const gdb_byte *
+win32_sw_breakpoint_from_kind (int kind, int *size)
+{
+  *size = the_low_target.breakpoint_len;
+  return the_low_target.breakpoint;
+}
+
 static struct target_ops win32_target_ops = {
   win32_create_inferior,
   NULL,  /* arch_setup */
@@ -1839,7 +1848,28 @@ static struct target_ops win32_target_ops = {
   NULL, /* read_pc */
   NULL, /* write_pc */
   NULL, /* thread_stopped */
-  win32_get_tib_address
+  win32_get_tib_address,
+  NULL, /* pause_all */
+  NULL, /* unpause_all */
+  NULL, /* stabilize_threads */
+  NULL, /* install_fast_tracepoint_jump_pad */
+  NULL, /* emit_ops */
+  NULL, /* supports_disable_randomization */
+  NULL, /* get_min_fast_tracepoint_insn_len */
+  NULL, /* qxfer_libraries_svr4 */
+  NULL, /* support_agent */
+  NULL, /* support_btrace */
+  NULL, /* enable_btrace */
+  NULL, /* disable_btrace */
+  NULL, /* read_btrace */
+  NULL, /* read_btrace_conf */
+  NULL, /* supports_range_stepping */
+  NULL, /* pid_to_exec_file */
+  NULL, /* multifs_open */
+  NULL, /* multifs_unlink */
+  NULL, /* multifs_readlink */
+  NULL, /* breakpoint_kind_from_pc */
+  win32_sw_breakpoint_from_kind,
 };
 
 /* Initialize the Win32 backend.  */
@@ -1847,8 +1877,5 @@ void
 initialize_low (void)
 {
   set_target_ops (&win32_target_ops);
-  if (the_low_target.breakpoint != NULL)
-    set_breakpoint_data (the_low_target.breakpoint,
-			 the_low_target.breakpoint_len);
   the_low_target.arch_setup ();
 }
-- 
1.9.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 3/3] Remove set_breakpoint_data definition in GDBServer.
  2015-10-23 16:50 [PATCH 0/3] Fix nto, spu and win32 builds of GDBServer Antoine Tremblay
  2015-10-23 17:02 ` [PATCH 2/3] Fix nto,spu " Antoine Tremblay
@ 2015-10-23 17:09 ` Antoine Tremblay
  2015-10-23 17:23 ` [PATCH 1/3] Refactor default_breakpoint_kind_from_pc to be used by all targets " Antoine Tremblay
  2015-10-23 23:56 ` [PATCH 0/3] Fix nto, spu and win32 builds of GDBServer Pedro Alves
  3 siblings, 0 replies; 8+ messages in thread
From: Antoine Tremblay @ 2015-10-23 17:09 UTC (permalink / raw)
  To: gdb-patches; +Cc: Antoine Tremblay

This patch removes the now unused set_breakpoint_data function from mem_break.h

gdb/gdbserver/ChangeLog:

	* mem-break.h (set_breakpoint_data): Remove.
---
 gdb/gdbserver/mem-break.h | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/gdb/gdbserver/mem-break.h b/gdb/gdbserver/mem-break.h
index fa9d300..d199cc4 100644
--- a/gdb/gdbserver/mem-break.h
+++ b/gdb/gdbserver/mem-break.h
@@ -194,11 +194,6 @@ void check_mem_read (CORE_ADDR mem_addr, unsigned char *buf, int mem_len);
 void check_mem_write (CORE_ADDR mem_addr,
 		      unsigned char *buf, const unsigned char *myaddr, int mem_len);
 
-/* Set the byte pattern to insert for memory breakpoints.  This function
-   must be called before any breakpoints are set.  */
-
-void set_breakpoint_data (const unsigned char *bp_data, int bp_len);
-
 /* Delete all breakpoints.  */
 
 void delete_all_breakpoints (void);
-- 
1.9.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/3] Refactor default_breakpoint_kind_from_pc to be used by all targets in GDBServer.
  2015-10-23 16:50 [PATCH 0/3] Fix nto, spu and win32 builds of GDBServer Antoine Tremblay
  2015-10-23 17:02 ` [PATCH 2/3] Fix nto,spu " Antoine Tremblay
  2015-10-23 17:09 ` [PATCH 3/3] Remove set_breakpoint_data definition in GDBServer Antoine Tremblay
@ 2015-10-23 17:23 ` Antoine Tremblay
  2015-10-23 23:56 ` [PATCH 0/3] Fix nto, spu and win32 builds of GDBServer Pedro Alves
  3 siblings, 0 replies; 8+ messages in thread
From: Antoine Tremblay @ 2015-10-23 17:23 UTC (permalink / raw)
  To: gdb-patches; +Cc: Antoine Tremblay

This patch moves default_breakpoint_kind_from_pc to target.c and creates a macro
so that all targets can easily use it.

This allows the breakpoint_kind_from_pc operation to be left unimplemented in
targets that do not need it.

This is preparation to fix the win32/nto/spu build that was broken by this
patch: https://sourceware.org/ml/gdb-patches/2015-10/msg00369.html

No regression on Ubuntu 14.04 x86-64 with gdbserver-{native-extended}

gdb/gdbserver/ChangeLog:

	* linux-low.c (default_breakpoint_kind_from_pc): Move to target.c.
	* mem-break.c (set_breakpoint_at): Use target_breakpoint_kind_from_pc.
	* target.c (default_breakpoint_kind_from_pc): Moved from linux-low.c
	* target.h (target_breakpoint_kind_from_pc): New macro.
---
 gdb/gdbserver/linux-low.c | 13 -------------
 gdb/gdbserver/mem-break.c |  2 +-
 gdb/gdbserver/target.c    | 16 ++++++++++++++++
 gdb/gdbserver/target.h    |  7 +++++++
 4 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index ac8fae3..0c552b8 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -6937,19 +6937,6 @@ current_lwp_ptid (void)
   return ptid_of (current_thread);
 }
 
-/* Return the default breakpoint kind as the size of the breakpoint.  */
-
-static int
-default_breakpoint_kind_from_pc (CORE_ADDR *pcptr)
-{
-  int size = 0;
-
-  gdb_assert (the_low_target.sw_breakpoint_from_kind != NULL);
-
-  (*the_low_target.sw_breakpoint_from_kind) (0, &size);
-  return size;
-}
-
 /* Implementation of the target_ops method "breakpoint_kind_from_pc".  */
 
 static int
diff --git a/gdb/gdbserver/mem-break.c b/gdb/gdbserver/mem-break.c
index a676ea2..656402a 100644
--- a/gdb/gdbserver/mem-break.c
+++ b/gdb/gdbserver/mem-break.c
@@ -784,7 +784,7 @@ set_breakpoint_at (CORE_ADDR where, int (*handler) (CORE_ADDR))
 {
   int err_ignored;
   CORE_ADDR placed_address = where;
-  int breakpoint_kind = the_target->breakpoint_kind_from_pc (&placed_address);
+  int breakpoint_kind = target_breakpoint_kind_from_pc (&placed_address);
 
   return set_breakpoint (other_breakpoint, raw_bkpt_type_sw,
 			 placed_address, breakpoint_kind, handler,
diff --git a/gdb/gdbserver/target.c b/gdb/gdbserver/target.c
index 301f90e..80512d86 100644
--- a/gdb/gdbserver/target.c
+++ b/gdb/gdbserver/target.c
@@ -224,3 +224,19 @@ target_can_do_hardware_single_step (void)
 {
   return 1;
 }
+
+/* Default implementation for breakpoint_kind_for_pc.
+
+   The default behavior for targets that don't implement breakpoint_kind_for_pc
+   is to use the size of a breakpoint as the kind.  */
+
+int
+default_breakpoint_kind_from_pc (CORE_ADDR *pcptr)
+{
+  int size = 0;
+
+  gdb_assert (the_target->sw_breakpoint_from_kind != NULL);
+
+  (*the_target->sw_breakpoint_from_kind) (0, &size);
+  return size;
+}
diff --git a/gdb/gdbserver/target.h b/gdb/gdbserver/target.h
index e4c0639..a14c6ff 100644
--- a/gdb/gdbserver/target.h
+++ b/gdb/gdbserver/target.h
@@ -633,6 +633,11 @@ int kill_inferior (int);
   (the_target->stopped_by_hw_breakpoint ? \
    (*the_target->stopped_by_hw_breakpoint) () : 0)
 
+#define target_breakpoint_kind_from_pc(pcptr) \
+  (the_target->breakpoint_kind_from_pc \
+   ? (*the_target->breakpoint_kind_from_pc) (pcptr) \
+   : default_breakpoint_kind_from_pc (pcptr))
+
 /* Start non-stop mode, returns 0 on success, -1 on failure.   */
 
 int start_non_stop (int nonstop);
@@ -667,4 +672,6 @@ const char *target_pid_to_str (ptid_t);
 
 int target_can_do_hardware_single_step (void);
 
+int default_breakpoint_kind_from_pc (CORE_ADDR *pcptr);
+
 #endif /* TARGET_H */
-- 
1.9.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/3] Fix nto, spu and win32 builds of GDBServer.
  2015-10-23 16:50 [PATCH 0/3] Fix nto, spu and win32 builds of GDBServer Antoine Tremblay
                   ` (2 preceding siblings ...)
  2015-10-23 17:23 ` [PATCH 1/3] Refactor default_breakpoint_kind_from_pc to be used by all targets " Antoine Tremblay
@ 2015-10-23 23:56 ` Pedro Alves
  2015-10-25  2:31   ` Antoine Tremblay
  3 siblings, 1 reply; 8+ messages in thread
From: Pedro Alves @ 2015-10-23 23:56 UTC (permalink / raw)
  To: Antoine Tremblay, gdb-patches

On 10/22/2015 08:58 PM, Antoine Tremblay wrote:
> Fix nto, spu and win32 builds of GDBServer.
> 
> This patch series fixes the build that was broken by :
> https://sourceware.org/ml/gdb-patches/2015-10/msg00369.html
> 
> 1st patch refactors default_breakpoint_kind to make this easier.
> 
> 2nd patch fixes nto,spu and win32 builds.
> 
> 3rd patch is cleaning up the set_breakpoint_data definition.

This all looks good to me.

> I tested win32 with mingw but could not test nto and spu, if anyone
> can test it's apreciated ?

I think it doesn't hurt to put it in immediately.  Even if extra tweaking
is necessary for those targets, it won't be worse than the current state.

Thanks,
Pedro Alves


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/3] Fix nto, spu and win32 builds of GDBServer.
  2015-10-23 23:56 ` [PATCH 0/3] Fix nto, spu and win32 builds of GDBServer Pedro Alves
@ 2015-10-25  2:31   ` Antoine Tremblay
  2015-10-25 11:08     ` Aleksandar Ristovski
  0 siblings, 1 reply; 8+ messages in thread
From: Antoine Tremblay @ 2015-10-25  2:31 UTC (permalink / raw)
  To: Pedro Alves, gdb-patches



On 10/23/2015 11:05 AM, Pedro Alves wrote:
> On 10/22/2015 08:58 PM, Antoine Tremblay wrote:
>> Fix nto, spu and win32 builds of GDBServer.
>>
>> This patch series fixes the build that was broken by :
>> https://sourceware.org/ml/gdb-patches/2015-10/msg00369.html
>>
>> 1st patch refactors default_breakpoint_kind to make this easier.
>>
>> 2nd patch fixes nto,spu and win32 builds.
>>
>> 3rd patch is cleaning up the set_breakpoint_data definition.
>
> This all looks good to me.
>
>> I tested win32 with mingw but could not test nto and spu, if anyone
>> can test it's apreciated ?
>
> I think it doesn't hurt to put it in immediately.  Even if extra tweaking
> is necessary for those targets, it won't be worse than the current state.
>

OK pushed.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/3] Fix nto, spu and win32 builds of GDBServer.
  2015-10-25 11:08     ` Aleksandar Ristovski
@ 2015-10-25  2:42       ` Aleksandar Ristovski
  0 siblings, 0 replies; 8+ messages in thread
From: Aleksandar Ristovski @ 2015-10-25  2:42 UTC (permalink / raw)
  To: Antoine Tremblay, Pedro Alves, gdb-patches

On 15-10-23 01:23 PM, Antoine Tremblay wrote:
> 2nd patch fixes nto,spu and win32 builds.

nto: I was going to submit the removal of set_breakpoint_data call, but
you beat me to it.

Build for nto gdbserver is fixed, thank you.

---
Aleksandar Ristovski


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/3] Fix nto, spu and win32 builds of GDBServer.
  2015-10-25  2:31   ` Antoine Tremblay
@ 2015-10-25 11:08     ` Aleksandar Ristovski
  2015-10-25  2:42       ` Aleksandar Ristovski
  0 siblings, 1 reply; 8+ messages in thread
From: Aleksandar Ristovski @ 2015-10-25 11:08 UTC (permalink / raw)
  To: gdb-patches

On 15-10-23 01:23 PM, Antoine Tremblay wrote:
> 2nd patch fixes nto,spu and win32 builds.

nto: I was going to submit the removal of set_breakpoint_data call, but
you beat me to it.

Build for nto gdbserver is fixed, thank you.

---
Aleksandar Ristovski


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-10-23 19:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-23 16:50 [PATCH 0/3] Fix nto, spu and win32 builds of GDBServer Antoine Tremblay
2015-10-23 17:02 ` [PATCH 2/3] Fix nto,spu " Antoine Tremblay
2015-10-23 17:09 ` [PATCH 3/3] Remove set_breakpoint_data definition in GDBServer Antoine Tremblay
2015-10-23 17:23 ` [PATCH 1/3] Refactor default_breakpoint_kind_from_pc to be used by all targets " Antoine Tremblay
2015-10-23 23:56 ` [PATCH 0/3] Fix nto, spu and win32 builds of GDBServer Pedro Alves
2015-10-25  2:31   ` Antoine Tremblay
2015-10-25 11:08     ` Aleksandar Ristovski
2015-10-25  2:42       ` Aleksandar Ristovski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox