public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gdb, gdbserver, gdbsupport: add .gitattributes files
@ 2020-03-05  9:01 Tankut Baris Aktemur
  2020-03-05 14:24 ` Simon Marchi
  0 siblings, 1 reply; 3+ messages in thread
From: Tankut Baris Aktemur @ 2020-03-05  9:01 UTC (permalink / raw)
  To: gdb-patches

Create .gitattributes files in gdb/, gdbserver/, and gdbsupport/.

The files specify cpp-style diffs for .h and .c files.  This is
particularly helpful if a class in a header file is modified.
For instance, if the `stop_requested` field of `thread_info` in
gdb/gdbthread.h is modified, we get the following diff with
'git diff' (using git version 2.17.1):

   @@ -379,7 +379,7 @@ public:
      struct target_waitstatus pending_follow;

      /* True if this thread has been explicitly requested to stop.  */
   -  int stop_requested = 0;
   +  bool stop_requested = 0;

      /* The initiating frame of a nexting operation, used for deciding
         which exceptions to intercept.  If it is null_frame_id no

Note that the context of the change shows up as 'public:'; not so
useful.  With the .gitattributes file, we get:

   @@ -379,7 +379,7 @@ class thread_info : public refcounted_object
      struct target_waitstatus pending_follow;

      /* True if this thread has been explicitly requested to stop.  */
   -  int stop_requested = 0;
   +  bool stop_requested = 0;

      /* The initiating frame of a nexting operation, used for deciding
         which exceptions to intercept.  If it is null_frame_id no

The context is successfully shown as 'class thread_info'.

This patch creates a .gitattributes file per each of gdb, gdbserver,
and gdbsupport folders.  An alternative would be to define the
attributes in the root folder -- this would impact all the top-level
folders, though.  I opted for the more conservative approach.

gdb/ChangeLog:
2020-03-05  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	* .gitattributes: New file.

gdbserver/ChangeLog:
2020-03-05  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	* .gitattributes: New file.

gdbsupport/ChangeLog:
2020-03-05  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	* .gitattributes: New file.
---
 gdb/.gitattributes        | 7 +++++++
 gdbserver/.gitattributes  | 6 ++++++
 gdbsupport/.gitattributes | 6 ++++++
 3 files changed, 19 insertions(+)
 create mode 100644 gdb/.gitattributes
 create mode 100644 gdbserver/.gitattributes
 create mode 100644 gdbsupport/.gitattributes

diff --git a/gdb/.gitattributes b/gdb/.gitattributes
new file mode 100644
index 00000000000..8acadb9813e
--- /dev/null
+++ b/gdb/.gitattributes
@@ -0,0 +1,7 @@
+# -*- conf -*-
+
+# Use cpp-style diffs for .h and .c files.  This is useful
+# if you modify classes defined in those files.
+
+*.h	diff=cpp
+*.c	diff=cpp
diff --git a/gdbserver/.gitattributes b/gdbserver/.gitattributes
new file mode 100644
index 00000000000..6df25746593
--- /dev/null
+++ b/gdbserver/.gitattributes
@@ -0,0 +1,6 @@
+# -*- conf -*-
+
+# Use cpp-style diffs for .h files.  This is useful
+# if you modify classes defined in a header file.
+
+*.h	diff=cpp
diff --git a/gdbsupport/.gitattributes b/gdbsupport/.gitattributes
new file mode 100644
index 00000000000..6df25746593
--- /dev/null
+++ b/gdbsupport/.gitattributes
@@ -0,0 +1,6 @@
+# -*- conf -*-
+
+# Use cpp-style diffs for .h files.  This is useful
+# if you modify classes defined in a header file.
+
+*.h	diff=cpp
-- 
2.17.1

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

* Re: [PATCH] gdb, gdbserver, gdbsupport: add .gitattributes files
  2020-03-05  9:01 [PATCH] gdb, gdbserver, gdbsupport: add .gitattributes files Tankut Baris Aktemur
@ 2020-03-05 14:24 ` Simon Marchi
  2020-03-05 15:07   ` Aktemur, Tankut Baris
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Marchi @ 2020-03-05 14:24 UTC (permalink / raw)
  To: Tankut Baris Aktemur, gdb-patches

On 2020-03-05 4:01 a.m., Tankut Baris Aktemur wrote:
> Create .gitattributes files in gdb/, gdbserver/, and gdbsupport/.
> 
> The files specify cpp-style diffs for .h and .c files.  This is
> particularly helpful if a class in a header file is modified.
> For instance, if the `stop_requested` field of `thread_info` in
> gdb/gdbthread.h is modified, we get the following diff with
> 'git diff' (using git version 2.17.1):
> 
>    @@ -379,7 +379,7 @@ public:
>       struct target_waitstatus pending_follow;
> 
>       /* True if this thread has been explicitly requested to stop.  */
>    -  int stop_requested = 0;
>    +  bool stop_requested = 0;
> 
>       /* The initiating frame of a nexting operation, used for deciding
>          which exceptions to intercept.  If it is null_frame_id no
> 
> Note that the context of the change shows up as 'public:'; not so
> useful.  With the .gitattributes file, we get:
> 
>    @@ -379,7 +379,7 @@ class thread_info : public refcounted_object
>       struct target_waitstatus pending_follow;
> 
>       /* True if this thread has been explicitly requested to stop.  */
>    -  int stop_requested = 0;
>    +  bool stop_requested = 0;
> 
>       /* The initiating frame of a nexting operation, used for deciding
>          which exceptions to intercept.  If it is null_frame_id no
> 
> The context is successfully shown as 'class thread_info'.
> 
> This patch creates a .gitattributes file per each of gdb, gdbserver,
> and gdbsupport folders.  An alternative would be to define the
> attributes in the root folder -- this would impact all the top-level
> folders, though.  I opted for the more conservative approach.
> 
> gdb/ChangeLog:
> 2020-03-05  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
> 
> 	* .gitattributes: New file.
> 
> gdbserver/ChangeLog:
> 2020-03-05  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
> 
> 	* .gitattributes: New file.
> 
> gdbsupport/ChangeLog:
> 2020-03-05  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
> 
> 	* .gitattributes: New file.
> ---
>  gdb/.gitattributes        | 7 +++++++
>  gdbserver/.gitattributes  | 6 ++++++
>  gdbsupport/.gitattributes | 6 ++++++
>  3 files changed, 19 insertions(+)
>  create mode 100644 gdb/.gitattributes
>  create mode 100644 gdbserver/.gitattributes
>  create mode 100644 gdbsupport/.gitattributes

TIL.  The patch LGTM, please push.

Simon

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

* RE: [PATCH] gdb, gdbserver, gdbsupport: add .gitattributes files
  2020-03-05 14:24 ` Simon Marchi
@ 2020-03-05 15:07   ` Aktemur, Tankut Baris
  0 siblings, 0 replies; 3+ messages in thread
From: Aktemur, Tankut Baris @ 2020-03-05 15:07 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

On Thursday, March 5, 2020 3:24 PM, Simon Marchi wrote:
> On 2020-03-05 4:01 a.m., Tankut Baris Aktemur wrote:
> > Create .gitattributes files in gdb/, gdbserver/, and gdbsupport/.
> >
> 
> TIL.  The patch LGTM, please push.
> 
> Simon

Pushed as 842806cb6f1c321666dd086a79a0fdfbd35497ed.

Thanks.
-Baris


Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-05  9:01 [PATCH] gdb, gdbserver, gdbsupport: add .gitattributes files Tankut Baris Aktemur
2020-03-05 14:24 ` Simon Marchi
2020-03-05 15:07   ` Aktemur, Tankut Baris

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