public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Rename the 'obfd' argument to fbsd_nat_target::find_memory_regions.
@ 2020-07-07 17:53 John Baldwin
  2020-07-07 18:16 ` John Baldwin
  2020-07-08 10:49 ` Andrew Burgess
  0 siblings, 2 replies; 5+ messages in thread
From: John Baldwin @ 2020-07-07 17:53 UTC (permalink / raw)
  To: gdb-patches

The argument is passed as a generic cookie value to the supplied
callback and is not necessarily a pointer to a bfd.

gdb/ChangeLog:

	* fbsd-nat.c (fbsd_nat_target::find_memory_regions): Rename 'obfd'
	argument to 'data'.
---
 gdb/ChangeLog  |  5 +++++
 gdb/fbsd-nat.c | 10 +++++-----
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c86d7e4647..93886d761a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2020-07-07  John Baldwin  <jhb@FreeBSD.org>
+
+	* fbsd-nat.c (fbsd_nat_target::find_memory_regions): Rename 'obfd'
+	argument to 'data'.
+
 2020-07-06  Andrew Burgess  <andrew.burgess@embecosm.com>
 
 	PR python/22748
diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
index 1d189a2501..2c59080c13 100644
--- a/gdb/fbsd-nat.c
+++ b/gdb/fbsd-nat.c
@@ -86,12 +86,12 @@ fbsd_nat_target::pid_to_exec_file (int pid)
 
 #ifdef HAVE_KINFO_GETVMMAP
 /* Iterate over all the memory regions in the current inferior,
-   calling FUNC for each memory region.  OBFD is passed as the last
+   calling FUNC for each memory region.  DATA is passed as the last
    argument to FUNC.  */
 
 int
 fbsd_nat_target::find_memory_regions (find_memory_region_ftype func,
-				      void *obfd)
+				      void *data)
 {
   pid_t pid = inferior_ptid.pid ();
   struct kinfo_vmentry *kve;
@@ -133,7 +133,7 @@ fbsd_nat_target::find_memory_regions (find_memory_region_ftype func,
 	 Pass MODIFIED as true, we do not know the real modification state.  */
       func (kve->kve_start, size, kve->kve_protection & KVME_PROT_READ,
 	    kve->kve_protection & KVME_PROT_WRITE,
-	    kve->kve_protection & KVME_PROT_EXEC, 1, obfd);
+	    kve->kve_protection & KVME_PROT_EXEC, 1, data);
     }
   return 0;
 }
@@ -160,12 +160,12 @@ fbsd_read_mapping (FILE *mapfile, unsigned long *start, unsigned long *end,
 }
 
 /* Iterate over all the memory regions in the current inferior,
-   calling FUNC for each memory region.  OBFD is passed as the last
+   calling FUNC for each memory region.  DATA is passed as the last
    argument to FUNC.  */
 
 int
 fbsd_nat_target::find_memory_regions (find_memory_region_ftype func,
-				      void *obfd)
+				      void *data)
 {
   pid_t pid = inferior_ptid.pid ();
   unsigned long start, end, size;
-- 
2.25.1


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

* Re: [PATCH] Rename the 'obfd' argument to fbsd_nat_target::find_memory_regions.
  2020-07-07 17:53 [PATCH] Rename the 'obfd' argument to fbsd_nat_target::find_memory_regions John Baldwin
@ 2020-07-07 18:16 ` John Baldwin
  2020-07-08  8:12   ` Gary Benson
  2020-07-08 10:49 ` Andrew Burgess
  1 sibling, 1 reply; 5+ messages in thread
From: John Baldwin @ 2020-07-07 18:16 UTC (permalink / raw)
  To: gdb-patches

On 7/7/20 10:53 AM, John Baldwin wrote:
> The argument is passed as a generic cookie value to the supplied
> callback and is not necessarily a pointer to a bfd.
> 
> gdb/ChangeLog:
> 
> 	* fbsd-nat.c (fbsd_nat_target::find_memory_regions): Rename 'obfd'
> 	argument to 'data'.

This cleanup is something Tom Tromey requested when reviewing Kamil's patches
to add similar functionality to the NetBSD native target.

-- 
John Baldwin

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

* Re: [PATCH] Rename the 'obfd' argument to fbsd_nat_target::find_memory_regions.
  2020-07-07 18:16 ` John Baldwin
@ 2020-07-08  8:12   ` Gary Benson
  0 siblings, 0 replies; 5+ messages in thread
From: Gary Benson @ 2020-07-08  8:12 UTC (permalink / raw)
  To: John Baldwin; +Cc: gdb-patches

John Baldwin wrote:
> On 7/7/20 10:53 AM, John Baldwin wrote:

> > The argument is passed as a generic cookie value to the supplied
> > callback and is not necessarily a pointer to a bfd.
> > 
> > gdb/ChangeLog:
> > 
> > 	* fbsd-nat.c (fbsd_nat_target::find_memory_regions): Rename 'obfd'
> > 	argument to 'data'.
> 
> This cleanup is something Tom Tromey requested when reviewing
> Kamil's patches to add similar functionality to the NetBSD native
> target.

A useful cleanup.  John, your patch looks good to me.
I can't approve a commit, but I would if I could :)
Thank you for doing the work!

Cheers,
Gary

-- 
Gary Benson - he / him / his
Principal Software Engineer, Red Hat


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

* Re: [PATCH] Rename the 'obfd' argument to fbsd_nat_target::find_memory_regions.
  2020-07-07 17:53 [PATCH] Rename the 'obfd' argument to fbsd_nat_target::find_memory_regions John Baldwin
  2020-07-07 18:16 ` John Baldwin
@ 2020-07-08 10:49 ` Andrew Burgess
  2020-07-08 15:56   ` John Baldwin
  1 sibling, 1 reply; 5+ messages in thread
From: Andrew Burgess @ 2020-07-08 10:49 UTC (permalink / raw)
  To: John Baldwin; +Cc: gdb-patches

* John Baldwin <jhb@FreeBSD.org> [2020-07-07 10:53:38 -0700]:

> The argument is passed as a generic cookie value to the supplied
> callback and is not necessarily a pointer to a bfd.
> 
> gdb/ChangeLog:
> 
> 	* fbsd-nat.c (fbsd_nat_target::find_memory_regions): Rename 'obfd'
> 	argument to 'data'.
> ---
>  gdb/ChangeLog  |  5 +++++
>  gdb/fbsd-nat.c | 10 +++++-----
>  2 files changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/gdb/ChangeLog b/gdb/ChangeLog
> index c86d7e4647..93886d761a 100644
> --- a/gdb/ChangeLog
> +++ b/gdb/ChangeLog
> @@ -1,3 +1,8 @@
> +2020-07-07  John Baldwin  <jhb@FreeBSD.org>
> +
> +	* fbsd-nat.c (fbsd_nat_target::find_memory_regions): Rename 'obfd'
> +	argument to 'data'.
> +
>  2020-07-06  Andrew Burgess  <andrew.burgess@embecosm.com>
>  
>  	PR python/22748
> diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
> index 1d189a2501..2c59080c13 100644
> --- a/gdb/fbsd-nat.c
> +++ b/gdb/fbsd-nat.c
> @@ -86,12 +86,12 @@ fbsd_nat_target::pid_to_exec_file (int pid)
>  
>  #ifdef HAVE_KINFO_GETVMMAP
>  /* Iterate over all the memory regions in the current inferior,
> -   calling FUNC for each memory region.  OBFD is passed as the last
> +   calling FUNC for each memory region.  DATA is passed as the last
>     argument to FUNC.  */
>  
>  int
>  fbsd_nat_target::find_memory_regions (find_memory_region_ftype func,
> -				      void *obfd)
> +				      void *data)
>  {
>    pid_t pid = inferior_ptid.pid ();
>    struct kinfo_vmentry *kve;
> @@ -133,7 +133,7 @@ fbsd_nat_target::find_memory_regions (find_memory_region_ftype func,
>  	 Pass MODIFIED as true, we do not know the real modification state.  */
>        func (kve->kve_start, size, kve->kve_protection & KVME_PROT_READ,
>  	    kve->kve_protection & KVME_PROT_WRITE,
> -	    kve->kve_protection & KVME_PROT_EXEC, 1, obfd);
> +	    kve->kve_protection & KVME_PROT_EXEC, 1, data);
>      }
>    return 0;
>  }
> @@ -160,12 +160,12 @@ fbsd_read_mapping (FILE *mapfile, unsigned long *start, unsigned long *end,
>  }
>  
>  /* Iterate over all the memory regions in the current inferior,
> -   calling FUNC for each memory region.  OBFD is passed as the last
> +   calling FUNC for each memory region.  DATA is passed as the last
>     argument to FUNC.  */
>  
>  int
>  fbsd_nat_target::find_memory_regions (find_memory_region_ftype func,
> -				      void *obfd)
> +				      void *data)
>  {
>    pid_t pid = inferior_ptid.pid ();
>    unsigned long start, end, size;

This version of the function is only conditionally compiled, and I
suspect was untested as you changed the parameter name, but later in
the function the usage was not updated.

With that fixed this is approved.

Thanks,
Andrew


> -- 
> 2.25.1
> 

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

* Re: [PATCH] Rename the 'obfd' argument to fbsd_nat_target::find_memory_regions.
  2020-07-08 10:49 ` Andrew Burgess
@ 2020-07-08 15:56   ` John Baldwin
  0 siblings, 0 replies; 5+ messages in thread
From: John Baldwin @ 2020-07-08 15:56 UTC (permalink / raw)
  To: Andrew Burgess; +Cc: gdb-patches

On 7/8/20 3:49 AM, Andrew Burgess wrote:
> * John Baldwin <jhb@FreeBSD.org> [2020-07-07 10:53:38 -0700]:
> 
>> The argument is passed as a generic cookie value to the supplied
>> callback and is not necessarily a pointer to a bfd.
>>
>> gdb/ChangeLog:
>>
>> 	* fbsd-nat.c (fbsd_nat_target::find_memory_regions): Rename 'obfd'
>> 	argument to 'data'.
>> ---
>>  gdb/ChangeLog  |  5 +++++
>>  gdb/fbsd-nat.c | 10 +++++-----
>>  2 files changed, 10 insertions(+), 5 deletions(-)
>>
>> diff --git a/gdb/ChangeLog b/gdb/ChangeLog
>> index c86d7e4647..93886d761a 100644
>> --- a/gdb/ChangeLog
>> +++ b/gdb/ChangeLog
>> @@ -1,3 +1,8 @@
>> +2020-07-07  John Baldwin  <jhb@FreeBSD.org>
>> +
>> +	* fbsd-nat.c (fbsd_nat_target::find_memory_regions): Rename 'obfd'
>> +	argument to 'data'.
>> +
>>  2020-07-06  Andrew Burgess  <andrew.burgess@embecosm.com>
>>  
>>  	PR python/22748
>> diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
>> index 1d189a2501..2c59080c13 100644
>> --- a/gdb/fbsd-nat.c
>> +++ b/gdb/fbsd-nat.c
>> @@ -86,12 +86,12 @@ fbsd_nat_target::pid_to_exec_file (int pid)
>>  
>>  #ifdef HAVE_KINFO_GETVMMAP
>>  /* Iterate over all the memory regions in the current inferior,
>> -   calling FUNC for each memory region.  OBFD is passed as the last
>> +   calling FUNC for each memory region.  DATA is passed as the last
>>     argument to FUNC.  */
>>  
>>  int
>>  fbsd_nat_target::find_memory_regions (find_memory_region_ftype func,
>> -				      void *obfd)
>> +				      void *data)
>>  {
>>    pid_t pid = inferior_ptid.pid ();
>>    struct kinfo_vmentry *kve;
>> @@ -133,7 +133,7 @@ fbsd_nat_target::find_memory_regions (find_memory_region_ftype func,
>>  	 Pass MODIFIED as true, we do not know the real modification state.  */
>>        func (kve->kve_start, size, kve->kve_protection & KVME_PROT_READ,
>>  	    kve->kve_protection & KVME_PROT_WRITE,
>> -	    kve->kve_protection & KVME_PROT_EXEC, 1, obfd);
>> +	    kve->kve_protection & KVME_PROT_EXEC, 1, data);
>>      }
>>    return 0;
>>  }
>> @@ -160,12 +160,12 @@ fbsd_read_mapping (FILE *mapfile, unsigned long *start, unsigned long *end,
>>  }
>>  
>>  /* Iterate over all the memory regions in the current inferior,
>> -   calling FUNC for each memory region.  OBFD is passed as the last
>> +   calling FUNC for each memory region.  DATA is passed as the last
>>     argument to FUNC.  */
>>  
>>  int
>>  fbsd_nat_target::find_memory_regions (find_memory_region_ftype func,
>> -				      void *obfd)
>> +				      void *data)
>>  {
>>    pid_t pid = inferior_ptid.pid ();
>>    unsigned long start, end, size;
> 
> This version of the function is only conditionally compiled, and I
> suspect was untested as you changed the parameter name, but later in
> the function the usage was not updated.

Oh dear, yes.  I will fix.  I should also really GC some of this older
code from the FreeBSD target.  Only ancient versions use some of this
stuff (10+ year old releases that don't have a viable C++11 compiler
for example).

-- 
John Baldwin

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

end of thread, other threads:[~2020-07-08 15:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-07 17:53 [PATCH] Rename the 'obfd' argument to fbsd_nat_target::find_memory_regions John Baldwin
2020-07-07 18:16 ` John Baldwin
2020-07-08  8:12   ` Gary Benson
2020-07-08 10:49 ` Andrew Burgess
2020-07-08 15:56   ` John Baldwin

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