threads / patch / 51118

patchdoc: hint about GIT_DEBUGGER

Subject: [PATCH] doc: hint about GIT_DEBUGGER

## tl;dr

10 messages between May 17, 2019 and May 28, 2019. Diffs are folded; open one to read it.

replies: 9people: 3as markdown or json

Emily Shaffer· May 17, 2019, 20:48 UTC · lore

We check for a handy environment variable GIT_DEBUGGER when running via bin-wrappers/, but this feature is undocumented. Add a hint to how to use it into the CodingGuidelines (which is where other useful environment settings like DEVELOPER are documented).

It looks like you can use GIT_DEBUGGER to pick gdb by default, or you can hand it your own debugger if you like to use something else (or if you want custom flags for gdb). Hopefully document that intent within CodingGuidelines.

Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
---
Maybe this isn't the right place for this patch. But right now git grep
reveals that GIT_DEBUGGER is completely undocumented.

Alternatively, it might make sense to only add a short blurb about using GIT_DEBUGGER flag to CodingGuidelines and then documenting how to use it inside of wrap-for-bin.sh.

 Documentation/CodingGuidelines | 5 +++++
 1 file changed, 5 insertions(+)
Show changes to Documentation/CodingGuidelines +5 −0
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index 32210a4386..e17cd75b50 100644
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -412,6 +412,11 @@ For C programs:
    must be declared with "extern" in header files. However, function
    declarations should not use "extern", as that is already the default.
 
+ - You can launch gdb around your program using the shorthand GIT_DEBUGGER.
+   Run `GIT_DEBUGGER=1 ./bin-wrappers/git foo` to simply use gdb as is, or
+   run `GIT_DEBUGGER=debugger-binary some-args ./bin-wrappers/git foo` to
+   use your own debugger and arguments. (See `wrap-for-bin.sh`.)
+
 For Perl programs:
 
  - Most of the C guidelines above apply.
-- 
2.21.0.1020.gf2820cf01a-goog
Elijah Newren· May 18, 2019, 05:40 UTC · re: Emily Shaffer · lore

Re: [PATCH] doc: hint about GIT_DEBUGGER

Hi Emily,
On Fri, May 17, 2019 at 3:40 PM Emily Shaffer <emilyshaffer@google.com> wrote:
Show 10 quoted lines
>
> We check for a handy environment variable GIT_DEBUGGER when running via
> bin-wrappers/, but this feature is undocumented. Add a hint to how to
> use it into the CodingGuidelines (which is where other useful
> environment settings like DEVELOPER are documented).
>
> It looks like you can use GIT_DEBUGGER to pick gdb by default, or you
> can hand it your own debugger if you like to use something else (or if
> you want custom flags for gdb). Hopefully document that intent within
> CodingGuidelines.
Thanks for working on this.
> Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
> ---
> Maybe this isn't the right place for this patch. But right now git grep
> reveals that GIT_DEBUGGER is completely undocumented.
Does 'git log --grep=GIT_DEBUGGER' count?  ;-)
Show 18 quoted lines
> Alternatively, it might make sense to only add a short blurb about using
> GIT_DEBUGGER flag to CodingGuidelines and then documenting how to use it
> inside of wrap-for-bin.sh.
>
>  Documentation/CodingGuidelines | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
> index 32210a4386..e17cd75b50 100644
> --- a/Documentation/CodingGuidelines
> +++ b/Documentation/CodingGuidelines
> @@ -412,6 +412,11 @@ For C programs:
>     must be declared with "extern" in header files. However, function
>     declarations should not use "extern", as that is already the default.
>
> + - You can launch gdb around your program using the shorthand GIT_DEBUGGER.
> +   Run `GIT_DEBUGGER=1 ./bin-wrappers/git foo` to simply use gdb as is, or
> +   run `GIT_DEBUGGER=debugger-binary some-args ./bin-wrappers/git foo` to
Missing some quotes around debugger-binary and some-args:
+   run `GIT_DEBUGGER="debugger-binary some-args" ./bin-wrappers/git foo` to

Also, one thing I always wonder about with command documentation like this is whether people will understand that "debugger-binary", "some-args", and "foo" are just placeholders rather than literal text -- and that everything else is literal text and not meant to be placeholders. Does it make since to include a couple examples, or perhaps modify the text somehow to avoid confusion between placeholders and literals, or maybe just tell me I overthinking this? (I've been bit by similar problems in other contexts, so I'm just flagging it for you to consider).

Elijah
Emily Shaffer· May 20, 2019, 20:38 UTC · re: Elijah Newren · lore

Re: [PATCH] doc: hint about GIT_DEBUGGER

[snip]
Show 16 quoted lines
> > + - You can launch gdb around your program using the shorthand GIT_DEBUGGER.
> > +   Run `GIT_DEBUGGER=1 ./bin-wrappers/git foo` to simply use gdb as is, or
> > +   run `GIT_DEBUGGER=debugger-binary some-args ./bin-wrappers/git foo` to
> 
> Missing some quotes around debugger-binary and some-args:
> +   run `GIT_DEBUGGER="debugger-binary some-args" ./bin-wrappers/git foo` to
> 
> Also, one thing I always wonder about with command documentation like
> this is whether people will understand that "debugger-binary",
> "some-args", and "foo" are just placeholders rather than literal text
> -- and that everything else is literal text and not meant to be
> placeholders.  Does it make since to include a couple examples, or
> perhaps modify the text somehow to avoid confusion between
> placeholders and literals, or maybe just tell me I overthinking this?
> (I've been bit by similar problems in other contexts, so I'm just
> flagging it for you to consider).

It's a good point. I like to use placeholders that don't sound like a real command (and failed a little here), for example, `GIT_DEBUGGER=my-cool-debugger some-various-args`. It can be a challenge to choose a placeholder that sounds fake but also doesn't sound too informal (the above feels informal to me). I think the best way is to show an example, that's a good idea. I'll come up with one and send another round this week.

Thanks a bunch for having a look.
 - Emily
> 
> Elijah
Emily Shaffer· May 21, 2019, 01:00 UTC · re: Emily Shaffer · lore

[PATCH v2] doc: hint about GIT_DEBUGGER

We check for a handy environment variable GIT_DEBUGGER when running via bin-wrappers/, but this feature is undocumented. Add a hint to how to use it into the CodingGuidelines (which is where other useful environment settings like DEVELOPER are documented).

It looks like you can use GIT_DEBUGGER to pick gdb by default, or you can hand it your own debugger if you like to use something else (or if you want custom flags for gdb). Hopefully document that intent within CodingGuidelines.

Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
---
 Documentation/CodingGuidelines | 6 ++++++
 1 file changed, 6 insertions(+)
Show changes to Documentation/CodingGuidelines +6 −0
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index 32210a4386..e99af36df9 100644
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -412,6 +412,12 @@ For C programs:
    must be declared with "extern" in header files. However, function
    declarations should not use "extern", as that is already the default.
 
+ - You can launch gdb around your program using the shorthand GIT_DEBUGGER.
+   Run `GIT_DEBUGGER=1 ./bin-wrappers/git foo` to simply use gdb as is, or
+   run `GIT_DEBUGGER=my-debugger-binary my-args ./bin-wrappers/git foo` to
+   use your own debugger and arguments. Example: `GIT_DEBUGGER="ddd --gdb"
+   ./bin-wrappers/git log` (See `wrap-for-bin.sh`.)
+
 For Perl programs:
 
  - Most of the C guidelines above apply.
-- 
2.21.0.1020.gf2820cf01a-goog
Elijah Newren· May 21, 2019, 16:06 UTC · re: Emily Shaffer · lore

Re: [PATCH v2] doc: hint about GIT_DEBUGGER

On Mon, May 20, 2019 at 6:01 PM Emily Shaffer <emilyshaffer@google.com> wrote:
Show 6 quoted lines
>
> We check for a handy environment variable GIT_DEBUGGER when running via
> bin-wrappers/, but this feature is undocumented. Add a hint to how to
> use it into the CodingGuidelines (which is where other useful
> environment settings like DEVELOPER are documented).
>
Two very minor nits:
> It looks like you can use GIT_DEBUGGER to pick gdb by default, or you
I think it'd sound better without 'It looks like'; perhaps drop that part?
> can hand it your own debugger if you like to use something else (or if
> you want custom flags for gdb). Hopefully document that intent within
> CodingGuidelines.
Maybe just leave out 'Hopefully'?
Show 20 quoted lines
>
> Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
> ---
>  Documentation/CodingGuidelines | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
> index 32210a4386..e99af36df9 100644
> --- a/Documentation/CodingGuidelines
> +++ b/Documentation/CodingGuidelines
> @@ -412,6 +412,12 @@ For C programs:
>     must be declared with "extern" in header files. However, function
>     declarations should not use "extern", as that is already the default.
>
> + - You can launch gdb around your program using the shorthand GIT_DEBUGGER.
> +   Run `GIT_DEBUGGER=1 ./bin-wrappers/git foo` to simply use gdb as is, or
> +   run `GIT_DEBUGGER=my-debugger-binary my-args ./bin-wrappers/git foo` to
> +   use your own debugger and arguments. Example: `GIT_DEBUGGER="ddd --gdb"
> +   ./bin-wrappers/git log` (See `wrap-for-bin.sh`.)
> +
Other than the minor nits above:
Acked-by: Elijah Newren <newren@gmail.com>
Emily Shaffer· May 21, 2019, 18:19 UTC · re: Elijah Newren · lore

Re: [PATCH v2] doc: hint about GIT_DEBUGGER

On Tue, May 21, 2019 at 09:06:18AM -0700, Elijah Newren wrote:
Show 43 quoted lines
> On Mon, May 20, 2019 at 6:01 PM Emily Shaffer <emilyshaffer@google.com> wrote:
> >
> > We check for a handy environment variable GIT_DEBUGGER when running via
> > bin-wrappers/, but this feature is undocumented. Add a hint to how to
> > use it into the CodingGuidelines (which is where other useful
> > environment settings like DEVELOPER are documented).
> >
> 
> Two very minor nits:
> 
> > It looks like you can use GIT_DEBUGGER to pick gdb by default, or you
> 
> I think it'd sound better without 'It looks like'; perhaps drop that part?
> 
> > can hand it your own debugger if you like to use something else (or if
> > you want custom flags for gdb). Hopefully document that intent within
> > CodingGuidelines.
> 
> Maybe just leave out 'Hopefully'?
> 
> >
> > Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
> > ---
> >  Documentation/CodingGuidelines | 6 ++++++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
> > index 32210a4386..e99af36df9 100644
> > --- a/Documentation/CodingGuidelines
> > +++ b/Documentation/CodingGuidelines
> > @@ -412,6 +412,12 @@ For C programs:
> >     must be declared with "extern" in header files. However, function
> >     declarations should not use "extern", as that is already the default.
> >
> > + - You can launch gdb around your program using the shorthand GIT_DEBUGGER.
> > +   Run `GIT_DEBUGGER=1 ./bin-wrappers/git foo` to simply use gdb as is, or
> > +   run `GIT_DEBUGGER=my-debugger-binary my-args ./bin-wrappers/git foo` to
> > +   use your own debugger and arguments. Example: `GIT_DEBUGGER="ddd --gdb"
> > +   ./bin-wrappers/git log` (See `wrap-for-bin.sh`.)
> > +
> 
> Other than the minor nits above:
> Acked-by: Elijah Newren <newren@gmail.com>

Made both the changes you recommended; I'll hang onto it locally until this afternoon in case anybody else has something to say. Thanks for looking, Elijah.

 - Emily
Emily Shaffer· May 23, 2019, 00:55 UTC · re: Emily Shaffer · lore

[PATCH v3] doc: hint about GIT_DEBUGGER in CodingGuidelines

We check for a handy environment variable GIT_DEBUGGER when running via bin-wrappers/, but this feature is undocumented. Add a hint to how to use it into the CodingGuidelines (which is where other useful environment settings like DEVELOPER are documented).

You can use GIT_DEBUGGER to pick gdb by default, or you can hand it your own debugger if you like to use something else (or if you want custom flags for gdb). This commit documents that intent within CodingGuidelines.

Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
---

Since v2, only the commit message has changed. Removed some weak language to make the commit message read more easily.

 Documentation/CodingGuidelines | 6 ++++++
 1 file changed, 6 insertions(+)
Show changes to Documentation/CodingGuidelines +6 −0
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index 32210a4386..e99af36df9 100644
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -412,6 +412,12 @@ For C programs:
    must be declared with "extern" in header files. However, function
    declarations should not use "extern", as that is already the default.
 
+ - You can launch gdb around your program using the shorthand GIT_DEBUGGER.
+   Run `GIT_DEBUGGER=1 ./bin-wrappers/git foo` to simply use gdb as is, or
+   run `GIT_DEBUGGER=my-debugger-binary my-args ./bin-wrappers/git foo` to
+   use your own debugger and arguments. Example: `GIT_DEBUGGER="ddd --gdb"
+   ./bin-wrappers/git log` (See `wrap-for-bin.sh`.)
+
 For Perl programs:
 
  - Most of the C guidelines above apply.
-- 
2.21.0.1020.gf2820cf01a-goog
Eric Sunshine· May 23, 2019, 10:09 UTC · re: Emily Shaffer · lore

Re: [PATCH v3] doc: hint about GIT_DEBUGGER in CodingGuidelines

On Wed, May 22, 2019 at 8:56 PM Emily Shaffer <emilyshaffer@google.com> wrote:
Show 9 quoted lines
> We check for a handy environment variable GIT_DEBUGGER when running via
> bin-wrappers/, but this feature is undocumented. Add a hint to how to
> use it into the CodingGuidelines (which is where other useful
> environment settings like DEVELOPER are documented).
>
> You can use GIT_DEBUGGER to pick gdb by default, or you can hand it your
> own debugger if you like to use something else (or if you want custom
> flags for gdb). This commit documents that intent within
> CodingGuidelines.

This last sentence is repeating what is already stated in the first paragraph, thus doesn't seem to add value. In fact, the remainder of the second paragraph seems to be repeating what is in the patch proper, thus could likely be dropped.

Show 7 quoted lines
> Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
> ---
> diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
> @@ -412,6 +412,12 @@ For C programs:
> + - You can launch gdb around your program using the shorthand GIT_DEBUGGER.
> +   Run `GIT_DEBUGGER=1 ./bin-wrappers/git foo` to simply use gdb as is, or
> +   run `GIT_DEBUGGER=my-debugger-binary my-args ./bin-wrappers/git foo` to

Don't you need to bind my-debugger-binary and my-args together with shell quotes? Also, placeholders like these are often ensconced in angle brackets, so perhaps:

    ... `GIT_DEBUGGER="<debugger> <debugger-args>" ./bin-wrappers/git ...
> +   use your own debugger and arguments. Example: `GIT_DEBUGGER="ddd --gdb"
> +   ./bin-wrappers/git log` (See `wrap-for-bin.sh`.)
Emily Shaffer· May 28, 2019, 19:05 UTC · re: Eric Sunshine · lore

Re: [PATCH v3] doc: hint about GIT_DEBUGGER in CodingGuidelines

On Thu, May 23, 2019 at 06:09:17AM -0400, Eric Sunshine wrote:
Show 15 quoted lines
> On Wed, May 22, 2019 at 8:56 PM Emily Shaffer <emilyshaffer@google.com> wrote:
> > We check for a handy environment variable GIT_DEBUGGER when running via
> > bin-wrappers/, but this feature is undocumented. Add a hint to how to
> > use it into the CodingGuidelines (which is where other useful
> > environment settings like DEVELOPER are documented).
> >
> > You can use GIT_DEBUGGER to pick gdb by default, or you can hand it your
> > own debugger if you like to use something else (or if you want custom
> > flags for gdb). This commit documents that intent within
> > CodingGuidelines.
> 
> This last sentence is repeating what is already stated in the first
> paragraph, thus doesn't seem to add value. In fact, the remainder of
> the second paragraph seems to be repeating what is in the patch
> proper, thus could likely be dropped.
Yes, you're right. Dropped.
Show 14 quoted lines
> 
> > Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
> > ---
> > diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
> > @@ -412,6 +412,12 @@ For C programs:
> > + - You can launch gdb around your program using the shorthand GIT_DEBUGGER.
> > +   Run `GIT_DEBUGGER=1 ./bin-wrappers/git foo` to simply use gdb as is, or
> > +   run `GIT_DEBUGGER=my-debugger-binary my-args ./bin-wrappers/git foo` to
> 
> Don't you need to bind my-debugger-binary and my-args together with
> shell quotes? Also, placeholders like these are often ensconced in
> angle brackets, so perhaps:
> 
>     ... `GIT_DEBUGGER="<debugger> <debugger-args>" ./bin-wrappers/git ...

Fixed. I did get the dq in the example but missed it with the placeholders. :) Thanks, good catch.

> > +   use your own debugger and arguments. Example: `GIT_DEBUGGER="ddd --gdb"
> > +   ./bin-wrappers/git log` (See `wrap-for-bin.sh`.)
Patch update to follow. Thanks.
 - Emily
Emily Shaffer· May 28, 2019, 19:07 UTC · re: Emily Shaffer · lore

[PATCH v4] doc: hint about GIT_DEBUGGER in CodingGuidelines

We check for a handy environment variable GIT_DEBUGGER when running via bin-wrappers/, but this feature is undocumented. Add a hint to how to use it into the CodingGuidelines (which is where other useful environment settings like DEVELOPER are documented).

Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
---
 Documentation/CodingGuidelines | 6 ++++++
 1 file changed, 6 insertions(+)
Show changes to Documentation/CodingGuidelines +6 −0
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index 32210a4386..1169ff6c8e 100644
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -412,6 +412,12 @@ For C programs:
    must be declared with "extern" in header files. However, function
    declarations should not use "extern", as that is already the default.
 
+ - You can launch gdb around your program using the shorthand GIT_DEBUGGER.
+   Run `GIT_DEBUGGER=1 ./bin-wrappers/git foo` to simply use gdb as is, or
+   run `GIT_DEBUGGER="<debugger> <debugger-args>" ./bin-wrappers/git foo` to
+   use your own debugger and arguments. Example: `GIT_DEBUGGER="ddd --gdb"
+   ./bin-wrappers/git log` (See `wrap-for-bin.sh`.)
+
 For Perl programs:
 
  - Most of the C guidelines above apply.
-- 
2.22.0.rc1.257.g3120a18244-goog

← back to recent threads