Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -61111,11 +61111,22 @@ esac
fi


if test "$gdb_command" != no
then :


printf "%s\n" "#define GDB_COMMAND \"$gdb_command\"" >>confdefs.h

{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: configuring gdb command... \"$gdb_command\"" >&5
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: configuring gdb command... \"$gdb_command\"" >&5
printf "%s\n" "configuring gdb command... \"$gdb_command\"" >&6; }

else case e in #(
e)
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: configuring with no gdb\"" >&5
printf "%s\n" "configuring with no gdb\"" >&6; }
;;
esac
fi
# -------------------------------------------------------------


Expand Down
10 changes: 8 additions & 2 deletions m4/libmesh_core_features.m4
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,14 @@ AC_ARG_WITH([gdb-command],
[gdb_command="$withval"],
[gdb_command="no"])

AC_DEFINE_UNQUOTED(GDB_COMMAND, "$gdb_command", [command to invoke gdb])
AC_MSG_RESULT([configuring gdb command... "$gdb_command"])
AS_IF([test "$gdb_command" != no],
[
AC_DEFINE_UNQUOTED(GDB_COMMAND, "$gdb_command", [command to invoke gdb])
AC_MSG_RESULT([configuring gdb command... "$gdb_command"])
],
[
AC_MSG_RESULT([configuring with no gdb"])
])
# -------------------------------------------------------------


Expand Down
17 changes: 11 additions & 6 deletions src/base/print_trace.C
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ std::string process_trace(const char * name)
// source code, a really helpful feature when debugging something...
bool gdb_backtrace(std::ostream & out_stream)
{
#ifdef LIBMESH_GDB_COMMAND
// Eventual return value, true if gdb succeeds, false otherwise.
bool success = true;

Expand All @@ -156,8 +155,15 @@ bool gdb_backtrace(std::ostream & out_stream)

libmesh_try
{
#ifdef LIBMESH_GDB_COMMAND
std::string gdb_command =
libMesh::command_line_value("gdb",std::string(LIBMESH_GDB_COMMAND));
#else
if (!libMesh::on_command_line("--gdb"))
return false;
std::string gdb_command =
libMesh::command_line_value("gdb",std::string());
#endif

std::ostringstream command;
command << gdb_command
Expand Down Expand Up @@ -188,9 +194,6 @@ bool gdb_backtrace(std::ostream & out_stream)
std::remove(temp_file);

return success;
#else
return false;
#endif
}

} // end anonymous namespace
Expand All @@ -210,8 +213,10 @@ void print_trace(std::ostream & out_stream)

// Let the user disable GDB backtraces by configuring with
// --without-gdb-command or with a command line option.
if ((std::string(LIBMESH_GDB_COMMAND) != std::string("no") &&
!libMesh::on_command_line("--no-gdb-backtrace")) ||
if (
#ifdef LIBMESH_GDB_COMMAND
!libMesh::on_command_line("--no-gdb-backtrace") ||
#endif
libMesh::on_command_line("--gdb"))
gdb_worked = gdb_backtrace(out_stream);

Expand Down