public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Add declarations to gdbtk.h
@ 2019-10-07 21:09 Christian Biesinger via insight
  2019-10-07 22:40 ` Mike Wellington
  2019-10-10  0:20 ` Keith Seitz
  0 siblings, 2 replies; 8+ messages in thread
From: Christian Biesinger via insight @ 2019-10-07 21:09 UTC (permalink / raw)
  To: insight; +Cc: Christian Biesinger

From: Christian Biesinger <cbiesinger@chromium.org>

Currently, gdb/main.c has to declare these two variables in the
.c file. This patch adds the declarations to the header so that
gdb can just use them.

gdbtk/ChangeLog:

2019-10-07  Christian Biesinger  <cbiesinger@chromium.org>

	* generic/gdbtk.h (gdbtk_test): Declare.
  (external_editor_command): Declare.
  (file): Prefix Tcl_Interp with "struct"
  so that this compiles when Tcl headers aren't included.
  * generic/gdbtk-interp.h:  Likewise.
---
 gdbtk/generic/gdbtk-interp.h |  2 +-
 gdbtk/generic/gdbtk.h        | 11 +++++++++--
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/gdbtk/generic/gdbtk-interp.h b/gdbtk/generic/gdbtk-interp.h
index 3126b91..9abad2e 100644
--- a/gdbtk/generic/gdbtk-interp.h
+++ b/gdbtk/generic/gdbtk-interp.h
@@ -53,7 +53,7 @@ public:
   ui_file *_stdtargin;
   ui_out *uiout;
 
-  Tcl_Interp *tcl;
+  struct Tcl_Interp *tcl;
 };
 
 extern gdbtk_interp *gdbtk_get_interp (void);
diff --git a/gdbtk/generic/gdbtk.h b/gdbtk/generic/gdbtk.h
index 7bb1f79..89ab8bf 100644
--- a/gdbtk/generic/gdbtk.h
+++ b/gdbtk/generic/gdbtk.h
@@ -77,6 +77,12 @@ extern int running_now;
 
 extern long gdbtk_pid;
 
+/*
+ * This variable controls the interaction with an external editor.
+ */
+
+extern char *external_editor_command;
+
 /* These two control how the GUI behaves when tracing or loading
    They are defined in gdbtk-cmds.c */
 
@@ -91,7 +97,7 @@ extern int load_in_progress;
 
 typedef struct gdbtk_result
   {
-    Tcl_Obj *obj_ptr;		/* This will eventually be copied over to the
+    struct Tcl_Obj *obj_ptr;		/* This will eventually be copied over to the
 				   Tcl result */
     int flags;			/* Flag vector to control how the result is
 				   used. */
@@ -151,7 +157,7 @@ extern int gdbtk_force_detach;
  *
  */
 
-extern int Gdbtk_Init (Tcl_Interp * interp);
+extern int Gdbtk_Init (struct Tcl_Interp * interp);
 extern void gdbtk_stop_timer (void);
 extern void gdbtk_start_timer (void);
 extern long gdbtk_getpid(void);
@@ -159,6 +165,7 @@ extern void gdbtk_ignorable_warning (const char *, const char *);
 extern int x_event (int);
 extern int gdbtk_two_elem_cmd (char *, const char *);
 extern int target_is_native (struct target_ops *t);
+extern int gdbtk_test (char *);
 extern struct ui_file *gdbtk_fileopen (void);
 extern bool gdbtk_disable_write;
 extern ptid_t gdbtk_get_ptid (void);
-- 
2.23.0.581.g78d2f28ef7-goog

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

* Re: [PATCH] Add declarations to gdbtk.h
  2019-10-07 21:09 [PATCH] Add declarations to gdbtk.h Christian Biesinger via insight
@ 2019-10-07 22:40 ` Mike Wellington
  2019-10-07 22:43   ` Christian Biesinger via insight
  2019-10-10  0:20 ` Keith Seitz
  1 sibling, 1 reply; 8+ messages in thread
From: Mike Wellington @ 2019-10-07 22:40 UTC (permalink / raw)
  To: Christian Biesinger; +Cc: insight, Christian Biesinger

So what's the problem?

On Mon, Oct 7, 2019, 15:09 Christian Biesinger via insight <
insight@sourceware.org> wrote:

> From: Christian Biesinger <cbiesinger@chromium.org>
>
> Currently, gdb/main.c has to declare these two variables in the
> .c file. This patch adds the declarations to the header so that
> gdb can just use them.
>
> gdbtk/ChangeLog:
>
> 2019-10-07  Christian Biesinger  <cbiesinger@chromium.org>
>
>         * generic/gdbtk.h (gdbtk_test): Declare.
>   (external_editor_command): Declare.
>   (file): Prefix Tcl_Interp with "struct"
>   so that this compiles when Tcl headers aren't included.
>   * generic/gdbtk-interp.h:  Likewise.
> ---
>  gdbtk/generic/gdbtk-interp.h |  2 +-
>  gdbtk/generic/gdbtk.h        | 11 +++++++++--
>  2 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/gdbtk/generic/gdbtk-interp.h b/gdbtk/generic/gdbtk-interp.h
> index 3126b91..9abad2e 100644
> --- a/gdbtk/generic/gdbtk-interp.h
> +++ b/gdbtk/generic/gdbtk-interp.h
> @@ -53,7 +53,7 @@ public:
>    ui_file *_stdtargin;
>    ui_out *uiout;
>
> -  Tcl_Interp *tcl;
> +  struct Tcl_Interp *tcl;
>  };
>
>  extern gdbtk_interp *gdbtk_get_interp (void);
> diff --git a/gdbtk/generic/gdbtk.h b/gdbtk/generic/gdbtk.h
> index 7bb1f79..89ab8bf 100644
> --- a/gdbtk/generic/gdbtk.h
> +++ b/gdbtk/generic/gdbtk.h
> @@ -77,6 +77,12 @@ extern int running_now;
>
>  extern long gdbtk_pid;
>
> +/*
> + * This variable controls the interaction with an external editor.
> + */
> +
> +extern char *external_editor_command;
> +
>  /* These two control how the GUI behaves when tracing or loading
>     They are defined in gdbtk-cmds.c */
>
> @@ -91,7 +97,7 @@ extern int load_in_progress;
>
>  typedef struct gdbtk_result
>    {
> -    Tcl_Obj *obj_ptr;          /* This will eventually be copied over to
> the
> +    struct Tcl_Obj *obj_ptr;           /* This will eventually be copied
> over to the
>                                    Tcl result */
>      int flags;                 /* Flag vector to control how the result is
>                                    used. */
> @@ -151,7 +157,7 @@ extern int gdbtk_force_detach;
>   *
>   */
>
> -extern int Gdbtk_Init (Tcl_Interp * interp);
> +extern int Gdbtk_Init (struct Tcl_Interp * interp);
>  extern void gdbtk_stop_timer (void);
>  extern void gdbtk_start_timer (void);
>  extern long gdbtk_getpid(void);
> @@ -159,6 +165,7 @@ extern void gdbtk_ignorable_warning (const char *,
> const char *);
>  extern int x_event (int);
>  extern int gdbtk_two_elem_cmd (char *, const char *);
>  extern int target_is_native (struct target_ops *t);
> +extern int gdbtk_test (char *);
>  extern struct ui_file *gdbtk_fileopen (void);
>  extern bool gdbtk_disable_write;
>  extern ptid_t gdbtk_get_ptid (void);
> --
> 2.23.0.581.g78d2f28ef7-goog
>
>

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

* Re: [PATCH] Add declarations to gdbtk.h
  2019-10-07 22:40 ` Mike Wellington
@ 2019-10-07 22:43   ` Christian Biesinger via insight
  2019-10-07 22:48     ` Mike Wellington
  0 siblings, 1 reply; 8+ messages in thread
From: Christian Biesinger via insight @ 2019-10-07 22:43 UTC (permalink / raw)
  To: Mike Wellington; +Cc: insight

The problem is that gdb's main.c has this code:
      extern int gdbtk_test (char *);

      if (!gdbtk_test (optarg))

and
      extern char *external_editor_command;

      external_editor_command = xstrdup (optarg);

It should not have to declare functions/variables that are part of
gdbtk; it should be able to just include a header for that.

(there's no user-visible issue here -- this is code cleanup)

Christian

On Mon, Oct 7, 2019 at 5:40 PM Mike Wellington
<mike.b.wellington@gmail.com> wrote:
>
> So what's the problem?
>
> On Mon, Oct 7, 2019, 15:09 Christian Biesinger via insight <insight@sourceware.org> wrote:
>>
>> From: Christian Biesinger <cbiesinger@chromium.org>
>>
>> Currently, gdb/main.c has to declare these two variables in the
>> .c file. This patch adds the declarations to the header so that
>> gdb can just use them.
>>
>> gdbtk/ChangeLog:
>>
>> 2019-10-07  Christian Biesinger  <cbiesinger@chromium.org>
>>
>>         * generic/gdbtk.h (gdbtk_test): Declare.
>>   (external_editor_command): Declare.
>>   (file): Prefix Tcl_Interp with "struct"
>>   so that this compiles when Tcl headers aren't included.
>>   * generic/gdbtk-interp.h:  Likewise.
>> ---
>>  gdbtk/generic/gdbtk-interp.h |  2 +-
>>  gdbtk/generic/gdbtk.h        | 11 +++++++++--
>>  2 files changed, 10 insertions(+), 3 deletions(-)
>>
>> diff --git a/gdbtk/generic/gdbtk-interp.h b/gdbtk/generic/gdbtk-interp.h
>> index 3126b91..9abad2e 100644
>> --- a/gdbtk/generic/gdbtk-interp.h
>> +++ b/gdbtk/generic/gdbtk-interp.h
>> @@ -53,7 +53,7 @@ public:
>>    ui_file *_stdtargin;
>>    ui_out *uiout;
>>
>> -  Tcl_Interp *tcl;
>> +  struct Tcl_Interp *tcl;
>>  };
>>
>>  extern gdbtk_interp *gdbtk_get_interp (void);
>> diff --git a/gdbtk/generic/gdbtk.h b/gdbtk/generic/gdbtk.h
>> index 7bb1f79..89ab8bf 100644
>> --- a/gdbtk/generic/gdbtk.h
>> +++ b/gdbtk/generic/gdbtk.h
>> @@ -77,6 +77,12 @@ extern int running_now;
>>
>>  extern long gdbtk_pid;
>>
>> +/*
>> + * This variable controls the interaction with an external editor.
>> + */
>> +
>> +extern char *external_editor_command;
>> +
>>  /* These two control how the GUI behaves when tracing or loading
>>     They are defined in gdbtk-cmds.c */
>>
>> @@ -91,7 +97,7 @@ extern int load_in_progress;
>>
>>  typedef struct gdbtk_result
>>    {
>> -    Tcl_Obj *obj_ptr;          /* This will eventually be copied over to the
>> +    struct Tcl_Obj *obj_ptr;           /* This will eventually be copied over to the
>>                                    Tcl result */
>>      int flags;                 /* Flag vector to control how the result is
>>                                    used. */
>> @@ -151,7 +157,7 @@ extern int gdbtk_force_detach;
>>   *
>>   */
>>
>> -extern int Gdbtk_Init (Tcl_Interp * interp);
>> +extern int Gdbtk_Init (struct Tcl_Interp * interp);
>>  extern void gdbtk_stop_timer (void);
>>  extern void gdbtk_start_timer (void);
>>  extern long gdbtk_getpid(void);
>> @@ -159,6 +165,7 @@ extern void gdbtk_ignorable_warning (const char *, const char *);
>>  extern int x_event (int);
>>  extern int gdbtk_two_elem_cmd (char *, const char *);
>>  extern int target_is_native (struct target_ops *t);
>> +extern int gdbtk_test (char *);
>>  extern struct ui_file *gdbtk_fileopen (void);
>>  extern bool gdbtk_disable_write;
>>  extern ptid_t gdbtk_get_ptid (void);
>> --
>> 2.23.0.581.g78d2f28ef7-goog
>>

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

* Re: [PATCH] Add declarations to gdbtk.h
  2019-10-07 22:43   ` Christian Biesinger via insight
@ 2019-10-07 22:48     ` Mike Wellington
  0 siblings, 0 replies; 8+ messages in thread
From: Mike Wellington @ 2019-10-07 22:48 UTC (permalink / raw)
  To: Christian Biesinger; +Cc: insight

ok. good point.  not my problem.

On Mon, Oct 7, 2019 at 4:43 PM Christian Biesinger <cbiesinger@google.com>
wrote:

> The problem is that gdb's main.c has this code:
>       extern int gdbtk_test (char *);
>
>       if (!gdbtk_test (optarg))
>
> and
>       extern char *external_editor_command;
>
>       external_editor_command = xstrdup (optarg);
>
> It should not have to declare functions/variables that are part of
> gdbtk; it should be able to just include a header for that.
>
> (there's no user-visible issue here -- this is code cleanup)
>
> Christian
>
> On Mon, Oct 7, 2019 at 5:40 PM Mike Wellington
> <mike.b.wellington@gmail.com> wrote:
> >
> > So what's the problem?
> >
> > On Mon, Oct 7, 2019, 15:09 Christian Biesinger via insight <
> insight@sourceware.org> wrote:
> >>
> >> From: Christian Biesinger <cbiesinger@chromium.org>
> >>
> >> Currently, gdb/main.c has to declare these two variables in the
> >> .c file. This patch adds the declarations to the header so that
> >> gdb can just use them.
> >>
> >> gdbtk/ChangeLog:
> >>
> >> 2019-10-07  Christian Biesinger  <cbiesinger@chromium.org>
> >>
> >>         * generic/gdbtk.h (gdbtk_test): Declare.
> >>   (external_editor_command): Declare.
> >>   (file): Prefix Tcl_Interp with "struct"
> >>   so that this compiles when Tcl headers aren't included.
> >>   * generic/gdbtk-interp.h:  Likewise.
> >> ---
> >>  gdbtk/generic/gdbtk-interp.h |  2 +-
> >>  gdbtk/generic/gdbtk.h        | 11 +++++++++--
> >>  2 files changed, 10 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/gdbtk/generic/gdbtk-interp.h b/gdbtk/generic/gdbtk-interp.h
> >> index 3126b91..9abad2e 100644
> >> --- a/gdbtk/generic/gdbtk-interp.h
> >> +++ b/gdbtk/generic/gdbtk-interp.h
> >> @@ -53,7 +53,7 @@ public:
> >>    ui_file *_stdtargin;
> >>    ui_out *uiout;
> >>
> >> -  Tcl_Interp *tcl;
> >> +  struct Tcl_Interp *tcl;
> >>  };
> >>
> >>  extern gdbtk_interp *gdbtk_get_interp (void);
> >> diff --git a/gdbtk/generic/gdbtk.h b/gdbtk/generic/gdbtk.h
> >> index 7bb1f79..89ab8bf 100644
> >> --- a/gdbtk/generic/gdbtk.h
> >> +++ b/gdbtk/generic/gdbtk.h
> >> @@ -77,6 +77,12 @@ extern int running_now;
> >>
> >>  extern long gdbtk_pid;
> >>
> >> +/*
> >> + * This variable controls the interaction with an external editor.
> >> + */
> >> +
> >> +extern char *external_editor_command;
> >> +
> >>  /* These two control how the GUI behaves when tracing or loading
> >>     They are defined in gdbtk-cmds.c */
> >>
> >> @@ -91,7 +97,7 @@ extern int load_in_progress;
> >>
> >>  typedef struct gdbtk_result
> >>    {
> >> -    Tcl_Obj *obj_ptr;          /* This will eventually be copied over
> to the
> >> +    struct Tcl_Obj *obj_ptr;           /* This will eventually be
> copied over to the
> >>                                    Tcl result */
> >>      int flags;                 /* Flag vector to control how the
> result is
> >>                                    used. */
> >> @@ -151,7 +157,7 @@ extern int gdbtk_force_detach;
> >>   *
> >>   */
> >>
> >> -extern int Gdbtk_Init (Tcl_Interp * interp);
> >> +extern int Gdbtk_Init (struct Tcl_Interp * interp);
> >>  extern void gdbtk_stop_timer (void);
> >>  extern void gdbtk_start_timer (void);
> >>  extern long gdbtk_getpid(void);
> >> @@ -159,6 +165,7 @@ extern void gdbtk_ignorable_warning (const char *,
> const char *);
> >>  extern int x_event (int);
> >>  extern int gdbtk_two_elem_cmd (char *, const char *);
> >>  extern int target_is_native (struct target_ops *t);
> >> +extern int gdbtk_test (char *);
> >>  extern struct ui_file *gdbtk_fileopen (void);
> >>  extern bool gdbtk_disable_write;
> >>  extern ptid_t gdbtk_get_ptid (void);
> >> --
> >> 2.23.0.581.g78d2f28ef7-goog
> >>
>

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

* Re: [PATCH] Add declarations to gdbtk.h
  2019-10-07 21:09 [PATCH] Add declarations to gdbtk.h Christian Biesinger via insight
  2019-10-07 22:40 ` Mike Wellington
@ 2019-10-10  0:20 ` Keith Seitz
  2019-10-10  0:35   ` Christian Biesinger via insight
  2019-10-10 15:55   ` Keith Seitz
  1 sibling, 2 replies; 8+ messages in thread
From: Keith Seitz @ 2019-10-10  0:20 UTC (permalink / raw)
  To: Christian Biesinger, insight; +Cc: Christian Biesinger

On 10/7/19 2:09 PM, Christian Biesinger via insight wrote:
> From: Christian Biesinger <cbiesinger@chromium.org>
> 
> Currently, gdb/main.c has to declare these two variables in the
> .c file. This patch adds the declarations to the header so that
> gdb can just use them.
> 
> gdbtk/ChangeLog:
> 
> 2019-10-07  Christian Biesinger  <cbiesinger@chromium.org>
> 
> 	* generic/gdbtk.h (gdbtk_test): Declare.
>   (external_editor_command): Declare.
>   (file): Prefix Tcl_Interp with "struct"
>   so that this compiles when Tcl headers aren't included.
>   * generic/gdbtk-interp.h:  Likewise.

That looks okay to me. Thank you for thinking of us!

Keith

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

* Re: [PATCH] Add declarations to gdbtk.h
  2019-10-10  0:20 ` Keith Seitz
@ 2019-10-10  0:35   ` Christian Biesinger via insight
  2019-10-10 15:55   ` Keith Seitz
  1 sibling, 0 replies; 8+ messages in thread
From: Christian Biesinger via insight @ 2019-10-10  0:35 UTC (permalink / raw)
  To: Keith Seitz; +Cc: insight

Great thanks! Could you check this in? I don't think I have commit access
to this repository.

Christian

On Wed, Oct 9, 2019, 19:20 Keith Seitz <keiths@redhat.com> wrote:

> On 10/7/19 2:09 PM, Christian Biesinger via insight wrote:
> > From: Christian Biesinger <cbiesinger@chromium.org>
> >
> > Currently, gdb/main.c has to declare these two variables in the
> > .c file. This patch adds the declarations to the header so that
> > gdb can just use them.
> >
> > gdbtk/ChangeLog:
> >
> > 2019-10-07  Christian Biesinger  <cbiesinger@chromium.org>
> >
> >       * generic/gdbtk.h (gdbtk_test): Declare.
> >   (external_editor_command): Declare.
> >   (file): Prefix Tcl_Interp with "struct"
> >   so that this compiles when Tcl headers aren't included.
> >   * generic/gdbtk-interp.h:  Likewise.
>
> That looks okay to me. Thank you for thinking of us!
>
> Keith
>

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

* Re: [PATCH] Add declarations to gdbtk.h
  2019-10-10  0:20 ` Keith Seitz
  2019-10-10  0:35   ` Christian Biesinger via insight
@ 2019-10-10 15:55   ` Keith Seitz
  2019-10-10 17:47     ` Christian Biesinger via insight
  1 sibling, 1 reply; 8+ messages in thread
From: Keith Seitz @ 2019-10-10 15:55 UTC (permalink / raw)
  To: Christian Biesinger, insight; +Cc: Christian Biesinger

On 10/9/19 5:20 PM, Keith Seitz wrote:
> 
> That looks okay to me. Thank you for thinking of us!

I've pushed this to the repo for you.

Keith

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

* Re: [PATCH] Add declarations to gdbtk.h
  2019-10-10 15:55   ` Keith Seitz
@ 2019-10-10 17:47     ` Christian Biesinger via insight
  0 siblings, 0 replies; 8+ messages in thread
From: Christian Biesinger via insight @ 2019-10-10 17:47 UTC (permalink / raw)
  To: Keith Seitz; +Cc: insight

On Thu, Oct 10, 2019 at 10:55 AM Keith Seitz <keiths@redhat.com> wrote:
>
> On 10/9/19 5:20 PM, Keith Seitz wrote:
> >
> > That looks okay to me. Thank you for thinking of us!
>
> I've pushed this to the repo for you.

Thank you, I've pushed the related gdb change now.

Christian

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

end of thread, other threads:[~2019-10-10 17:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-07 21:09 [PATCH] Add declarations to gdbtk.h Christian Biesinger via insight
2019-10-07 22:40 ` Mike Wellington
2019-10-07 22:43   ` Christian Biesinger via insight
2019-10-07 22:48     ` Mike Wellington
2019-10-10  0:20 ` Keith Seitz
2019-10-10  0:35   ` Christian Biesinger via insight
2019-10-10 15:55   ` Keith Seitz
2019-10-10 17:47     ` Christian Biesinger via insight

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