Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting -g3 is not trivial #12067

Open
p5pRT opened this issue Apr 19, 2012 · 6 comments
Open

Setting -g3 is not trivial #12067

p5pRT opened this issue Apr 19, 2012 · 6 comments

Comments

@p5pRT
Copy link

p5pRT commented Apr 19, 2012

Migrated from rt.perl.org#112536 (status was 'open')

Searchable as RT112536$

@p5pRT
Copy link
Author

p5pRT commented Apr 19, 2012

From @ruz

Created by ruz@new-mac.local

Wanted to compile perl with -g3 flag to enable macros expanding
in GDB. According to INSTALL document​:

  =item -DEBUGGING=-g

  =item -Doptimize=-g

  Adds -g to optimize, but does not set -DDEBUGGING.

  (Note​: Your system may actually require something like cc -g2.
  Check your man pages for cc(1) and also any hint file for your system.)

This note made me believe that I can set -DEBUGGING=-g3 and it will work,
but it failed. I've tried a combinations using -Accflags and -DDEBUGGING.
It was a mess. Ended up looking into Configure script to figure it out.

Final variant that worked for me​:

  -Doptimize='-O3 -g3' -DEBUGGING

So it has two disadvantages​: 1) you have to know or struggle 2) have to
repeat default value (-O3).

Perl Info

Flags:
    category=install
    severity=low

Site configuration information for perl 5.15.9:

Configured by ruz at Thu Apr 19 13:44:09 GET 2012.

Summary of my perl5 (revision 5 version 15 subversion 9) configuration:
  Local Commit: 72fe21782afa1cae1beef02d6a0216ed4c9c5e6a
  Ancestor: 1a15d16d8ab308fc4f99063c180391a513f81fdb
  Platform:
    osname=darwin, osvers=10.8.0, archname=darwin-thread-multi-2level
    uname='darwin new-mac.local 10.8.0 darwin kernel version 10.8.0:
tue jun 7 16:33:36 pdt 2011; root:xnu-1504.15.3~1release_i386 i386
i386 macbook7,1 darwin '
    config_args='-des -Dprefix=/Users/ruz/perl/blead -Dusedevel
-Doptimize=-O3 -g3 -DEBUGGING -Dusemymalloc -Dusethreads
-Dinc_version_list=none'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=y, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fno-common -DPERL_DARWIN -DDEBUGGING
-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include
-I/opt/local/include',
    optimize='-O3 -g3',
    cppflags='-fno-common -DPERL_DARWIN -DDEBUGGING
-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include
-I/opt/local/include'
    ccversion='', gccversion='4.2.1 (Gentoo 4.2.1_p5666, Apple Inc.
build 5666) (dot 3)', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags ='
-fstack-protector -L/usr/local/lib -L/opt/local/lib'
    libpth=/usr/local/lib /opt/local/lib /usr/lib
    libs=-lgdbm -ldbm -ldl -lm -lutil -lc
    perllibs=-ldl -lm -lutil -lc
    libc=, so=dylib, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup
-L/usr/local/lib -L/opt/local/lib -fstack-protector'

Locally applied patches:



@INC for perl 5.15.9:
    /Users/ruz/perl/blead/lib/site_perl/5.15.9/darwin-thread-multi-2level
    /Users/ruz/perl/blead/lib/site_perl/5.15.9
    /Users/ruz/perl/blead/lib/5.15.9/darwin-thread-multi-2level
    /Users/ruz/perl/blead/lib/5.15.9
    .


Environment for perl 5.15.9:
    DYLD_LIBRARY_PATH=/opt/oracle/instantclient_10_2_64bit/:
    HOME=/Users/ruz
    LANG=ru_RU.UTF-8
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/Users/ruz/bin:/opt/local/bin:/opt/local/sbin:/opt/portage/usr/sbin:/opt/portage/usr/bin:/opt/portage/sbin:/opt/portage/bin:/opt/portage/usr/local/bin/:/opt/portage/opt/bin:/opt/portage/usr/sbin:/opt/portage/sbin:/opt/portage/usr/x86_64-apple-darwin10/gcc-bin/4.2.1:/opt/local/usr/sbin:/opt/local/usr/bin:/opt/local/sbin:/opt/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/bin:/usr/X11/bin:/Users/ruz/.perl6/bin:/Users/ruz/projs/perl6/rakudo/install/bin
    PERL_BADLANG (unset)
    SHELL=/opt/portage/bin/bash

-- 
Best regards, Ruslan.

@p5pRT
Copy link
Author

p5pRT commented Apr 22, 2012

From @Tux

On Thu, 19 Apr 2012 03​:56​:35 -0700, Ruslan Zakirov (via RT)
<perlbug-followup@​perl.org> wrote​:

Wanted to compile perl with -g3 flag to enable macros expanding
in GDB. According to INSTALL document​:

=item \-DEBUGGING=\-g

=item \-Doptimize=\-g

Adds \-g to optimize\, but does not set \-DDEBUGGING\.

\(Note&#8203;:  Your system may actually require something like cc \-g2\.
Check your man pages for cc\(1\) and also any hint file for your system\.\)

This note made me believe that I can set -DEBUGGING=-g3 and it will work,
but it failed. I've tried a combinations using -Accflags and -DDEBUGGING.
It was a mess. Ended up looking into Configure script to figure it out.

I never thought of additional digits when allowing that. I could extend
the current behavior to do so if p5p thinks that is sane.

: Check what DEBUGGING is required from the command line
: -DEBUGGING or -DDEBUGGING or
: -DEBUGGING=both = -g + -DDEBUGGING
: -DEBUGGING=-g or -Doptimize=-g = -g
: -DEBUGGING=none or -UDEBUGGING =
: -DEBUGGING=old or -DEBUGGING=default = ? $optimize

Final variant that worked for me​:

\-Doptimize='\-O3 \-g3' \-DEBUGGING

So it has two disadvantages​: 1) you have to know or struggle 2) have to
repeat default value (-O3).

--
H.Merijn Brand http​://tux.nl Perl Monger http​://amsterdam.pm.org/
using perl5.00307 .. 5.14 porting perl5 on HP-UX, AIX, and openSUSE
http​://mirrors.develooper.com/hpux/ http​://www.test-smoke.org/
http​://qa.perl.org http​://www.goldmark.org/jeff/stupid-disclaimers/

@p5pRT
Copy link
Author

p5pRT commented Apr 22, 2012

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Apr 23, 2012

From @Leont

On Sun, Apr 22, 2012 at 12​:05 PM, H.Merijn Brand <h.m.brand@​xs4all.nl> wrote​:

I never thought of additional digits when allowing that. I could extend
the current behavior to do so if p5p thinks that is sane.

If you do that, don't forget to allow -ggdb3 and similar too too.

Leon

@p5pRT
Copy link
Author

p5pRT commented Apr 24, 2012

From @nwc10

On Mon, Apr 23, 2012 at 01​:39​:49PM +0200, Leon Timmermans wrote​:

On Sun, Apr 22, 2012 at 12​:05 PM, H.Merijn Brand <h.m.brand@​xs4all.nl> wrote​:

I never thought of additional digits when allowing that. I could extend
the current behavior to do so if p5p thinks that is sane.

If you do that, don't forget to allow -ggdb3 and similar too too.

Seems sane to me. At least, I can't think of anything it might be confused
with.

Is there a "list" of "similar too"? Or do we assume that anything
/^-g[a-z0-9][-+a-z0-9]*$/ is valid?

(ie is there a counter-example of a compiler flag starting -g that isn't
about debugging, and would be confusing to add here)

Nicholas Clark

@p5pRT
Copy link
Author

p5pRT commented Apr 24, 2012

From ruz@bestpractical.com

On Tue, Apr 24, 2012 at 15​:22, Nicholas Clark <nick@​ccl4.org> wrote​:

On Mon, Apr 23, 2012 at 01​:39​:49PM +0200, Leon Timmermans wrote​:

On Sun, Apr 22, 2012 at 12​:05 PM, H.Merijn Brand <h.m.brand@​xs4all.nl> wrote​:

I never thought of additional digits when allowing that. I could extend
the current behavior to do so if p5p thinks that is sane.

If you do that, don't forget to allow -ggdb3 and similar too too.

Seems sane to me. At least, I can't think of anything it might be confused
with.

Is there a "list" of "similar too"? Or do we assume that anything
/^-g[a-z0-9][-+a-z0-9]*$/ is valid?

I don't think so, but as I recall it's possible that you need
-gdwarf-2 -g3. Also, primary problem with instructions in INSTALL is
that those doesn't cover all possible cases. I wanted to compile
variant with -DDEBUGGING set and -gLevel adjusted to get macros
expansion in GDB. Even if you extended -DDEBUGGING option with -gXXX
support then it's still open question on how to set -DDEBUGGING for
perl itself.

May be the following is better​:

-Aoptimize=-g3 -DEBUGGING

It probably works and you don't have to repeate -O3 flag in optimize.
If optimize option is properly described then there is no need in
-DEBUGGING=-g and =both variants. For backwards compatibility
-DDEBUGGING may add -g to optimize unless there -g* and -UDEBUGGING or
=none variant can delete all -g* flags from optimize.

(ie is there a counter-example of a compiler flag starting -g that isn't
about debugging, and would be confusing to add here)

Nicholas Clark

--
Best regards, Ruslan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants