Re: DDD 3.3.11 (x86_64-pc-linux-gnu) gets `Segmentation fault' signal
Peter Wainwright <[email protected]>
| Newsgroups | gmane.comp.debugging.ddd.general |
|---|---|
| Message-ID | <[email protected]> |
On Fri, 2008-09-12 at 09:46 -0800, Brian Dixon wrote: > Internal error (Segmentation fault). > > To reproduce: Run 2 instances of DDD, in the background, at the same > time. This fault specifically occurs only if the "Warn if Multiple DDD > Instances are Running" checkbox checked (see Edit/Preferences) when you > run the two instances of DDD. Unchecking this option eliminates the > seg-fault when you run a second instance of DDD. Example: > > my_prompt> ddd & > my_prompt> ddd & > > Machine: Dell Model 690 64-bit > OS: 64-bit Ubuntu Linux > > Have fun! > Brian Thanks for the error report. The check for multiple instances occurs very early in startup when many of the global pointers are not initialized (NULL). Unfortunately the error handlers did not check for this... I have committed the attached patch in Subversion, this will hopefully make things a bit more robust. Peter > > --------------------------------------------------------------------- > Oops! You have found a bug in DDD. > > If you can reproduce this bug, please send a bug report > to <[email protected]>, giving a subject like > > DDD 3.3.11 (x86_64-pc-linux-gnu) gets `Segmentation fault' signal > > To enable us to fix the bug, you should include the following > information: > * What you were doing to get this message. Report all the facts. > * The contents of the `~/.ddd/log' file as generated by this session. > Please read also the section "Reporting Bugs" in the DDD manual. > > We thank you for your support. > > > > > _______________________________________________ > ddd mailing list > [email protected] > http://lists.gnu.org/mailman/listinfo/ddd _______________________________________________ ddd mailing list [email protected] http://lists.gnu.org/mailman/listinfo/ddd
patch
(text/x-patch, 1.7 KB)
Index: ddd/options.C
===================================================================
--- ddd/options.C (revision 6900)
+++ ddd/options.C (revision 7117)
@@ -2347,6 +2347,15 @@
const bool save_geometry = (flags & SAVE_GEOMETRY);
const bool interact = (flags & MAY_INTERACT);
+ if (find_shell() == 0) {
+ // We cannot use *_app_value() because we have no shell
+ // available. Presumably we have been called from an error
+ // handler very early in program startup.
+ if (interact)
+ post_error("Cannot save options", "options_save_error");
+ return false;
+ }
+
string session =
(save_session ? app_data.session : DEFAULT_SESSION.chars());
Index: ddd/post.C
===================================================================
--- ddd/post.C (revision 6900)
+++ ddd/post.C (revision 7117)
@@ -355,7 +355,9 @@
dddlog << "! " << text << '\n';
dddlog.flush();
- if (ddd_is_exiting)
+ // If error occurs very early, we may not even have a command
+ // shell...
+ if (ddd_is_exiting || find_shell(w) == 0)
{
std::cerr << ddd_NAME << ": " << text << "\n";
return 0;
Index: ddd/file.C
===================================================================
--- ddd/file.C (revision 6900)
+++ ddd/file.C (revision 7117)
@@ -683,6 +683,16 @@
running(false),
state()
{
+ if (!source_view || !gdb) {
+ post_error("Cannot create ProgramInfo, no source view.",
+ "no_source_error");
+ return;
+ }
+ if (!source_view || !gdb) {
+ post_error("Cannot create ProgramInfo, no debugger agent.\n",
+ "gdb_io_error");
+ return;
+ }
if (source_view->have_exec_pos())
{
state = "has stopped";