public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/5] hurd: fix gnu_debug_flag type
@ 2020-05-29 20:01 Samuel Thibault
  2020-05-29 20:02 ` [PATCH 2/5] hurd: add missing awk script dependency Samuel Thibault
  2020-05-29 20:44 ` [PATCH 1/5] hurd: fix gnu_debug_flag type Simon Marchi
  0 siblings, 2 replies; 6+ messages in thread
From: Samuel Thibault @ 2020-05-29 20:01 UTC (permalink / raw)
  To: gdb-patches; +Cc: Thomas Schwinge, thomas, bug-hurd

gdb/ChangeLog: 

2020-05-29  Samuel Thibault  <samuel.thibault@ens-lyon.org>

	* gdb/gnu-nat.h (gnu_debug_flag): Set type to bool.

diff --git a/gdb/gnu-nat.h b/gdb/gnu-nat.h
index 77c57817b2..7c36778394 100644
--- a/gdb/gnu-nat.h
+++ b/gdb/gnu-nat.h
@@ -111,7 +111,7 @@ extern char *proc_string (struct proc *proc);
 	      __proc_pid (__proc), __proc->tid, \
 	      host_address_to_string (__proc) , ##args); } while (0)
 
-extern int gnu_debug_flag;
+extern bool gnu_debug_flag;
 
 #define debug(msg, args...) \
  do { if (gnu_debug_flag) \

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

* [PATCH 2/5] hurd: add missing awk script dependency
  2020-05-29 20:01 [PATCH 1/5] hurd: fix gnu_debug_flag type Samuel Thibault
@ 2020-05-29 20:02 ` Samuel Thibault
  2020-05-29 20:04   ` [PATCH 3/5] hurd: make function cast stronger Samuel Thibault
  2020-05-29 20:44 ` [PATCH 1/5] hurd: fix gnu_debug_flag type Simon Marchi
  1 sibling, 1 reply; 6+ messages in thread
From: Samuel Thibault @ 2020-05-29 20:02 UTC (permalink / raw)
  To: gdb-patches; +Cc: Thomas Schwinge, thomas, bug-hurd

gdb/ChangeLog: 

2020-05-29  Samuel Thibault  <samuel.thibault@ens-lyon.org>

	* config/i386/i386gnu.mn (%_reply_S.c): Add dependency on
	$(srcdir)/reply_mig_hack.awk.

diff --git a/gdb/config/i386/i386gnu.mn b/gdb/config/i386/i386gnu.mn
index 1c3453823d..5c81efd007 100644
--- a/gdb/config/i386/i386gnu.mn
+++ b/gdb/config/i386/i386gnu.mn
@@ -7,7 +7,7 @@ MIGCOM = $(MIG) -cc cat - /dev/null
 
 # Reply servers need special massaging of the code mig generates, to make
 # them work correctly for error returns in some cases.
-%_reply_S.h %_reply_S.c: %_reply.defs
+%_reply_S.h %_reply_S.c: %_reply.defs $(srcdir)/reply_mig_hack.awk
 	$(CPP) $(CPPFLAGS) -DSERVERPREFIX=S_ -x c $< \
 	| $(MIGCOM) -sheader $*_reply_S.h -server $*_reply_S.raw -user /dev/null -header /dev/null \
 	&& $(AWK) -f $(srcdir)/reply_mig_hack.awk < $*_reply_S.raw > $*_reply_S.c

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

* [PATCH 3/5] hurd: make function cast stronger
  2020-05-29 20:02 ` [PATCH 2/5] hurd: add missing awk script dependency Samuel Thibault
@ 2020-05-29 20:04   ` Samuel Thibault
  2020-05-29 20:07     ` [PATCH 4/5] hurd: add gnu_target pointer to fix thread API calls Samuel Thibault
  0 siblings, 1 reply; 6+ messages in thread
From: Samuel Thibault @ 2020-05-29 20:04 UTC (permalink / raw)
  To: gdb-patches; +Cc: Thomas Schwinge, thomas, bug-hurd

gdb/ChangeLog: 

2020-05-29  Samuel Thibault  <samuel.thibault@ens-lyon.org>

	* reply_mig_hack.awk (Error return): Cast function through
	void *, to bypass compiler function call check.

diff --git a/gdb/reply_mig_hack.awk b/gdb/reply_mig_hack.awk
index 52ab90bba3..6ff683a841 100644
--- a/gdb/reply_mig_hack.awk
+++ b/gdb/reply_mig_hack.awk
@@ -130,7 +130,8 @@ parse_phase == 5 && /^#if[ \t]TypeCheck/ {
   # two arguments.
   # This is possibly bogus, but easier than supplying bogus values for all
   # the other args (we can't just pass 0 for them, as they might not be scalar).
-  print "\t    OutP->RetCode = (*(kern_return_t (*)(mach_port_t, kern_return_t)) " user_function_name ") (In0P->Head.msgh_request_port, In0P->" arg_name[0] ");";
+  print "\t    void * __error_call = " user_function_name ";";
+  print "\t    OutP->RetCode = (*(kern_return_t (*)(mach_port_t, kern_return_t)) __error_call) (In0P->Head.msgh_request_port, In0P->" arg_name[0] ");";
   print "\t    return;";
   print "\t  }";
   print "";

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

* [PATCH 4/5] hurd: add gnu_target pointer to fix thread API calls
  2020-05-29 20:04   ` [PATCH 3/5] hurd: make function cast stronger Samuel Thibault
@ 2020-05-29 20:07     ` Samuel Thibault
  2020-05-29 20:09       ` [PATCH 5/5] hurd: remove unused variables Samuel Thibault
  0 siblings, 1 reply; 6+ messages in thread
From: Samuel Thibault @ 2020-05-29 20:07 UTC (permalink / raw)
  To: gdb-patches; +Cc: Thomas Schwinge, thomas, bug-hurd

gdb/ChangeLog: 

2020-05-29  Samuel Thibault  <samuel.thibault@ens-lyon.org>

	* gnu-nat.h (gnu_target): New variable declaration.
	* i386-gnu-nat.c (_initialize_i386gnu_nat): Initialize
	gnu_target.
	* gnu-nat.c (gnu_target): New variable.
	(inf_validate_procs): Pass gnu_target to thread_change_ptid,
	add_thread_silent, and add_thread calls.
	(gnu_nat_target::create_inferior): Pass gnu_target to
	add_thread_silent, thread_change_ptid call.
	(gnu_nat_target::detach): Pass gnu_target to detach_inferior
	call.

diff --git a/gdb/gnu-nat.h b/gdb/gnu-nat.h
index 77c57817b2..7c36778394 100644
--- a/gdb/gnu-nat.h
+++ b/gdb/gnu-nat.h
@@ -150,4 +150,7 @@ struct gnu_nat_target : public inf_child_target
   void stop (ptid_t) override;
 };
 
+/* The final/concrete instance.  */
+extern gnu_nat_target *gnu_target;
+
 #endif /* GNU_NAT_H */
diff --git a/gdb/i386-gnu-nat.c b/gdb/i386-gnu-nat.c
index afbe8eff49..6382ca8acb 100644
--- a/gdb/i386-gnu-nat.c
+++ b/gdb/i386-gnu-nat.c
@@ -439,6 +439,8 @@ _initialize_i386gnu_nat ()
   x86_set_debug_register_length (4);
 #endif /* i386_DEBUG_STATE */
 
+  gnu_target = &the_i386_gnu_nat_target;
+
   /* Register the target.  */
   add_inf_child_target (&the_i386_gnu_nat_target);
 }
diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index 3b438a9a43..78e9ab7f71 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -84,6 +85,8 @@ extern "C"
 #include "msg_U.h"
 }
 
+struct gnu_nat_target *gnu_target;
+
 static process_t proc_server = MACH_PORT_NULL;
 
 /* If we've sent a proc_wait_request to the proc server, the pid of the
@@ -1106,12 +1109,12 @@ inf_validate_procs (struct inf *inf)
 	    if (inferior_ptid == ptid_t (inf->pid))
 	      /* This is the first time we're hearing about thread
 		 ids, after a fork-child.  */
-	      thread_change_ptid (inferior_ptid, ptid);
+	      thread_change_ptid (gnu_target, inferior_ptid, ptid);
 	    else if (inf->pending_execs != 0)
 	      /* This is a shell thread.  */
-	      add_thread_silent (ptid);
+	      add_thread_silent (gnu_target, ptid);
 	    else
-	      add_thread (ptid);
+	      add_thread (gnu_target, ptid);
 	  }
       }
 
@@ -2149,7 +2152,7 @@ gnu_nat_target::create_inferior (const char *exec_file,
   /* We have something that executes now.  We'll be running through
      the shell at this point (if startup-with-shell is true), but the
      pid shouldn't change.  */
-  add_thread_silent (ptid_t (pid));
+  add_thread_silent (gnu_target, ptid_t (pid));
 
   /* Attach to the now stopped child, which is actually a shell...  */
   inf_debug (inf, "attaching to child: %d", pid);
@@ -2167,7 +2170,7 @@ gnu_nat_target::create_inferior (const char *exec_file,
   inf_resume (inf);
 
   /* We now have thread info.  */
-  thread_change_ptid (inferior_ptid,
+  thread_change_ptid (gnu_target, inferior_ptid,
 		      ptid_t (inf->pid, inf_pick_first_thread (), 0));
 
   gdb_startup_inferior (pid, START_INFERIOR_TRAPS_EXPECTED);
@@ -2273,7 +2276,7 @@ gnu_nat_target::detach (inferior *inf, int from_tty)
   inf_detach (gnu_current_inf);
 
   inferior_ptid = null_ptid;
-  detach_inferior (find_inferior_pid (pid));
+  detach_inferior (find_inferior_pid (gnu_target, pid));
 
   maybe_unpush_target ();
 }

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

* [PATCH 5/5] hurd: remove unused variables
  2020-05-29 20:07     ` [PATCH 4/5] hurd: add gnu_target pointer to fix thread API calls Samuel Thibault
@ 2020-05-29 20:09       ` Samuel Thibault
  0 siblings, 0 replies; 6+ messages in thread
From: Samuel Thibault @ 2020-05-29 20:09 UTC (permalink / raw)
  To: gdb-patches; +Cc: Thomas Schwinge, thomas, bug-hurd

gdb/ChangeLog: 

2020-05-29  Samuel Thibault  <samuel.thibault@ens-lyon.org>

	* gnu-nat.c (gnu_xfer_auxv): Remove unused `res' variable.
	(gnu_nat_target::find_memory_regions): Remove unused
	`old_address' variable.

diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index 3b438a9a43..78e9ab7f71 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -2551,7 +2554,6 @@ gnu_xfer_auxv (gdb_byte *readbuf, const gdb_byte *writebuf,
 		    ? gnu_current_inf->task->port : 0)
 		 : 0);
   process_t proc;
-  int res;
   kern_return_t err;
   vm_address_t entry;
   ElfW(auxv_t) auxv[2];
@@ -2641,7 +2643,6 @@ gnu_nat_target::find_memory_regions (find_memory_region_ftype func,
       mach_port_t object_name;
       vm_offset_t offset;
       vm_size_t region_length = VM_MAX_ADDRESS - region_address;
-      vm_address_t old_address = region_address;
 
       err = vm_region (task,
 		       &region_address,

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

* Re: [PATCH 1/5] hurd: fix gnu_debug_flag type
  2020-05-29 20:01 [PATCH 1/5] hurd: fix gnu_debug_flag type Samuel Thibault
  2020-05-29 20:02 ` [PATCH 2/5] hurd: add missing awk script dependency Samuel Thibault
@ 2020-05-29 20:44 ` Simon Marchi
  1 sibling, 0 replies; 6+ messages in thread
From: Simon Marchi @ 2020-05-29 20:44 UTC (permalink / raw)
  To: gdb-patches, Thomas Schwinge, thomas, bug-hurd

On 2020-05-29 4:01 p.m., Samuel Thibault wrote:
> gdb/ChangeLog: 
> 
> 2020-05-29  Samuel Thibault  <samuel.thibault@ens-lyon.org>
> 
> 	* gdb/gnu-nat.h (gnu_debug_flag): Set type to bool.
> 
> diff --git a/gdb/gnu-nat.h b/gdb/gnu-nat.h
> index 77c57817b2..7c36778394 100644
> --- a/gdb/gnu-nat.h
> +++ b/gdb/gnu-nat.h
> @@ -111,7 +111,7 @@ extern char *proc_string (struct proc *proc);
>  	      __proc_pid (__proc), __proc->tid, \
>  	      host_address_to_string (__proc) , ##args); } while (0)
>  
> -extern int gnu_debug_flag;
> +extern bool gnu_debug_flag;
>  
>  #define debug(msg, args...) \
>   do { if (gnu_debug_flag) \
> 

Please mention in each patch's message what is the problem you are trying to fix.

Simon

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

end of thread, other threads:[~2020-05-29 20:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-29 20:01 [PATCH 1/5] hurd: fix gnu_debug_flag type Samuel Thibault
2020-05-29 20:02 ` [PATCH 2/5] hurd: add missing awk script dependency Samuel Thibault
2020-05-29 20:04   ` [PATCH 3/5] hurd: make function cast stronger Samuel Thibault
2020-05-29 20:07     ` [PATCH 4/5] hurd: add gnu_target pointer to fix thread API calls Samuel Thibault
2020-05-29 20:09       ` [PATCH 5/5] hurd: remove unused variables Samuel Thibault
2020-05-29 20:44 ` [PATCH 1/5] hurd: fix gnu_debug_flag type Simon Marchi

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).