From ca4ca11edda678ddafee7314829cc14c11a570ca Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Tue, 9 Jan 2007 14:58:57 +0000 Subject: [PATCH] * configure.ac: Check for XML_StopParser. * xml-support.c (gdb_xml_body_text): Check for an error. (gdb_xml_start_element_wrapper): Conditionalize call to XML_StopParser. (gdb_xml_end_element_wrapper): Likewise. * config.in, configure: Regenerated. --- gdb/ChangeLog | 8 ++++ gdb/config.in | 3 ++ gdb/configure | 106 ++++++++++++++++++++++++++++++++++++++++++++++ gdb/configure.ac | 5 +++ gdb/xml-support.c | 7 +++ 5 files changed, 129 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 15c98ddc5c0..b37642a8be9 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2007-01-09 Daniel Jacobowitz + + * configure.ac: Check for XML_StopParser. + * xml-support.c (gdb_xml_body_text): Check for an error. + (gdb_xml_start_element_wrapper): Conditionalize call to XML_StopParser. + (gdb_xml_end_element_wrapper): Likewise. + * config.in, configure: Regenerated. + 2007-01-08 Daniel Jacobowitz * varobj.c (install_new_value): Always update print_value. diff --git a/gdb/config.in b/gdb/config.in index 52176b97025..11647f1e7f1 100644 --- a/gdb/config.in +++ b/gdb/config.in @@ -451,6 +451,9 @@ /* Define to 1 if `vfork' works. */ #undef HAVE_WORKING_VFORK +/* Define to 1 if you have the `XML_StopParser' function. */ +#undef HAVE_XML_STOPPARSER + /* Define to 1 if your system has the _etext variable. */ #undef HAVE__ETEXT diff --git a/gdb/configure b/gdb/configure index 91b8eea73bb..69cb9cd2a96 100755 --- a/gdb/configure +++ b/gdb/configure @@ -6352,6 +6352,112 @@ echo "${ECHO_T}$LIBEXPAT" >&6 if test "$HAVE_LIBEXPAT" != yes; then { echo "$as_me:$LINENO: WARNING: expat is missing or unusable; some features may be disabled." >&5 echo "$as_me: WARNING: expat is missing or unusable; some features may be disabled." >&2;} +else + save_LIBS=$LIBS + LIBS="$LIBS $LIBEXPAT" + +for ac_func in XML_StopParser +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + LIBS=$save_LIBS fi # ------------------------- # diff --git a/gdb/configure.ac b/gdb/configure.ac index 563782e3db6..3a55c515735 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -325,6 +325,11 @@ AC_LIB_HAVE_LINKFLAGS([expat], [], [#include "expat.h"], [XML_Parser p = XML_ParserCreate (0);]) if test "$HAVE_LIBEXPAT" != yes; then AC_MSG_WARN([expat is missing or unusable; some features may be disabled.]) +else + save_LIBS=$LIBS + LIBS="$LIBS $LIBEXPAT" + AC_CHECK_FUNCS(XML_StopParser) + LIBS=$save_LIBS fi # ------------------------- # diff --git a/gdb/xml-support.c b/gdb/xml-support.c index 18416c8019e..bebe73201fe 100644 --- a/gdb/xml-support.c +++ b/gdb/xml-support.c @@ -81,6 +81,9 @@ gdb_xml_body_text (void *data, const XML_Char *text, int length) struct gdb_xml_parser *parser = data; struct scope_level *scope = VEC_last (scope_level_s, parser->scopes); + if (parser->error.reason < 0) + return; + if (scope->body == NULL) { scope->body = XZALLOC (struct obstack); @@ -286,7 +289,9 @@ gdb_xml_start_element_wrapper (void *data, const XML_Char *name, if (ex.reason < 0) { parser->error = ex; +#ifdef HAVE_XML_STOPPARSER XML_StopParser (parser->expat_parser, XML_FALSE); +#endif } } @@ -362,7 +367,9 @@ gdb_xml_end_element_wrapper (void *data, const XML_Char *name) if (ex.reason < 0) { parser->error = ex; +#ifdef HAVE_XML_STOPPARSER XML_StopParser (parser->expat_parser, XML_FALSE); +#endif } } -- 2.30.2