News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Crash when changing active target

Started by Pecan, February 02, 2007, 12:31:55 PM

Previous topic - Next topic

Pecan

andLinux SVN 3558 gcc 4.0.4 Linux/unicode

Occasionaly when I change a project target via the toolbar: crash


Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1230625104 (LWP 1566)]
0x08073a87 in wxStringBase::size (this=0x8ddd940)
    at /usr/include/wx-2.6/wx/string.h:367
367       size_type size() const { return GetStringData()->nDataLength; }
(gdb) bt
#0  0x08073a87 in wxStringBase::size (this=0x8ddd940)
    at /usr/include/wx-2.6/wx/string.h:367
#1  0x08073b2b in wxStringBase::length (this=0x8ddd940)
    at /usr/include/wx-2.6/wx/string.h:369
#2  0x0809f3e1 in wxString::Len (this=0x8ddd940)
    at /usr/include/wx-2.6/wx/string.h:689
#3  0x0809f543 in operator== (s1=@0xbfa40484, s2=@0x8ddd940)
    at /usr/include/wx-2.6/wx/string.h:1437
#4  0xb76de3d8 in cbProject::SetActiveBuildTarget (this=0x8ddd818,
    name=@0xbfa40484) at sdk/cbproject.cpp:1587
#5  0xb479f8b8 in CompilerGCC::DoUpdateTargetMenu (this=0x88e48a8,
    targetIndex=2) at plugins/compilergcc/compilergcc.cpp:1235
#6  0xb47a4ce9 in CompilerGCC::OnSelectTarget (this=0x88e48a8,
    event=@0xbfa40748) at plugins/compilergcc/compilergcc.cpp:2921
#7  0xb7993655 in wxAppConsole::HandleEvent ()
   from /usr/lib/libwx_baseu-2.6.so.0
#8  0xb7a22b52 in wxEvtHandler::ProcessEventIfMatches ()
   from /usr/lib/libwx_baseu-2.6.so.0
#9  0xb7a22c9d in wxEventHashTable::HandleEvent ()
   from /usr/lib/libwx_baseu-2.6.so.0
#10 0xb7a22e1f in wxEvtHandler::ProcessEvent ()
   from /usr/lib/libwx_baseu-2.6.so.0
#11 0xb7a22dbe in wxEvtHandler::ProcessEvent ()
---Type <return> to continue, or q <return> to quit---q
from /usr/lib/libwx_baseu-2.6.soQuit
(gdb) f 4
#4  0xb76de3d8 in cbProject::SetActiveBuildTarget (this=0x8ddd818,
    name=@0xbfa40484) at sdk/cbproject.cpp:1587
1587        if (name == m_ActiveTarget)
(gdb) p name
$1 = (const wxString &) @0xbfa40484: {<wxStringBase> = {
    static npos = 4294967295, m_pchData = 0x8e75cdc}, <No data fields>}
(gdb) p m_ActiveTarget
$2 = {<wxStringBase> = {static npos = 4294967295,
    m_pchData = 0x67}, <No data fields>}
(gdb)



mandrav

Sounds like the project pointer used is invalid...
Although I can't reproduce it, can you try the following?

In src/plugins/compilergcc/compilergcc.cpp:1234, there is this code:
    if (m_Project)
        m_Project->SetActiveBuildTarget(GetTargetString(m_TargetIndex));


Replace it with this:
    if (Manager::Get()->GetProjectManager()->GetActiveProject())
        Manager::Get()->GetProjectManager()->GetActiveProject()->SetActiveBuildTarget(GetTargetString(m_TargetIndex));


Test it out for a while (a day or two) and if the crash is gone tell me to commit it.
Be patient!
This bug will be fixed soon...

Pecan

Quote from: mandrav on February 02, 2007, 01:40:28 PM
Sounds like the project pointer used is invalid...
Although I can't reproduce it, can you try the following?

In src/plugins/compilergcc/compilergcc.cpp:1234, there is this code:
    if (m_Project)
        m_Project->SetActiveBuildTarget(GetTargetString(m_TargetIndex));


Replace it with this:
    if (Manager::Get()->GetProjectManager()->GetActiveProject())
        Manager::Get()->GetProjectManager()->GetActiveProject()->SetActiveBuildTarget(GetTargetString(m_TargetIndex));


Test it out for a while (a day or two) and if the crash is gone tell me to commit it.

This fix seems to have done the job.

I noticed that the original problem occured while I was building a large project with a lot of targets and switching back and forth without doing an intervening save.

thanks, it saved a lot of time.
pecan


dje

It makes me think of a bug I submitted to BerliOS :
https://developer.berlios.de/bugs/?func=detailbug&group_id=5358&bug_id=9655

I had a crash switching from a project to another one during debug sesion.

The difference is that I switched from a project to another instead of a target to another but context and crash are very similar...

Dje


Pecan

#4
Quote from: dje on February 08, 2007, 09:56:41 PM
It makes me think of a bug I submitted to BerliOS :
https://developer.berlios.de/bugs/?func=detailbug&group_id=5358&bug_id=9655

I had a crash switching from a project to another one during debug sesion.

The difference is that I switched from a project to another instead of a target to another but context and crash are very similar...

Dje

I think you'll find that bug fixed here:
http://forums.next.codeblocks.org/index.php?topic=5120.msg40163#msg40163
debugger stop button on Linux console pgm crashes CB

It's caused by a "delete m_pDirver" being called while data is still in the GDBOuput queue.

I made the fix for Linux only, but there's no reason it wouldn't work for XP.
It's a temporary fix until mandrav decides how he wants to handle it.

dje

Ok, thanks.
It was on Windows SP2.

If you think it's the same problem (and it looks), "my" bug should be closed...

I can't do it.

Dje

Pecan

#6
Quote from: dje on February 08, 2007, 10:17:52 PM
Ok, thanks.
It was on Windows SP2.

If you think it's the same problem (and it looks), "my" bug should be closed...

I can't do it.

Dje

I think we should let Yiannis make that decision.

I don't think my fix encompases all the possible ramifications of delaying the GDB_Driver close.

But it will allow us to stop/restart/continue/switch/close while debugging a console task with no crashes.

He'll know better than I.