Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

GDB pretty printers should be optional #777

Open
Whiteknight opened this Issue · 2 comments

3 participants

@Whiteknight

In #92 we added pretty printers written in Python for debugging with GDB. These things are fine and good for most cases, but frequently (especially when debugging issues related to string and pmc internals) I find that these things are more of a hassle than a benefit and sometimes I want to look at the raw, unpretty output directly.

In short, I want a way to turn these things off.

The easiest way I can think of is to add a command-line argument to Configure.pl, --no-pretty-debug or something like that, to remove those lines from the makefile. Or, we can remove those things entirely from the main makefile target and instead add a separate gdb-pretty-print make target to build them if desired.

@leto
Owner

It seems very reasonable to be able to turn these off. Should they be default? Which behavior is less surprising?

@jkeenan
Owner

Please review the 777/no_pretty_debug branch. Here is a cumulative diff:

diff --git a/config/gen/makefiles/root.in b/config/gen/makefiles/root.in
index 1cca180..6a5109b 100644
--- a/config/gen/makefiles/root.in
+++ b/config/gen/makefiles/root.in
@@ -639,6 +639,7 @@ all : \
 #IF(has_dynamic_linking):    $(DYNOPLIBS_TARGETS) \
 #IF(has_dynamic_linking):    $(LIBNCI_TEST_SO) \
    $(GEN_LIBRARY) \
+   select_pretty_debug \
    src/install_config$(O)

 corevm : \
@@ -1085,9 +1086,6 @@ $(LIBPARROT_SHARED) : $(O_FILES)
        $(O_FILES) $(C_LIBS) $(ICU_SHARED)
 #IF(win32):    if exist $@.manifest mt.exe -nologo -manifest $@.manifest -outputresource:$@;2
 #IF(libparrot_shared_alias):   ( cd @blib_dir@ ; ln -sf @libparrot_shared@ @libparrot_shared_alias@ )
-   $(CP) tools/dev/gdb-pp-load.py @blib_dir@/@libparrot_shared@-gdb.py
-   $(CP) tools/dev/gdb-pp.py @blib_dir@/GDBPrettyPrint.py
-   @echo '' > @blib_dir@/__init__.py

 $(INSTALLABLECONFIG) : src/install_config$(O) $(PARROT_CONFIG) $(PBC_TO_EXE)
    $(PARROT) -o parrot_config.pbc $(DEV_TOOLS_DIR)/parrot-config.pir
@@ -2053,6 +2051,10 @@ pdf:
 pdf-clean:
    $(MAKE_C) docs pdf-clean

+select_pretty_debug : $(LIBPARROT_SHARED)
+#IF(no_pretty_debug):  @echo "Pretty debugging output has explicitly been declined."
+#ELSE: $(CP) tools/dev/gdb-pp-load.py @blib_dir@/@libparrot_shared@-gdb.py && $(CP) tools/dev/gdb-pp.py @blib_dir@/GDBPrettyPrint.py && echo '' > @blib_dir@/__init__.py
+
 ###############################################################################
 #
 # compiler implementation targets:
diff --git a/config/init/defaults.pm b/config/init/defaults.pm
index 96d5f62..1f1bd29 100644
--- a/config/init/defaults.pm
+++ b/config/init/defaults.pm
@@ -89,6 +89,7 @@ sub runstep {
         optimize  => '',
         verbose   => $conf->options->get('verbose'),
         build_dir => $build_dir,
+        no_pretty_debug => $conf->options->get('no-pretty-debug'),
         configured_from_file =>
             $conf->options->get('configured_from_file') || '',
         configuration_steps => ( join q{ } => $conf->get_list_of_steps() ),
diff --git a/lib/Parrot/Configure/Options/Conf/Shared.pm b/lib/Parrot/Configure/Options/Conf/Shared.pm
index 7483958..bb820a5 100644
--- a/lib/Parrot/Configure/Options/Conf/Shared.pm
+++ b/lib/Parrot/Configure/Options/Conf/Shared.pm
@@ -54,6 +54,7 @@ our @shared_valid_options = qw{
     mandir
     nomanicheck
     no-line-directives
+    no-pretty-debug
     oldincludedir
     opcode
     ops

There are two issues for code review.

First, I have proceeded on the assumption that Parrot's current default behavior -- to implement GDB pretty-printing -- should continue to be default. That implies that pretty-printing will have to be explicitly turned off with command-line option --no-pretty-debug.

Second, my knowledge of makefiles is very much trial-and-error. There may be more elegant ways to code the template in config/gen/makefiles/root.in. As a corollary, I should note that this has been tested only with this version of make:

$ make --version
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i486-pc-linux-gnu

Thank you very much.
Jim Keenan

@jkeenan jkeenan was assigned
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.