|
From: <sv...@va...> - 2006-10-01 17:49:38
|
Author: sewardj
Date: 2006-10-01 18:49:33 +0100 (Sun, 01 Oct 2006)
New Revision: 6126
Log:
New option --sym-offsets=3Dyes|no [no], which causes all symbols to be
shown in the form 'name+offset'. Mostly useful for debugging Valgrind
itself.
Also move command-line-error functions from m_main into m_options.
Modified:
branches/AIX5/coregrind/m_options.c
branches/AIX5/coregrind/pub_core_options.h
branches/AIX5/include/pub_tool_options.h
Modified: branches/AIX5/coregrind/m_options.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/coregrind/m_options.c 2006-10-01 17:45:35 UTC (rev 6125=
)
+++ branches/AIX5/coregrind/m_options.c 2006-10-01 17:49:33 UTC (rev 6126=
)
@@ -31,6 +31,8 @@
=20
#include "pub_core_basics.h"
#include "pub_core_options.h"
+#include "pub_core_libcassert.h"
+#include "pub_core_libcprint.h"
=20
// See pub_{core,tool}_options.h for explanations of all these.
=20
@@ -68,6 +70,7 @@
Int VG_(clo_dump_error) =3D 0;
Int VG_(clo_backtrace_size) =3D 12;
Char* VG_(clo_sim_hints) =3D NULL;
+Bool VG_(clo_sym_offsets) =3D False;
Bool VG_(clo_run_libc_freeres) =3D True;
Bool VG_(clo_track_fds) =3D False;
Bool VG_(clo_show_below_main)=3D False;
@@ -79,6 +82,41 @@
HChar* VG_(clo_kernel_variant) =3D NULL;
=20
=20
+/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/
+/*=3D=3D=3D Command line errors =
=3D=3D=3D*/
+/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/
+
+static void revert_to_stderr ( void )
+{
+ vg_assert( !VG_(logging_to_socket) );
+ VG_(clo_log_fd) =3D 2; /* stderr */
+}
+
+void VG_(err_bad_option) ( Char* opt )
+{
+ revert_to_stderr();
+ VG_(printf)("valgrind: Bad option '%s'; aborting.\n", opt);
+ VG_(printf)("valgrind: Use --help for more information.\n");
+ VG_(exit)(1);
+}
+
+void VG_(err_missing_prog) ( void )
+{
+ revert_to_stderr();
+ VG_(printf)("valgrind: no program specified\n");
+ VG_(printf)("valgrind: Use --help for more information.\n");
+ VG_(exit)(1);
+}
+
+void VG_(err_config_error) ( Char* msg )
+{
+ revert_to_stderr();
+ VG_(printf)("valgrind: Startup or configuration error:\n %s\n", msg=
);
+ VG_(printf)("valgrind: Unable to start up properly. Giving up.\n");
+ VG_(exit)(1);
+}
+
+
/*--------------------------------------------------------------------*/
/*--- end m_options.c ---*/
/*--------------------------------------------------------------------*/
Modified: branches/AIX5/coregrind/pub_core_options.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/coregrind/pub_core_options.h 2006-10-01 17:45:35 UTC (r=
ev 6125)
+++ branches/AIX5/coregrind/pub_core_options.h 2006-10-01 17:49:33 UTC (r=
ev 6126)
@@ -127,6 +127,8 @@
extern Int VG_(clo_backtrace_size);
/* Engage miscellaneous weird hacks needed for some progs. */
extern Char* VG_(clo_sim_hints);
+/* Show symbols in the form 'name+offset' ? Default: NO */
+extern Bool VG_(clo_sym_offsets);
=20
/* Track open file descriptors? */
extern Bool VG_(clo_track_fds);
Modified: branches/AIX5/include/pub_tool_options.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/include/pub_tool_options.h 2006-10-01 17:45:35 UTC (rev=
6125)
+++ branches/AIX5/include/pub_tool_options.h 2006-10-01 17:49:33 UTC (rev=
6126)
@@ -75,15 +75,24 @@
XML output, in between <usercomment> tags. */
extern HChar* VG_(clo_xml_user_comment);
=20
-/* Call this if a recognised option was bad for some reason.
- Note: don't use it just because an option was unrecognised -- return =
'False'
- from VG_(tdict).tool_process_cmd_line_option) to indicate that. */
-extern void VG_(bad_option) ( Char* opt );
-
/* Vex iropt control. Tool-visible so tools can make Vex optimise
less aggressively if that is needed (callgrind needs this). */
extern VexControl VG_(clo_vex_control);
=20
+/* Call this if a recognised option was bad for some reason. Note:
+ don't use it just because an option was unrecognised -- return
+ 'False' from VG_(tdict).tool_process_cmd_line_option) to indicate
+ that. This function prints an error message, then shuts down the
+ entire system. */
+extern void VG_(err_bad_option) ( Char* opt );
+
+/* Similarly - complain that the executable is missing, then stop. */
+extern void VG_(err_missing_prog) ( void );
+
+/* Similarly - complain about some config error. */
+extern void VG_(err_config_error) ( Char* msg );
+
+
#endif // __PUB_TOOL_OPTIONS_H
=20
/*--------------------------------------------------------------------*/
|