* more robust get_compiler_info
@ 2004-02-05 12:34 Michael Elizabeth Chastain
2004-02-05 15:03 ` Daniel Jacobowitz
2004-02-05 15:26 ` Andrew Cagney
0 siblings, 2 replies; 7+ messages in thread
From: Michael Elizabeth Chastain @ 2004-02-05 12:34 UTC (permalink / raw)
To: brobecker, gdb-patches
Joel, can you try this patch?
It works for me on native i686-pc-linux-gnu and native
hppa2.0w-hp-hpux11.11. I also gaffed my hpux machine so that the test
suite finds a C compiler but not a C++ compiler, to exercise the
"unknown" path. That works too.
If you don't have any problems with this patch, then I will submit it
in a day or two.
Michael C
2004-02-05 Michael Chastain <mec.gnu@mindspring.com>
* lib/gdb.exp (get_compiler_info): Eval lines only if they are
'set' commands. Log diagnostics for other lines.
Index: gdb.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.45
diff -c -3 -p -r1.45 gdb.exp
*** gdb.exp 2 Feb 2004 21:14:33 -0000 1.45
--- gdb.exp 5 Feb 2004 09:25:04 -0000
*************** proc get_compiler_info {binfile args} {
*** 1186,1200 ****
set cppout [ gdb_compile "${ifile}" "" preprocess [list "$args" quiet] ]
log_file -a "$outdir/$tool.log"
! # Source the output.
foreach cppline [ split "$cppout" "\n" ] {
! if { ! [ regexp "^#" "$cppline" ] } {
! if { ! [ regexp "^\[\n\r\t \]*$" "$cppline" ] } {
! verbose "get_compiler_info: $cppline" 2
! eval "$cppline"
! }
}
}
verbose -log "get_compiler_info: $compiler_info"
# Most compilers will evaluate comparisons and other boolean
--- 1186,1219 ----
set cppout [ gdb_compile "${ifile}" "" preprocess [list "$args" quiet] ]
log_file -a "$outdir/$tool.log"
! # Eval the output.
! set unknown 0
foreach cppline [ split "$cppout" "\n" ] {
! if { [ regexp "^#" "$cppline" ] } {
! # line marker
! } elseif { [ regexp "^\[\n\r\t \]*$" "$cppline" ] } {
! # blank line
! } elseif { [ regexp "^\[\n\r\t \]*set\[\n\r\t \]" "$cppline" ] } {
! # eval this line
! verbose "get_compiler_info: $cppline" 2
! eval "$cppline"
! } else {
! # unknown line
! verbose -log "get_compiler_info: $cppline"
! set unknown 1
}
}
+
+ # Reset to unknown compiler if any diagnostics happened.
+ if { $unknown } {
+ set compiler_info "unknown"
+ set gcc_compiled 0
+ set hp_cc_compiler 0
+ set hp_ACC_compiler 0
+ set signed_keyword_not_used 0
+ }
+
+ # Log what happened.
verbose -log "get_compiler_info: $compiler_info"
# Most compilers will evaluate comparisons and other boolean
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: more robust get_compiler_info
2004-02-05 12:34 more robust get_compiler_info Michael Elizabeth Chastain
@ 2004-02-05 15:03 ` Daniel Jacobowitz
2004-02-05 15:26 ` Andrew Cagney
1 sibling, 0 replies; 7+ messages in thread
From: Daniel Jacobowitz @ 2004-02-05 15:03 UTC (permalink / raw)
To: gdb-patches
On Thu, Feb 05, 2004 at 07:34:48AM -0500, Michael Chastain wrote:
> + set hp_ACC_compiler 0
Not sure how much it matters but... the variable is hp_aCC_compiler, I
believe.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: more robust get_compiler_info
2004-02-05 12:34 more robust get_compiler_info Michael Elizabeth Chastain
2004-02-05 15:03 ` Daniel Jacobowitz
@ 2004-02-05 15:26 ` Andrew Cagney
1 sibling, 0 replies; 7+ messages in thread
From: Andrew Cagney @ 2004-02-05 15:26 UTC (permalink / raw)
To: Michael Elizabeth Chastain; +Cc: brobecker, gdb-patches
Michael, just a thought.
Rather than having all of:
> + set compiler_info
> + set gcc_compiled
> + set hp_cc_compiler
> + set hp_ACC_compiler
inside the file that is put CC, can instead just compiler_info be set.
The rest can then be set using that value. It would, if nothing else,
let us more quickly know if compiler_info isn't correct.
Andrew
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: more robust get_compiler_info
2004-02-05 23:13 Michael Elizabeth Chastain
2004-02-06 18:33 ` Andrew Cagney
@ 2004-02-07 3:02 ` Joel Brobecker
1 sibling, 0 replies; 7+ messages in thread
From: Joel Brobecker @ 2004-02-07 3:02 UTC (permalink / raw)
To: Michael Elizabeth Chastain; +Cc: cagney, gdb-patches
> Sounds good to me. I will give it a whirl.
>
> Here is the new patch, not tested yet, not even a ChangeLog entry.
I tried it on alpha-tru64, and that solved the abort. With ambiguous.exp
for instance, I now get the following output:
<<
Running ./gdb.cp/ambiguous.exp ...
gdb compile failed, default_target_compile: Can't find g++.
WARNING: Testcase compile failed, so all tests in this file will automatically fail.
ERROR: (timeout) GDB never initialized after 10 seconds.
WARNING: remote_expect statement without a default case?!
ERROR: couldn't load /usr/prague.a/brobecke/next_pb/gdb-public/gdb/testsuite/gdb.cp/ambiguous into /usr/prague.a/brobecke/next_pb/gdb-public/gdb/testsuite/../../gdb/gdb (end of file).
ERROR: Delete all breakpoints in delete_breakpoints (timeout)
ERROR: couldn't run to breakpoint
>>
Thanks!
--
Joel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: more robust get_compiler_info
2004-02-05 23:13 Michael Elizabeth Chastain
@ 2004-02-06 18:33 ` Andrew Cagney
2004-02-07 3:02 ` Joel Brobecker
1 sibling, 0 replies; 7+ messages in thread
From: Andrew Cagney @ 2004-02-06 18:33 UTC (permalink / raw)
To: Michael Elizabeth Chastain; +Cc: brobecker, gdb-patches
> ac> ... can instead just compiler_info be set.
>
> Sounds good to me. I will give it a whirl.
>
> Here is the new patch, not tested yet, not even a ChangeLog entry.
>
> Michael C
>
> ===
>
> Index: lib/compiler.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/testsuite/lib/compiler.c,v
> retrieving revision 1.3
> diff -c -3 -p -r1.3 compiler.c
> *** lib/compiler.c 24 Jan 2004 21:59:03 -0000 1.3
> --- lib/compiler.c 5 Feb 2004 23:11:00 -0000
> ***************
> *** 34,60 ****
>
> TODO: purge signed_keyword_not_used. */
>
> ! set compiler_info ""
>
> #if defined (__GNUC__)
> set compiler_info [join {gcc __GNUC__ __GNUC_MINOR__ } -]
> - set gcc_compiled __GNUC__
> - #else
> - set gcc_compiled 0
> #endif
>
> #if defined (__HP_cc)
> set compiler_info [join {hpcc __HP_cc} -]
> - set hp_cc_compiler __HP_cc
> - #else
> - set hp_cc_compiler 0
> #endif
>
> #if defined (__HP_aCC)
> set compiler_info [join {hpacc __HP_aCC} -]
> - set hp_aCC_compiler __HP_aCC
> - #else
> - set hp_aCC_compiler 0
> #endif
Already like it :-)
Andrew
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: more robust get_compiler_info
@ 2004-02-05 23:13 Michael Elizabeth Chastain
2004-02-06 18:33 ` Andrew Cagney
2004-02-07 3:02 ` Joel Brobecker
0 siblings, 2 replies; 7+ messages in thread
From: Michael Elizabeth Chastain @ 2004-02-05 23:13 UTC (permalink / raw)
To: cagney, mec.gnu; +Cc: brobecker, gdb-patches
ac> ... can instead just compiler_info be set.
Sounds good to me. I will give it a whirl.
Here is the new patch, not tested yet, not even a ChangeLog entry.
Michael C
===
Index: lib/compiler.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/compiler.c,v
retrieving revision 1.3
diff -c -3 -p -r1.3 compiler.c
*** lib/compiler.c 24 Jan 2004 21:59:03 -0000 1.3
--- lib/compiler.c 5 Feb 2004 23:11:00 -0000
***************
*** 34,60 ****
TODO: purge signed_keyword_not_used. */
! set compiler_info ""
#if defined (__GNUC__)
set compiler_info [join {gcc __GNUC__ __GNUC_MINOR__ } -]
- set gcc_compiled __GNUC__
- #else
- set gcc_compiled 0
#endif
#if defined (__HP_cc)
set compiler_info [join {hpcc __HP_cc} -]
- set hp_cc_compiler __HP_cc
- #else
- set hp_cc_compiler 0
#endif
#if defined (__HP_aCC)
set compiler_info [join {hpacc __HP_aCC} -]
- set hp_aCC_compiler __HP_aCC
- #else
- set hp_aCC_compiler 0
#endif
/* gdb.base/whatis.exp still uses this */
--- 34,51 ----
TODO: purge signed_keyword_not_used. */
! set compiler_info "unknown"
#if defined (__GNUC__)
set compiler_info [join {gcc __GNUC__ __GNUC_MINOR__ } -]
#endif
#if defined (__HP_cc)
set compiler_info [join {hpcc __HP_cc} -]
#endif
#if defined (__HP_aCC)
set compiler_info [join {hpacc __HP_aCC} -]
#endif
/* gdb.base/whatis.exp still uses this */
Index: lib/compiler.cc
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/compiler.cc,v
retrieving revision 1.5
diff -c -3 -p -r1.5 compiler.cc
*** lib/compiler.cc 24 Jan 2004 21:59:03 -0000 1.5
--- lib/compiler.cc 5 Feb 2004 23:11:00 -0000
***************
*** 22,48 ****
/* This file is exactly like compiler.c. I could just use compiler.c if
I could be sure that every C++ compiler accepted extensions of ".c". */
! set compiler_info ""
#if defined (__GNUC__)
set compiler_info [join {gcc __GNUC__ __GNUC_MINOR__ } -]
- set gcc_compiled __GNUC__
- #else
- set gcc_compiled 0
#endif
#if defined (__HP_cc)
set compiler_info [join {hpcc __HP_cc} -]
- set hp_cc_compiler __HP_cc
- #else
- set hp_cc_compiler 0
#endif
#if defined (__HP_aCC)
set compiler_info [join {hpacc __HP_aCC} -]
- set hp_aCC_compiler __HP_aCC
- #else
- set hp_aCC_compiler 0
#endif
/* gdb.base/whatis.exp still uses this */
--- 22,39 ----
/* This file is exactly like compiler.c. I could just use compiler.c if
I could be sure that every C++ compiler accepted extensions of ".c". */
! set compiler_info "unknown"
#if defined (__GNUC__)
set compiler_info [join {gcc __GNUC__ __GNUC_MINOR__ } -]
#endif
#if defined (__HP_cc)
set compiler_info [join {hpcc __HP_cc} -]
#endif
#if defined (__HP_aCC)
set compiler_info [join {hpacc __HP_aCC} -]
#endif
/* gdb.base/whatis.exp still uses this */
Index: lib/gdb.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.45
diff -c -3 -p -r1.45 gdb.exp
*** lib/gdb.exp 2 Feb 2004 21:14:33 -0000 1.45
--- lib/gdb.exp 5 Feb 2004 23:11:00 -0000
*************** proc get_compiler_info {binfile args} {
*** 1169,1178 ****
# These come from compiler.c or compiler.cc
global compiler_info
global gcc_compiled
global hp_cc_compiler
global hp_aCC_compiler
- global signed_keyword_not_used
# Choose which file to preprocess.
set ifile "${srcdir}/lib/compiler.c"
--- 1169,1180 ----
# These come from compiler.c or compiler.cc
global compiler_info
+ global signed_keyword_not_used
+
+ # Legacy global data symbols.
global gcc_compiled
global hp_cc_compiler
global hp_aCC_compiler
# Choose which file to preprocess.
set ifile "${srcdir}/lib/compiler.c"
*************** proc get_compiler_info {binfile args} {
*** 1186,1200 ****
set cppout [ gdb_compile "${ifile}" "" preprocess [list "$args" quiet] ]
log_file -a "$outdir/$tool.log"
! # Source the output.
foreach cppline [ split "$cppout" "\n" ] {
! if { ! [ regexp "^#" "$cppline" ] } {
! if { ! [ regexp "^\[\n\r\t \]*$" "$cppline" ] } {
! verbose "get_compiler_info: $cppline" 2
! eval "$cppline"
! }
}
}
verbose -log "get_compiler_info: $compiler_info"
# Most compilers will evaluate comparisons and other boolean
--- 1188,1229 ----
set cppout [ gdb_compile "${ifile}" "" preprocess [list "$args" quiet] ]
log_file -a "$outdir/$tool.log"
! # Eval the output.
! set unknown 0
foreach cppline [ split "$cppout" "\n" ] {
! if { [ regexp "^#" "$cppline" ] } {
! # line marker
! } elseif { [ regexp "^\[\n\r\t \]*$" "$cppline" ] } {
! # blank line
! } elseif { [ regexp "^\[\n\r\t \]*set\[\n\r\t \]" "$cppline" ] } {
! # eval this line
! verbose "get_compiler_info: $cppline" 2
! eval "$cppline"
! } else {
! # unknown line
! verbose -log "get_compiler_info: $cppline"
! set unknown 1
}
}
+
+ # Reset to unknown compiler if any diagnostics happened.
+ if { $unknown } {
+ set compiler_info "unknown"
+ set signed_keyword_not_used 0
+ }
+
+ # Set the legacy symbols.
+ set gcc_compiled 0
+ set hp_cc_compiler 0
+ set hp_aCC_compiler 0
+ if { [regexp "^gcc-1-" "$compiler_info" ] } { set gcc_compiled 1 }
+ if { [regexp "^gcc-2-" "$compiler_info" ] } { set gcc_compiled 2 }
+ if { [regexp "^gcc-3-" "$compiler_info" ] } { set gcc_compiled 3 }
+ if { [regexp "^gcc-4-" "$compiler_info" ] } { set gcc_compiled 4 }
+ if { [regexp "^hpcc-" "$compiler_info" ] } { set hp_cc_compiler 1 }
+ if { [regexp "^hpacc-" "$compiler_info" ] } { set hp_aCC_compiler 1 }
+
+ # Log what happened.
verbose -log "get_compiler_info: $compiler_info"
# Most compilers will evaluate comparisons and other boolean
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: more robust get_compiler_info
@ 2004-02-05 22:53 Michael Elizabeth Chastain
0 siblings, 0 replies; 7+ messages in thread
From: Michael Elizabeth Chastain @ 2004-02-05 22:53 UTC (permalink / raw)
To: drow, gdb-patches
drow> Not sure how much it matters but... the variable is hp_aCC_compiler, I
drow> believe.
Urgl, right you are.
Michael C
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2004-02-07 3:02 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-05 12:34 more robust get_compiler_info Michael Elizabeth Chastain
2004-02-05 15:03 ` Daniel Jacobowitz
2004-02-05 15:26 ` Andrew Cagney
2004-02-05 22:53 Michael Elizabeth Chastain
2004-02-05 23:13 Michael Elizabeth Chastain
2004-02-06 18:33 ` Andrew Cagney
2004-02-07 3:02 ` Joel Brobecker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox