* [Newb] Stepping into cc1plus from gcc @ 2004-03-20 9:06 sashan 2004-03-20 11:11 ` Phil Edwards 2004-03-20 11:17 ` [Newb] Stepping into cc1plus from gcc Alexandre Oliva 0 siblings, 2 replies; 13+ messages in thread From: sashan @ 2004-03-20 9:06 UTC (permalink / raw) To: gcc Hi I've been stepping through gcc and I've come the point, in libiberty/pex-unix.c where it forks a new process called cc1plus. I'm guessing this is the C++ compiler that is being called. Anyway I'd like to know how to continue stepping into it. Thanks -- sashan http://www.cs.auckland.ac.nz/~sgov008 ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Newb] Stepping into cc1plus from gcc 2004-03-20 9:06 [Newb] Stepping into cc1plus from gcc sashan @ 2004-03-20 11:11 ` Phil Edwards 2004-03-23 22:47 ` [Newb] Stepping into gnat Sebastian Pop 2004-03-20 11:17 ` [Newb] Stepping into cc1plus from gcc Alexandre Oliva 1 sibling, 1 reply; 13+ messages in thread From: Phil Edwards @ 2004-03-20 11:11 UTC (permalink / raw) To: sashan; +Cc: gcc On Sat, Mar 20, 2004 at 05:11:45PM +1300, sashan wrote: > I've been stepping through gcc and I've come the point, in > libiberty/pex-unix.c where it forks a new process called cc1plus. I'm > guessing this is the C++ compiler that is being called. Yes. > Anyway I'd like > to know how to continue stepping into it. You don't. The way to actually step through the compiler is to run the driver (gcc, g++, etc) with -v on your testcase. It will print the full command line to the compiler, and the arguments passed to it. Run the debugger on /that/ executable, not the driver, and use "set args" as usual to pass the rest of the options. -- Behind everything some further thing is found, forever; thus the tree behind the bird, stone beneath soil, the sun behind Urth. Behind our efforts, let there be found our efforts. - Ascian saying, as related by Loyal to the Group of Seventeen ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Newb] Stepping into gnat 2004-03-20 11:11 ` Phil Edwards @ 2004-03-23 22:47 ` Sebastian Pop 2004-03-24 3:32 ` Laurent GUERBY 0 siblings, 1 reply; 13+ messages in thread From: Sebastian Pop @ 2004-03-23 22:47 UTC (permalink / raw) To: Phil Edwards; +Cc: gcc just curious, what's the debugging procedure for the Ada compiler? Is this already documented somewhere? ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Newb] Stepping into gnat 2004-03-23 22:47 ` [Newb] Stepping into gnat Sebastian Pop @ 2004-03-24 3:32 ` Laurent GUERBY 0 siblings, 0 replies; 13+ messages in thread From: Laurent GUERBY @ 2004-03-24 3:32 UTC (permalink / raw) To: Sebastian Pop; +Cc: Phil Edwards, gcc On Tue, 2004-03-23 at 21:20, Sebastian Pop wrote: > just curious, what's the debugging procedure for the Ada compiler? > > Is this already documented somewhere? gcc/ada/treepr.ads contain Ada tree dump routines useful from gdb. Laurent ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Newb] Stepping into cc1plus from gcc 2004-03-20 9:06 [Newb] Stepping into cc1plus from gcc sashan 2004-03-20 11:11 ` Phil Edwards @ 2004-03-20 11:17 ` Alexandre Oliva 2004-03-20 21:06 ` Andreas Schwab 1 sibling, 1 reply; 13+ messages in thread From: Alexandre Oliva @ 2004-03-20 11:17 UTC (permalink / raw) To: sashan; +Cc: gcc [-- Attachment #1: Type: text/plain, Size: 439 bytes --] On Mar 20, 2004, sashan <sashang@ihug.co.nz> wrote: > I've been stepping through gcc and I've come the point, in > libiberty/pex-unix.c where it forks a new process called cc1plus. I'm > guessing this is the C++ compiler that is being called. Anyway I'd > like to know how to continue stepping into it. Add the attached scripts to your path and run: % debugx cc1plus g++ rest of command line Hmm... Maybe these should be in contrib? [-- Attachment #2: debug --] [-- Type: application/octet-stream, Size: 1815 bytes --] #! /bin/sh # Copyright 1999, 2000, 2001 Alexandre Oliva <oliva@lsd.ic.unicamp.br> # This script is Free Software, and it can be copied, distributed and # modified as defined in the GNU General Public License. A copy of # its license can be downloaded from http://www.gnu.org/copyleft/gpl.html if test $# -lt 1; then echo usage: env DEBUG="<gdb|emacs>" $0 "<program>" args... >&2 exit 1 fi : ${DEBUG=emacs} prog="$1"; shift 1 gdbinitdir=/tmp/.gdbinit.$$ gdbinit=$gdbinitdir/init mkdir $gdbinitdir || { echo directory $gdbinitdir already exists >&2; exit 1; } { echo "shell rm -rf /tmp/.gdbinit.$$" echo "cd `pwd`" arglist= for arg in ${1+"$@"}; do case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac arglist="$arglist $arg" done echo "set args $arglist" } >$gdbinit case `$DEBUG --version </dev/null 2>/dev/null` in "GDB"*|"GNU gdb"*) # start command-line gdb within the correct working directory, # and set up the specified argument list exec $DEBUG -command $gdbinit $prog;; "DDD"*) # start DDD/gdb within the correct working directory, # and set up the specified argument list exec $DEBUG --debugger "${GDB-gdb} -command $gdbinit" $prog;; "GNU Emacs"*) # start gdb within GNU Emacs, move into the current working # directory and set up the specified argument list exec $DEBUG -eval "(progn (gdb \"${GDB-gdb} $prog\") (gud-call \"source $gdbinit\"))";; XEmacs*) # start gdb within XEmacs, move into the current working # directory and set up the specified argument list exec $DEBUG -eval "(progn ${GDB+(setq gdb-command-name \"$GDB\")} (gdb \"$prog\") (gdb-call \"source $gdbinit\"))";; *) echo you must set DEBUG to either emacs or gdb >&2;; esac rm -rf /tmp/.gdbinit.$$ exit 1 [-- Attachment #3: debugx --] [-- Type: application/octet-stream, Size: 903 bytes --] #! /bin/sh # Copyright 1999, 2000, 2001 Alexandre Oliva <oliva@lsd.ic.unicamp.br> # This script is Free Software, and it can be copied, distributed and # modified as defined in the GNU General Public License. A copy of # its license can be downloaded from http://www.gnu.org/copyleft/gpl.html tmp=${TMPDIR-/tmp}/.debug$$ mkdir "$tmp" || exit 1 prog=$1; shift run=$1; shift fullprog=`$run ${1+"$@"} -print-prog-name="$prog"` if test ! -x "$fullprog"; then echo $0: $run cannot find $prog >&2 exit 1 fi cat > "$tmp/$prog" << EOF #! /bin/sh rm -rf "$tmp" case "\$@" in *[\"]*) count=\$# for arg do case \$arg in *[\"]*) set x \${1+"\$@"} \`echo "\$arg" | sed 's,\(["]\),\\\\\\\\\\\\1,g'\`; shift;; *) set x \${1+"\$@"} "\$arg"; shift;; esac done shift \$count ;; esac exec debug "$fullprog" \${1+"\$@"} EOF chmod +x "$tmp/$prog" exec $run -B"$tmp/" ${1+"$@"} -B"$tmp/" [-- Attachment #4: Type: text/plain, Size: 188 bytes --] -- Alexandre Oliva http://www.ic.unicamp.br/~oliva/ Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org} Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org} ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Newb] Stepping into cc1plus from gcc 2004-03-20 11:17 ` [Newb] Stepping into cc1plus from gcc Alexandre Oliva @ 2004-03-20 21:06 ` Andreas Schwab 2004-03-21 18:15 ` Alexandre Oliva 0 siblings, 1 reply; 13+ messages in thread From: Andreas Schwab @ 2004-03-20 21:06 UTC (permalink / raw) To: Alexandre Oliva; +Cc: sashan, gcc Alexandre Oliva <aoliva@redhat.com> writes: > On Mar 20, 2004, sashan <sashang@ihug.co.nz> wrote: > >> I've been stepping through gcc and I've come the point, in >> libiberty/pex-unix.c where it forks a new process called cc1plus. I'm >> guessing this is the C++ compiler that is being called. Anyway I'd >> like to know how to continue stepping into it. > > Add the attached scripts to your path and run: > > % debugx cc1plus g++ rest of command line Try "gdb --args cc1plus ...". Andreas. -- Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux AG, MaxfeldstraÃe 5, 90409 Nürnberg, Germany Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Newb] Stepping into cc1plus from gcc 2004-03-20 21:06 ` Andreas Schwab @ 2004-03-21 18:15 ` Alexandre Oliva 2004-03-21 19:21 ` Andreas Schwab 0 siblings, 1 reply; 13+ messages in thread From: Alexandre Oliva @ 2004-03-21 18:15 UTC (permalink / raw) To: Andreas Schwab; +Cc: sashan, gcc On Mar 20, 2004, Andreas Schwab <schwab@suse.de> wrote: > Alexandre Oliva <aoliva@redhat.com> writes: >> On Mar 20, 2004, sashan <sashang@ihug.co.nz> wrote: >> >>> I've been stepping through gcc and I've come the point, in >>> libiberty/pex-unix.c where it forks a new process called cc1plus. I'm >>> guessing this is the C++ compiler that is being called. Anyway I'd >>> like to know how to continue stepping into it. >> >> Add the attached scripts to your path and run: >> >> % debugx cc1plus g++ rest of command line > Try "gdb --args cc1plus ...". But then you have to know the command line passed to cc1plus. And what if gdb doesn't support --args, or if you want to use emacs and it doesn't support gdb --args? -- Alexandre Oliva http://www.ic.unicamp.br/~oliva/ Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org} Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org} ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Newb] Stepping into cc1plus from gcc 2004-03-21 18:15 ` Alexandre Oliva @ 2004-03-21 19:21 ` Andreas Schwab 2004-03-22 7:43 ` Alexandre Oliva 0 siblings, 1 reply; 13+ messages in thread From: Andreas Schwab @ 2004-03-21 19:21 UTC (permalink / raw) To: Alexandre Oliva; +Cc: sashan, gcc Alexandre Oliva <aoliva@redhat.com> writes: > On Mar 20, 2004, Andreas Schwab <schwab@suse.de> wrote: > >> Alexandre Oliva <aoliva@redhat.com> writes: >>> On Mar 20, 2004, sashan <sashang@ihug.co.nz> wrote: >>> >>>> I've been stepping through gcc and I've come the point, in >>>> libiberty/pex-unix.c where it forks a new process called cc1plus. I'm >>>> guessing this is the C++ compiler that is being called. Anyway I'd >>>> like to know how to continue stepping into it. >>> >>> Add the attached scripts to your path and run: >>> >>> % debugx cc1plus g++ rest of command line > >> Try "gdb --args cc1plus ...". > > But then you have to know the command line passed to cc1plus. And > what if gdb doesn't support --args, or if you want to use emacs and it > doesn't support gdb --args? You don't want to use such an old gdb anyway. Andreas. -- Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux AG, MaxfeldstraÃe 5, 90409 Nürnberg, Germany Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Newb] Stepping into cc1plus from gcc 2004-03-21 19:21 ` Andreas Schwab @ 2004-03-22 7:43 ` Alexandre Oliva 2004-03-22 13:57 ` llewelly 0 siblings, 1 reply; 13+ messages in thread From: Alexandre Oliva @ 2004-03-22 7:43 UTC (permalink / raw) To: Andreas Schwab; +Cc: sashan, gcc On Mar 21, 2004, Andreas Schwab <schwab@suse.de> wrote: > Alexandre Oliva <aoliva@redhat.com> writes: >> But then you have to know the command line passed to cc1plus. And >> what if gdb doesn't support --args, or if you want to use emacs and it >> doesn't support gdb --args? > You don't want to use such an old gdb anyway. But I do want to use gdb within emacs -- Alexandre Oliva http://www.ic.unicamp.br/~oliva/ Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org} Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org} ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Newb] Stepping into cc1plus from gcc 2004-03-22 7:43 ` Alexandre Oliva @ 2004-03-22 13:57 ` llewelly 2004-03-23 11:29 ` Alexandre Oliva 0 siblings, 1 reply; 13+ messages in thread From: llewelly @ 2004-03-22 13:57 UTC (permalink / raw) To: Alexandre Oliva; +Cc: Andreas Schwab, sashan, gcc Alexandre Oliva <aoliva@redhat.com> writes: > On Mar 21, 2004, Andreas Schwab <schwab@suse.de> wrote: > > > Alexandre Oliva <aoliva@redhat.com> writes: > > >> But then you have to know the command line passed to cc1plus. And > >> what if gdb doesn't support --args, or if you want to use emacs and it > >> doesn't support gdb --args? > > > You don't want to use such an old gdb anyway. > > But I do want to use gdb within emacs ok. I have to ask. In emacs I type 'M-x gdb', and it responds: 'Run gdb (like this): gdb ' and I add '--args /usr/local/gcc-3.3.3/lib/gcc-lib/i386-unknown-freebsd5.2/3.3.3/cc1plus ... ' and it works happily. I am using emacs 21.2.1 and gdb 5.2.1 . Does this not work for you? ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Newb] Stepping into cc1plus from gcc 2004-03-22 13:57 ` llewelly @ 2004-03-23 11:29 ` Alexandre Oliva 2004-03-23 12:27 ` Tom Tromey 2004-03-23 12:52 ` sashan 0 siblings, 2 replies; 13+ messages in thread From: Alexandre Oliva @ 2004-03-23 11:29 UTC (permalink / raw) To: llewelly; +Cc: Andreas Schwab, sashan, gcc On Mar 22, 2004, llewelly@xmission.com wrote: > Alexandre Oliva <aoliva@redhat.com> writes: >> On Mar 21, 2004, Andreas Schwab <schwab@suse.de> wrote: >> >> > Alexandre Oliva <aoliva@redhat.com> writes: >> >> >> But then you have to know the command line passed to cc1plus. And >> >> what if gdb doesn't support --args, or if you want to use emacs and it >> >> doesn't support gdb --args? >> >> > You don't want to use such an old gdb anyway. >> >> But I do want to use gdb within emacs > ok. I have to ask. In emacs I type 'M-x gdb', and it responds: > 'Run gdb (like this): gdb ' and I add > '--args /usr/local/gcc-3.3.3/lib/gcc-lib/i386-unknown-freebsd5.2/3.3.3/cc1plus ... ' > and it works happily. I am using emacs 21.2.1 and gdb 5.2.1 . > Does this not work for you? If you know the arguments to pass to cc1plus, yes, it does. The point of debugx is to be able to run a `gcc -c -flags ...' and get a debugger attached to cc1 or cc1plus, with the right command line. -- Alexandre Oliva http://www.ic.unicamp.br/~oliva/ Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org} Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org} ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Newb] Stepping into cc1plus from gcc 2004-03-23 11:29 ` Alexandre Oliva @ 2004-03-23 12:27 ` Tom Tromey 2004-03-23 12:52 ` sashan 1 sibling, 0 replies; 13+ messages in thread From: Tom Tromey @ 2004-03-23 12:27 UTC (permalink / raw) To: Alexandre Oliva; +Cc: Andreas Schwab, sashan, gcc >>>>> "Alexandre" == Alexandre Oliva <aoliva@redhat.com> writes: Alexandre> If you know the arguments to pass to cc1plus, yes, it does. Alexandre> The point of debugx is to be able to run a `gcc -c -flags Alexandre> ...' and get a debugger attached to cc1 or cc1plus, with Alexandre> the right command line. Cute. I've long meant to add an option to gcc like "--debug jc1" that would cause it to launch the appropriate sub-process with "gdb --args". Still haven't gotten around to it... but maybe there's no need with your programs around. Tom ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Newb] Stepping into cc1plus from gcc 2004-03-23 11:29 ` Alexandre Oliva 2004-03-23 12:27 ` Tom Tromey @ 2004-03-23 12:52 ` sashan 1 sibling, 0 replies; 13+ messages in thread From: sashan @ 2004-03-23 12:52 UTC (permalink / raw) To: gcc > >If you know the arguments to pass to cc1plus, yes, it does. > >The point of debugx is to be able to run a `gcc -c -flags ...' and get >a debugger attached to cc1 or cc1plus, with the right command line. > > > I've found the scripts useful. Thanks -- sashan http://www.cs.auckland.ac.nz/~sgov008/ ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2004-03-23 20:50 UTC | newest] Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2004-03-20 9:06 [Newb] Stepping into cc1plus from gcc sashan 2004-03-20 11:11 ` Phil Edwards 2004-03-23 22:47 ` [Newb] Stepping into gnat Sebastian Pop 2004-03-24 3:32 ` Laurent GUERBY 2004-03-20 11:17 ` [Newb] Stepping into cc1plus from gcc Alexandre Oliva 2004-03-20 21:06 ` Andreas Schwab 2004-03-21 18:15 ` Alexandre Oliva 2004-03-21 19:21 ` Andreas Schwab 2004-03-22 7:43 ` Alexandre Oliva 2004-03-22 13:57 ` llewelly 2004-03-23 11:29 ` Alexandre Oliva 2004-03-23 12:27 ` Tom Tromey 2004-03-23 12:52 ` sashan
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).