diff mbox

Add documentation to gdb_compile

Message ID 1450391903-767-1-git-send-email-simon.marchi@ericsson.com
State New
Headers show

Commit Message

Simon Marchi Dec. 17, 2015, 10:38 p.m. UTC
This patch adds some documentation to gdb_compile.  It describes the
various options that can influence compilation.  Most of them are
handled by DejaGnu, but are not really documented anywhere, so I think
it's good to have a quick reference.  Not all possible options are
described, that would add way to much noise.  I chose those that I think
are relevant in the context of writing a test case.

gdb/testsuite/ChangeLog:

	* lib/gdb.exp (gdb_compile): Add function doc.
---
 gdb/testsuite/lib/gdb.exp | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

Comments

Joel Brobecker Dec. 18, 2015, 6:19 p.m. UTC | #1
> This patch adds some documentation to gdb_compile.  It describes the
> various options that can influence compilation.  Most of them are
> handled by DejaGnu, but are not really documented anywhere, so I think
> it's good to have a quick reference.  Not all possible options are
> described, that would add way to much noise.  I chose those that I think
> are relevant in the context of writing a test case.
> 
> gdb/testsuite/ChangeLog:
> 
> 	* lib/gdb.exp (gdb_compile): Add function doc.

Thanks for doing that! Patch looks good to me, so go ahead and push.
Simon Marchi Dec. 18, 2015, 6:41 p.m. UTC | #2
On 15-12-18 01:19 PM, Joel Brobecker wrote:
> Thanks for doing that! Patch looks good to me, so go ahead and push.

Thanks, pushed!
diff mbox

Patch

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index beb97ea..e426ade 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -3297,6 +3297,40 @@  proc gdb_wrapper_init { args } {
 global gdb_saved_set_unbuffered_mode_obj
 set gdb_saved_set_unbuffered_mode_obj ""
 
+# Compile source files specified by SOURCE into a binary of type TYPE at path
+# DEST.  gdb_compile is implemented using DejaGnu's target_compile, so the type
+# parameter and most options are passed directly to it.
+#
+# The type can be one of the following:
+#
+#   - object: Compile into an object file.
+#   - executable: Compile and link into an executable.
+#   - preprocess: Preprocess the source files.
+#   - assembly: Generate assembly listing.
+#
+# The following options are understood and processed by gdb_compile:
+#
+#   - shlib=so_path: Add SO_PATH to the sources, and enable some target-specific
+#     quirks to be able to use shared libraries.
+#   - shlib_load: Link with appropriate libraries to allow the test to
+#     dynamically load libraries at runtime.  For example, on Linux, this adds
+#     -ldl so that the test can use dlopen.
+#   - nowarnings:  Inhibit all compiler warnings.
+#
+# And here are some of the not too obscure options understood by DejaGnu that
+# influence the compilation:
+#
+#   - additional_flags=flag: Add FLAG to the compiler flags.
+#   - libs=library: Add LIBRARY to the libraries passed to the linker.  The
+#     argument can be a file, in which case it's added to the sources, or a
+#     linker flag.
+#   - ldflags=flag: Add FLAG to the linker flags.
+#   - incdir=path: Add PATH to the searched include directories.
+#   - libdir=path: Add PATH to the linker searched directories.
+#   - ada, c++, f77: Compile the file as Ada, C++ or Fortran.
+#   - debug: Build with debug information.
+#   - optimize: Build with optimization
+
 proc gdb_compile {source dest type options} {
     global GDB_TESTCASE_OPTIONS
     global gdb_wrapper_file