Update documentation for get_args

Message ID 20180222224614.5120-1-keiths@redhat.com
State New, archived
Headers

Commit Message

Keith Seitz Feb. 22, 2018, 10:46 p.m. UTC
  From: Phil Muldoon <pmuldoon@redhat.com>

This patch adds argument compilation documentation, expanding on the
already existing comments, giving a more thorough explanation of
the source of the arguments used in the final argument string.

gdb/ChangeLog:

	* compile/compile.c (get_args): Add additional comments
	explaining function.
---
 gdb/compile/compile.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)
  

Comments

Simon Marchi Feb. 25, 2018, 6:46 p.m. UTC | #1
On 2018-02-22 05:46 PM, Keith Seitz wrote:
> --- a/gdb/compile/compile.c
> +++ b/gdb/compile/compile.c
> @@ -393,9 +393,25 @@ filter_args (int *argcp, char **argv)
>    *destv = NULL;
>  }
>  
> -/* Produce final vector of GCC compilation options.  First element is target
> -   size ("-m64", "-m32" etc.), optionally followed by DW_AT_producer options
> -   and then compile-args string GDB variable.  */
> +/* Produce final vector of GCC compilation options.
> +
> +   The first element of the combined argument vector are arguments
> +   relating to the target size ("-m64", "-m32" etc.). These are
> +   sourced from the inferior's architecture.
> +
> +   The second element of the combined argument vector are arguments
> +   stored in the inferior DW_AT_producer section.  If these are stored
> +   in the inferior (there is no guarantee that they are), they are
> +   added to the vector.
> +
> +   The third element of the combined argument vector are argument
> +   supplied by the language implementation provided by
> +   compile-{lang}-support. These contain language specific arguments.
> +
> +   The final element of the combined argument vector are arguments
> +   supplied by the "set compiler-args" command. These are always

"set compile-args", and two spaces after period (a few occurences in the patch).

Otherwise, LGTM, the comment seems to match the implementation.

Thanks!

Simon
  
Keith Seitz Feb. 27, 2018, 8:55 p.m. UTC | #2
On 02/25/2018 10:46 AM, Simon Marchi wrote:
> "set compile-args", and two spaces after period (a few occurences in the patch).
> 
> Otherwise, LGTM, the comment seems to match the implementation.

Yikes! I apologize for not double-checking this patch against the coding standard. I assumed it was all good.

> Thanks!

Nope, thank you! I've pushed this with the specified changes.

Keith
  

Patch

diff --git a/gdb/compile/compile.c b/gdb/compile/compile.c
index 82e63d895f..b9a40ed32a 100644
--- a/gdb/compile/compile.c
+++ b/gdb/compile/compile.c
@@ -393,9 +393,25 @@  filter_args (int *argcp, char **argv)
   *destv = NULL;
 }
 
-/* Produce final vector of GCC compilation options.  First element is target
-   size ("-m64", "-m32" etc.), optionally followed by DW_AT_producer options
-   and then compile-args string GDB variable.  */
+/* Produce final vector of GCC compilation options.
+
+   The first element of the combined argument vector are arguments
+   relating to the target size ("-m64", "-m32" etc.). These are
+   sourced from the inferior's architecture.
+
+   The second element of the combined argument vector are arguments
+   stored in the inferior DW_AT_producer section.  If these are stored
+   in the inferior (there is no guarantee that they are), they are
+   added to the vector.
+
+   The third element of the combined argument vector are argument
+   supplied by the language implementation provided by
+   compile-{lang}-support. These contain language specific arguments.
+
+   The final element of the combined argument vector are arguments
+   supplied by the "set compiler-args" command. These are always
+   appended last so as to override any of the arguments automatically
+   generated above.  */
 
 static void
 get_args (const struct compile_instance *compiler, struct gdbarch *gdbarch,