Install fileio.h to share File I/O protocol type definitions

Message ID 010201647e64586b-d00b8b01-c2d4-4b0d-8f9c-3485ccafa87c-000000@eu-west-1.amazonses.com
State New, archived
Headers

Commit Message

Julio Guerra July 9, 2018, 9:34 a.m. UTC
  Prevent remote programs from redefining File I/O protocol types by installing
include/gdb/fileio.h to share its type definitions.

Signed-off-by: Julio Guerra <julio@farjump.io>
---
 gdb/ChangeLog   | 4 ++++
 gdb/Makefile.in | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)

-- 
2.18.0
  

Comments

Tom Tromey July 25, 2018, 7:37 p.m. UTC | #1
>>>>> "Julio" == Julio Guerra <julio@farjump.io> writes:

Your message had ^M characters at the end of each line - no big deal but
please make sure this isn't what would appear an eventual push.

Julio> Prevent remote programs from redefining File I/O protocol types by installing
Julio> include/gdb/fileio.h to share its type definitions.

This seems reasonable enough, but what is it you plan to use it for?
(I could guess I suppose but it seemed better to ask.)

It seems like it would be a good idea to have some documentation for
this, if it's something we intend to support.

thanks,
Tom
  
Julio Guerra July 25, 2018, 8 p.m. UTC | #2
Le 25/07/2018 à 21:37, Tom Tromey a écrit :
>>>>>> "Julio" == Julio Guerra <julio@farjump.io> writes:

> Your message had ^M characters at the end of each line - no big deal but

> please make sure this isn't what would appear an eventual push.


I am not sure to understand where did you saw ^M chars? I used git
format-patch + send-email as usually, I don't understand where they
could come from.

> Julio> Prevent remote programs from redefining File I/O protocol types by installing

> Julio> include/gdb/fileio.h to share its type definitions.

>

> This seems reasonable enough, but what is it you plan to use it for?

> (I could guess I suppose but it seemed better to ask.)


When you implement gdb stubs supporting the File I/O protocol, the
remote programs then using File I/O services will require those types.
Right now, we have to define them ourselves, but by installing this
file, we could firstly stop redefining them, and secondly, have some
kind of single source of truth as it's easy to do mistakes when
redefining them (actually, our struct stat redefinition was wrong for
years, but no one was using it until now).

> It seems like it would be a good idea to have some documentation for

> this, if it's something we intend to support.


The documentation already talks about these types here
https://sourceware.org/gdb/onlinedocs/gdb/Protocol_002dspecific-Representation-of-Datatypes.html#Protocol_002dspecific-Representation-of-Datatypes
But do you want me to add some documentation about this file being
installed before the list?

-- 
Julio Guerra
  
Tom Tromey Sept. 7, 2018, 10:08 p.m. UTC | #3
>>>>> "Julio" == Julio Guerra <julio@farjump.io> writes:

Thanks for your patience on this repsonse.

The gdb rule is that you can ping a patch (or in this case, IMO, really
any question) after 2 weeks, and then weekly thereafter.  This may be
uncomfortable (I never really got into it) but it really is ok.

>> It seems like it would be a good idea to have some documentation for
>> this, if it's something we intend to support.

Julio> The documentation already talks about these types here
Julio> https://sourceware.org/gdb/onlinedocs/gdb/Protocol_002dspecific-Representation-of-Datatypes.html#Protocol_002dspecific-Representation-of-Datatypes
Julio> But do you want me to add some documentation about this file being
Julio> installed before the list?

I think that would be a good idea.

thanks,
Tom
  

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index eb65f91488..9cb2710f4c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@ 
+2018-07-09  Julio Guerra  <julio@farjump.io>
+
+	* Makefile.in (install-only): Install include/gdb/fileio.h.
+
 2018-07-07  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
 	* contrib/gdb-add-index.sh ($dwarf5): New, use it.
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 13627e07e0..6998a70c0c 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -1747,7 +1747,8 @@  install-only: $(CONFIG_INSTALL)
 		$(INSTALL_PROGRAM) gdb$(EXEEXT) \
 			$(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) ; \
 		$(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(includedir)/gdb ; \
-		$(INSTALL_DATA) jit-reader.h $(DESTDIR)$(includedir)/gdb/jit-reader.h
+		$(INSTALL_DATA) jit-reader.h $(DESTDIR)$(includedir)/gdb/jit-reader.h ; \
+		$(INSTALL_DATA) $(INCLUDE_DIR)/gdb/fileio.h $(DESTDIR)$(includedir)/gdb/fileio.h
 	if test "x$(HAVE_NATIVE_GCORE_TARGET)$(HAVE_NATIVE_GCORE_HOST)" != x; \
 	then \
 	  transformed_name=`t='$(program_transform_name)'; \