Author Topic: Crash using copy and paste (reproducable)  (Read 21535 times)

Pulle

  • Guest
Crash using copy and paste (reproducable)
« on: December 07, 2006, 08:30:16 pm »
Although this bug is already reported on the BerliOs-ProjectPage, I decided to start a new thread because I've found a way to reproduce this crash and to show that this bug is still existant in current svn-versions.

The problem: CodeBlocks crashes quite often when doing copy & paste. I don't know if it depends on the text which should be pasted, but this is the way I can reproduce the crash:
1. start C::B and open or create an empty cpp-file.
2. paste the following code "as it is" into the empty cpp-file
Code
#include <gtkmm.h>
#include <gtkmm/button.h>
#include <gtkmm/image.h>
#include <libglademm-2.4/libglademm/xml.h>
#include <iostream>
3. mark the complete code in the cpp-file.
4. press copy and then paste and C::B should crash.

The crash happens very often and not only when pasting this special piece of code, but this special case was the only one I found to reproduce it.

I'm using Arch-Linux 0.7.2:
uname -a
2.6.18-ARCH #1 SMP PREEMPT Thu Nov 30 21:32:54 CET 2006 i686 AMD Athlon(tm) 64 Processor 3200+ AuthenticAMD GNU/Linux

The bug occured with
svn build rev 3353 (2006-12-07 14:49:33) gcc 4.1.2 Linux/unicode
as well as with a version from the 3rd of december (don't remember the version-number).

Here's the backtrace:
Code
 codeblocks -d
*** glibc detected *** codeblocks: double free or corruption (!prev): 0x08c5a0d8 ***
======= Backtrace: =========
/lib/libc.so.6[0xb72fdb10]
/lib/libc.so.6(__libc_free+0x89)[0xb72ff1a9]
/usr/lib/libwx_gtk2u_core-2.6.so.0[0xb773fe3c]
/usr/lib/libgtk-x11-2.0.so.0[0xb6ff89c6]
/usr/lib/libgobject-2.0.so.0(g_closure_invoke+0x13b)[0xb6e3007b]
/usr/lib/libgobject-2.0.so.0[0xb6e404e9]
/usr/lib/libgobject-2.0.so.0(g_signal_emit_valist+0x899)[0xb6e419a9]
/usr/lib/libgobject-2.0.so.0(g_signal_emit_by_name+0xee)[0xb6e4475e]
/usr/lib/libgtk-x11-2.0.so.0[0xb70556e4]
/usr/lib/libgtk-x11-2.0.so.0(gtk_selection_convert+0x145)[0xb7056565]
/usr/lib/libwx_gtk2u_core-2.6.so.0(_ZN11wxClipboard7GetDataER12wxDataObject+0x1ec)[0xb774009c]
/usr/local/lib/libcodeblocks.so.0(_ZN11ScintillaWX5PasteEv+0x17f)[0xb7d9a04f]
/usr/local/lib/libcodeblocks.so.0(_ZN6Editor7WndProcEjml+0x1c5a)[0xb7dc77ba]
/usr/local/lib/libcodeblocks.so.0(_ZN13ScintillaBase7WndProcEjml+0x2b7)[0xb7e4c437]
/usr/local/lib/libcodeblocks.so.0(_ZN11ScintillaWX7WndProcEjml+0x44)[0xb7d985c4]
/usr/local/lib/libcodeblocks.so.0(_ZN11wxScintilla7SendMsgEill+0x2f)[0xb7d9ca0f]
/usr/local/lib/libcodeblocks.so.0(_ZN11wxScintilla5PasteEv+0x32)[0xb7d9f062]
/usr/local/lib/libcodeblocks.so.0(_ZN8cbEditor5PasteEv+0x25)[0xb7bd6d95]
codeblocks(_ZN9MainFrame11OnEditPasteER14wxCommandEvent+0x38)[0x807aff8]
/usr/lib/libwx_baseu-2.6.so.0(_ZNK12wxAppConsole11HandleEventEP12wxEvtHandlerMS0_FvR7wxEventES3_+0x35)[0xb7533395]
/usr/lib/libwx_baseu-2.6.so.0(_ZN12wxEvtHandler21ProcessEventIfMatchesERK21wxEventTableEntryBasePS_R7wxEvent+0x92)[0xb75bf662]
/usr/lib/libwx_baseu-2.6.so.0(_ZN16wxEventHashTable11HandleEventER7wxEventP12wxEvtHandler+0x7b)[0xb75bf7ab]
/usr/lib/libwx_baseu-2.6.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0xcf)[0xb75bf91f]
/usr/lib/libwx_baseu-2.6.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6e)[0xb75bf8be]
/usr/lib/libwx_baseu-2.6.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6e)[0xb75bf8be]
/usr/lib/libwx_baseu-2.6.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6e)[0xb75bf8be]
/usr/lib/libwx_baseu-2.6.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6e)[0xb75bf8be]
/usr/lib/libwx_baseu-2.6.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6e)[0xb75bf8be]
/usr/lib/libwx_baseu-2.6.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6e)[0xb75bf8be]
/usr/lib/libwx_baseu-2.6.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6e)[0xb75bf8be]
/usr/lib/libwx_baseu-2.6.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6e)[0xb75bf8be]
/usr/lib/libwx_baseu-2.6.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6e)[0xb75bf8be]
/usr/lib/libwx_baseu-2.6.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6e)[0xb75bf8be]
/usr/lib/libwx_baseu-2.6.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6e)[0xb75bf8be]
/usr/lib/libwx_baseu-2.6.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6e)[0xb75bf8be]
/usr/lib/libwx_baseu-2.6.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6e)[0xb75bf8be]
/usr/lib/libwx_baseu-2.6.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6e)[0xb75bf8be]
/usr/lib/libwx_baseu-2.6.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6e)[0xb75bf8be]
/usr/lib/libwx_baseu-2.6.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6e)[0xb75bf8be]
/usr/lib/libwx_baseu-2.6.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6e)[0xb75bf8be]
/usr/lib/libwx_baseu-2.6.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6e)[0xb75bf8be]
/usr/lib/libwx_baseu-2.6.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6e)[0xb75bf8be]
/usr/lib/libwx_baseu-2.6.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6e)[0xb75bf8be]
/usr/lib/libwx_baseu-2.6.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6e)[0xb75bf8be]
/usr/lib/libwx_baseu-2.6.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6e)[0xb75bf8be]
/usr/lib/libwx_baseu-2.6.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6e)[0xb75bf8be]
/usr/lib/libwx_baseu-2.6.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6e)[0xb75bf8be]
/usr/lib/libwx_baseu-2.6.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6e)[0xb75bf8be]
/usr/lib/libwx_baseu-2.6.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6e)[0xb75bf8be]
/usr/lib/libwx_baseu-2.6.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6e)[0xb75bf8be]
/usr/lib/libwx_baseu-2.6.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6e)[0xb75bf8be]
/usr/lib/libwx_baseu-2.6.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6e)[0xb75bf8be]
/usr/lib/libwx_baseu-2.6.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6e)[0xb75bf8be]
/usr/lib/libwx_gtk2u_core-2.6.so.0[0xb77c0568]
/usr/lib/libgobject-2.0.so.0(g_cclosure_marshal_VOID__VOID+0x4b)[0xb6e3d41b]
/usr/lib/libgobject-2.0.so.0(g_closure_invoke+0x13b)[0xb6e3007b]
/usr/lib/libgobject-2.0.so.0[0xb6e404e9]
/usr/lib/libgobject-2.0.so.0(g_signal_emit_valist+0x899)[0xb6e419a9]
/usr/lib/libgobject-2.0.so.0(g_signal_emit+0x29)[0xb6e41b59]
/usr/lib/libgtk-x11-2.0.so.0[0xb711002d]
/usr/lib/libgobject-2.0.so.0(g_closure_invoke+0x13b)[0xb6e3007b]
/usr/lib/libgobject-2.0.so.0[0xb6e404e9]
/usr/lib/libgobject-2.0.so.0(g_signal_emit_valist+0x678)[0xb6e41788]
======= Memory map: ========
08048000-080df000 r-xp 00000000 03:02 121214     /usr/local/bin/codeblocks
080df000-080e5000 rwxp 00096000 03:02 121214     /usr/local/bin/codeblocks
080e5000-08cd4000 rwxp 080e5000 00:00 0          [heap]
b285b000-b285c000 ---p b285b000 00:00 0
b285c000-b305c000 rwxp b285c000 00:00 0
b305c000-b3068000 r-xp 00000000 03:02 121681     /usr/share/fonts/TTF/VeraMoBd.ttf
b3068000-b3069000 ---p b3068000 00:00 0
b3069000-b3869000 rwxp b3069000 00:00 0
b3869000-b3876000 r-xp 00000000 03:02 121680     /usr/share/fonts/TTF/VeraMono.ttf
b3876000-b388c000 r-xp 00000000 03:02 121460     /usr/local/share/codeblocks/plugins/libcb_koders.so
b388c000-b388d000 rwxp 00016000 03:02 121460     /usr/local/share/codeblocks/plugins/libcb_koders.so
b388d000-b388e000 ---p b388d000 00:00 0
b388e000-b408e000 rwxp b388e000 00:00 0
b408e000-b4130000 r-xp 00000000 03:02 121260     /usr/local/share/codeblocks/plugins/libcodecompletion.so
b4130000-b4135000 rwxp 000a1000 03:02 121260     /usr/local/share/codeblocks/plugins/libcodecompletion.so
b4135000-b413d000 rwxp b4135000 00:00 0
b413d000-b4150000 r-xp 00000000 03:02 121491     /usr/local/share/codeblocks/plugins/libhelp_plugin.so
b4150000-b4151000 rwxp 00013000 03:02 121491     /usr/local/share/codeblocks/plugins/libhelp_plugin.so
b4151000-b4161000 r-xp 00000000 03:02 121231     /usr/local/share/codeblocks/plugins/libclasswizard.so
b4161000-b4162000 rwxp 00010000 03:02 121231     /usr/local/share/codeblocks/plugins/libclasswizard.so
b4162000-b4170000 r-xp 00000000 03:02 121485     /usr/local/shaAbgebrochen

Pulle

  • Guest
Re: Crash using copy and paste (reproducable)
« Reply #1 on: December 08, 2006, 09:49:13 pm »
I've done a bit more testing and recognized that this crash only occurs when C::B is build with the unicode-version of wxgtk. If I built it with the ansi-version the crash was gone. Maybe it's not a C::B error but a wxwidgets error but I didn't recognized it with any other wxwidgets-apps.
« Last Edit: December 08, 2006, 11:14:53 pm by Pulle »

sethjackson

  • Guest
Re: Crash using copy and paste (reproducable)
« Reply #2 on: December 08, 2006, 10:04:04 pm »
wxScintilla Unicode handling problem (just a guess)?

stonedz

  • Guest
Re: Crash using copy and paste (reproducable)
« Reply #3 on: December 12, 2006, 02:08:05 am »
Hello,

I have the exact same problem with the same configuration (Archlinux updated to current), It seems that our distro config may be the cause of this problem. Meanwhile, if someone get a clue about how to patch it it would be nice, it's annoying not being able to copy/paste (sic!) in an IDE...

Thanks.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2873
Re: Crash using copy and paste (reproducable)
« Reply #4 on: December 12, 2006, 04:04:13 am »
Hello,

I have the exact same problem with the same configuration (Archlinux updated to current), It seems that our distro config may be the cause of this problem. Meanwhile, if someone get a clue about how to patch it it would be nice, it's annoying not being able to copy/paste (sic!) in an IDE...

Thanks.

Turn off CodeCompletion and see if the problem goes away.

Offline eranif

  • Regular
  • ***
  • Posts: 256
Re: Crash using copy and paste (reproducable)
« Reply #5 on: December 12, 2006, 05:17:37 pm »
Hi,
Couple of months ago I encountered the same problem I posted this issue at wxCode forum, but unfortunaly I got no replies but one, but I did managed to find a solution for this
(it is, in my opinion wxScintilla bug)

the bug report and the solution can be found here:
http://wxforum.shadonet.com/viewtopic.php?t=9907

A quick solution is to replace the Paste function with this one: (ScintillWX.cpp):
Code
void ScintillaWX::Paste() {
    pdoc->BeginUndoAction();
    ClearSelection();

#if wxUSE_DATAOBJ
    wxTextDataObject data;
    wxString textString;

    wxWX2MBbuf buf;
    int   len  = 0;
    bool  rectangular = false;

    if (wxTheClipboard->Open()) {
        wxTheClipboard->UsePrimarySelection(false);
        wxCustomDataObject selData(wxUSE_UNICODE ? wxDF_UNICODETEXT : wxDF_PRIVATE);
        bool gotRectData = wxTheClipboard->GetData(selData);

        if (gotRectData && selData.GetSize()>1) {
            const char* rectBuf = (const char*)selData.GetData();
            rectangular = rectBuf[0] == (char)1;
            len = selData.GetDataSize()-1;
            char* buffer = new char[len];
            memcpy (buffer, rectBuf+1, len);
            textString = sci2wx(buffer, len);
            delete buffer;
        } else {
            bool gotData = wxTheClipboard->GetData(data);
            if (gotData) {
                textString = wxTextBuffer::Translate (data.GetText(),
                                                      wxConvertEOLMode(pdoc->eolMode));
            }
        }
        data.SetText(wxEmptyString); // free the data object content
        wxTheClipboard->Close();
    }

    buf = (wxWX2MBbuf)wx2sci(textString);
    len  = strlen(buf);
    int newPos = 0;
    if (rectangular) {
        int newLine = pdoc->LineFromPosition (currentPos) + wxCountLines (buf, pdoc->eolMode);
        int newCol = pdoc->GetColumn(currentPos);
        PasteRectangular (currentPos, buf, len);
        newPos = pdoc->FindColumn (newLine, newCol);
    } else {
        pdoc->InsertString (currentPos, buf, len);
        newPos = currentPos + len;
    }
    SetEmptySelection (newPos);
#endif // wxUSE_DATAOBJ

    pdoc->EndUndoAction();
    NotifyChange();
    Redraw();
}
Eran
« Last Edit: December 12, 2006, 05:27:02 pm by eranif »

Offline manciuleas

  • Multiple posting newcomer
  • *
  • Posts: 20
Re: Crash using copy and paste (reproducable)
« Reply #6 on: December 12, 2006, 05:52:03 pm »
Eran,

Who is wxCountLines? It seems that it is not defined.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7785
    • My Best Post
Re: Crash using copy and paste (reproducable)
« Reply #7 on: December 12, 2006, 06:15:58 pm »
Eran,

Who is wxCountLines? It seems that it is not defined.


From ScintillaWX.cxx right after the wxConvertEOLMode method; this is from code written after C::B version of it.
Code
static int wxCountLines(const char* text, int scintillaMode)
{
    char eolchar;

    switch (scintillaMode) {
        case wxSCI_EOL_CRLF:
        case wxSCI_EOL_LF:
            eolchar = '\n';
            break;
        case wxSCI_EOL_CR:
            eolchar = '\r';
            break;
        default:
            return 0;
    }

    int count = 0;
    int i     = 0;
    while (text[i] != 0) {
        if (text[i] == eolchar) {
            count++;
        }
        i++;
    }

    return count;
}
« Last Edit: December 12, 2006, 06:18:08 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline manciuleas

  • Multiple posting newcomer
  • *
  • Posts: 20
Re: Crash using copy and paste (reproducable)
« Reply #8 on: December 12, 2006, 06:30:43 pm »
Thanks stahta01.


Pulle

  • Guest
Re: Crash using copy and paste (reproducable)
« Reply #9 on: December 13, 2006, 12:55:06 pm »
Hi,
thanks for the help Eran, but the bug is still there after changing ScintillaWX.cpp as you suggested and recompile C::B. So the error must be somewhere else.
btw: disabling code-completition didn't helped either.

Offline eranif

  • Regular
  • ***
  • Posts: 256
Re: Crash using copy and paste (reproducable)
« Reply #10 on: December 13, 2006, 01:42:17 pm »
This is wierd, since this function fixed the same problem for me. can you confirm that the wxUSE_UNICODE macro is set to 1?
Eran

Pulle

  • Guest
Re: Crash using copy and paste (reproducable)
« Reply #11 on: December 13, 2006, 11:47:48 pm »
Yes, wxUSE_UNICODE is set to 1 in the setup.h.

fleuba

  • Guest
Re: Crash using copy and paste (reproducable)
« Reply #12 on: February 12, 2007, 11:02:43 am »
Hi,

just wanted to ask WHEN will this bug be fixed in the svn source tree ?
It has been reported for more than 2 month, it is critical, and though we see no sign of move on this topic.
Is someone working on a patch ? will it be applied to the svn source tree ? when ?
Please could you give some feedbacks, it would be nice  :?.

Thanks for this great IDE, it is for us who work on many plateform (windows, linux32, linux64, MacOS) a really great tool.

Fred

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Crash using copy and paste (reproducable)
« Reply #13 on: February 12, 2007, 11:15:28 am »
This is bugging me too. I'm using C::B Revison 3593, OpenSUSE 10.2, wxGTK-2.6.3.1 and wx is compiled as Release-Dynamic-Unicode-Monolithic.

C::B crashes after using Ctrl+V or Edit>Paste.
« Last Edit: February 12, 2007, 11:20:07 am by Biplab »
Be a part of the solution, not a part of the problem.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Crash using copy and paste (reproducable)
« Reply #14 on: February 12, 2007, 01:46:37 pm »
Quote
just wanted to ask WHEN will this bug be fixed in the svn source tree ?
It has been reported for more than 2 month, it is critical, and though we see no sign of move on this topic.
Is someone working on a patch ? will it be applied to the svn source tree ? when ?

When it is fixed.

For the curious, neither me nor any other core team member is able to reproduce this. This means that until a patch is contributed by someone else, there is little to be done.
Be patient!
This bug will be fixed soon...

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2873
Re: Crash using copy and paste (reproducable)
« Reply #15 on: February 12, 2007, 03:03:09 pm »
This is bugging me too. I'm using C::B Revison 3593, OpenSUSE 10.2, wxGTK-2.6.3.1 and wx is compiled as Release-Dynamic-Unicode-Monolithic.

@Biplab
C::B crashes after using Ctrl+V or Edit>Paste.

Since you're getting this crash, could you trap it and give us a backtrace.
You can use the follow (or like) bash shell to trap the crash.

Code
#!/bin/sh
echo run>run.txt
APP_DIR=`pwd`
export LD_LIBRARY_PATH=$APP_DIR:$LD_LIBRARY_PATH
gdb --command=run.txt --args $APP_DIR/codeblocks $@


If you're using windows, just run codeblocks under gdb, like

gdb codeblocks
run

You can make a .cmd file for it like:
Code
echo run>run.txt
gdb -command=run.txt codeblocks
« Last Edit: February 12, 2007, 03:07:05 pm by Pecan »

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Crash using copy and paste (reproducable)
« Reply #16 on: February 12, 2007, 03:10:54 pm »
This is bugging me too. I'm using C::B Revison 3593, OpenSUSE 10.2, wxGTK-2.6.3.1 and wx is compiled as Release-Dynamic-Unicode-Monolithic.

@Biplab
C::B crashes after using Ctrl+V or Edit>Paste.

Since you're getting this crash, could you trap it and give us a backtrace.
You can use the follow (or like) bash shell to trap the crash.

Code
#!/bin/sh
echo run>run.txt
APP_DIR=`pwd`
export LD_LIBRARY_PATH=$APP_DIR:$LD_LIBRARY_PATH
gdb --command=run.txt --args $APP_DIR/codeblocks $@


Thanks a lot for the detailed instruction. :D I'm not familiar with GDB and they will help me a lot.

I'll post it after some time. (Currently I'm in Windows and compiling GCC-3.4.6. It's not over yet. :))

By the way do I need to run it from src/devel dir or I can run it from /usr/local/bin dir ?
Be a part of the solution, not a part of the problem.

fleuba

  • Guest
Re: Crash using copy and paste (reproducable)
« Reply #17 on: February 12, 2007, 04:02:54 pm »
Hi again,

Sorry you guys if my post looked a bit upseting. I'm just so fed up with this bug, but in the meanwhile I know developping such a big and great software is a lot of work.
This bug seems to occure only for a few people, so it is tempting to move it very far in the todo list.
Nevertheless, thank you for the answer. I'll reproduce the bug and provide you with the crash stack today.
I hope this will help you to fix it... I can cooperate even more as you need.

Fred

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2873
Re: Crash using copy and paste (reproducable)
« Reply #18 on: February 12, 2007, 04:09:08 pm »
@Biplab:

When in wndows, run it from the src/devel.

When in Linux run it from where the codeblocks executable is.

Else just change the APP_DIR=`pwd` to the dir of codeblocks, and run it from anywhere.

For example, here's one without gdb running the nightly install (not my compiled svn install) from /home/pecan/cbNightly/usr/bin with the LIB also changed.
I cd to /home/pecan/cbNightly/usr/bin and issue ./run.sh
Code
#!/bin/sh
APP_DIR=`pwd`
export LD_LIBRARY_PATH=$APP_DIR/lib:$LD_LIBRARY_PATH
$APP_DIR/bin/codeblocks --prefix=$APP_DIR $@

When the crash finally occurs, issue the command:
bt full

and keep hitting enter (not quit) until the backtrace finishes with a (gdb) prompt.

copy and paste to taste. I like to open an external editor and paste the whole monte so I can restart CB and read the trace later.
« Last Edit: February 12, 2007, 04:19:43 pm by Pecan »

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2873
Re: Crash using copy and paste (reproducable)
« Reply #19 on: February 12, 2007, 04:25:48 pm »
Here's a nice 2 page quick reference for GDB.
http://www.cs.dal.ca/studentservices/refcards/gdbref.pdf

KeyWords: GDB Quick Reference

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Crash using copy and paste (reproducable)
« Reply #20 on: February 12, 2007, 05:08:33 pm »
@Pecan

My sincere thanks for the help. I'll try my best to learn GDB.  :D

I tried for about 10 minutes, but didn't find any crash. It's strange I'm using the same application. I ran the application with the following script (from ur example).
Code
#!/bin/sh
APP_DIR=/usr/local
export LD_LIBRARY_PATH=$APP_DIR/lib:$LD_LIBRARY_PATH
$APP_DIR/bin/codeblocks --prefix=$APP_DIR $@

I usually run the App using the following Desktop Shortcut (I'm not sure about it's Linux name)
Code
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=Code::Blocks
Comment=
Comment[en_US]=
Exec='/usr/local/bin/codeblocks'
GenericName=Code::Blocks IDE
GenericName[en_US]=Code::Blocks IDE
Icon=
MimeType=;
Name[en_US]=Code::Blocks
Path=
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
X-DCOP-ServiceType=
X-KDE-SubstituteUID=false
X-KDE-Username=

I've to leave my lab right now (It's 12am and the AC is switched off ;)) But please point out any problem you find.

I'll keep trying to reproduce crash report, if any.

Thanks & Regards,

Biplab
Be a part of the solution, not a part of the problem.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2873
Re: Crash using copy and paste (reproducable)
« Reply #21 on: February 12, 2007, 06:04:16 pm »
I tried for about 10 minutes, but didn't find any crash. It's strange I'm using the same application. I ran the application with the following script (from ur example).
Code
#!/bin/sh
APP_DIR=/usr/local
export LD_LIBRARY_PATH=$APP_DIR/lib:$LD_LIBRARY_PATH
$APP_DIR/bin/codeblocks --prefix=$APP_DIR $@


To catch the crash you have to run from a terminal or xterm, and shouldn't that last line be:
gdb --args $APP_DIR/bin/codeblocks --prefix=$APP_DIR $@

I made the assumption that you're running the svn version of CB.


On Linux: in the /src/devel directory you'll find the distributed ./run.sh shell command. I modify that shell command to startup gdb with codeblocks as the debugee. That shell I posted is just a modification of the run.sh.

So when I test CodeBlocks, I do the following:
I start a terminal or xterm. I then
cd /home/pecan/devel/trunk/src/devel
./run.sh


On windows:
I start a dos session. Then issue the dos commands:
cd \usr\proj\trunk\src\devel
gdb codeblocks

I get the (gdb) prompt then type
run

Then I just do my thing until CB crashes, where upon I get the (gdb) prompt again with a message about a segxxx, where xxx is  some sort of violation.
I issue:
bt full to get the backtrace.




I usually run the App using the following Desktop Shortcut (I'm not sure about it's Linux name)
Code
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=Code::Blocks
Comment=
Comment[en_US]=
Exec='/usr/local/bin/codeblocks'
GenericName=Code::Blocks IDE
GenericName[en_US]=Code::Blocks IDE
Icon=
MimeType=;
Name[en_US]=Code::Blocks
Path=
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
X-DCOP-ServiceType=
X-KDE-SubstituteUID=false
X-KDE-Username=

Sorry, I don't know what the above is. Some KDE thingie ?
« Last Edit: February 12, 2007, 06:16:32 pm by Pecan »

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Crash using copy and paste (reproducable)
« Reply #22 on: February 12, 2007, 06:28:30 pm »
To catch the crash you have to run from a terminal or xterm, and shouldn't that last line be:
gdb --args $APP_DIR/bin/codeblocks --prefix=$APP_DIR $@

I made the assumption that you're running the svn version of CB.


On Linux: in the /src/devel directory you'll find the distributed ./run.sh shell command.

So when I test CodeBlocks, I do the following:
I start a terminal or xterm. I then
cd /home/pecan/devel/trunk/src/devel
./run.sh

That shell I posted is just a modification ofthe run.sh.

On windows:
I start a dos session. Then issue the dos commands:
cd \usr\proj\trunk\src\devel
gdb codeblocks

Ok, I was in a hurry so couldn't post much details.

What I did was to save that content in a run.sh file and then ran it by right-clicking on it. I know this is utterly wrong, but some Windows habits it is.

I was getting strange error that Permission denied when I was running from shell. So I changed the property of file to Executable (again Right-click) and then selected run menu option.

But I didn't notice any crash. Earlier during crash once I press Ctrl+V everything was gone.

Another point to note that after posting the crash report I downloaded the wx-2.6.3-p2 and reinstalled it.

I'm using SVN version and will try tomorrow again as you've demonstrated. Whenever I try to use ./run.sh in src/devel folder, I get "Permission denied" message. Even in SU mode, it throws same error. May be I need to do the Right-click again to make it executable.

Honestly speaking I'm a Newbie in Linux and I face these strange (but simple) problems. :)

Sorry, I don't know what the above is. Some KDE thingie ?

That is equivalent of Shortcut in Windows. This is to help Newbies like us to launch an app without using shell script.  :)

I posted it's content to show you how I launch C::B.

Thanks again for your introduction to GDB.  :D

Regards,

Biplab
Be a part of the solution, not a part of the problem.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2873
Re: Crash using copy and paste (reproducable)
« Reply #23 on: February 12, 2007, 06:57:43 pm »
I need to do the Right-click again to make it executable.

Oh, yes, you're right. It needs to be made executable

In a terminal or xterm issue the command:

cd to your .../src/devel
chmod +x run.sh (or whatever you named it.)
./run.sh 

I copied my original run.sh to gdb.sh
modified it to execute gdb as we've discussed.
chmod +x gdb.sh

Then just cd to your ...src//devel
./gdb.sh

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Crash using copy and paste (reproducable)
« Reply #24 on: February 12, 2007, 07:07:16 pm »
Thanks for the instruction.  :D

But I would like to ask another question regarding debugging of wxWidgets based app with GDB in Linux. I read the following post in wxWidgets forum.

http://wxforum.shadonet.com/viewtopic.php?t=12530

It says that the user can't see the contents of wxString with GDB in Unicode mode. I tried it and found that in C::B too, in Watches Window I can't see the wxString contents. AFAIK it's possible to view the contents of wxString in Unicode mode with MS Debugger. Why is it so? :)
Be a part of the solution, not a part of the problem.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2873
Re: Crash using copy and paste (reproducable)
« Reply #25 on: February 12, 2007, 07:55:54 pm »
Thanks for the instruction.  :D

But I would like to ask another question regarding debugging of wxWidgets based app with GDB in Linux. I read the following post in wxWidgets forum.

http://wxforum.shadonet.com/viewtopic.php?t=12530

It says that the user can't see the contents of wxString with GDB in Unicode mode. I tried it and found that in C::B too, in Watches Window I can't see the wxString contents. AFAIK it's possible to view the contents of wxString in Unicode mode with MS Debugger. Why is it so? :)

I suppose because unicode is so full of zeros. It makes it look like the string is empty.

You would need a script to call cbU2C(my watched string) to make it into a c_str.

Just a guess.

I'm no script wizard, not even a novice, but you might be able to issue these commands to gdb and show the results:

Code
bool testwxApp::OnInit()
{
testwxFrame* frame = new testwxFrame(0L, _("wxWidgets Application Template"));
frame->SetIcon(wxICON(aaaa)); // To Set App Icon
frame->Show();

wxString msg;
msg = wxT("test unicode string");
asm("int3");
return true;
}

C:\temp\testwx\bin>gdb testwx.exe
GNU gdb 6.3
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-mingw32"...
(gdb) run
Starting program: C:\temp\testwx\bin/testwx.exe
gdb: do_initial_child_stuff: process 1572
gdb: kernel event for pid=1572 tid=288 code=CREATE_PROCESS_DEBUG_EVENT)
gdb: child_resume.SetThreadContext: thread 1572.0x120
ContinueDebugEvent (cpid=1572, ctid=288, DBG_CONTINUE);
<snip>
Program received signal SIGTRAP, Trace/breakpoint trap.
testwxApp::OnInit (this=0xb59290) at C:/temp/testwx/testwxApp.cpp:32
32              return true;
Current language:  auto; currently c++
(gdb) l
27              frame->Show();
28
29              wxString msg;
30              msg = wxT("test unicode string");
31              asm("int3");
32              return true;
33      }
(gdb) p msg
$1 = {<wxStringBase> = {static npos = 4294967295,
    m_pchData = 0xb6a654}, <No data fields>}
(gdb) p msg.m_pchData
$2 = (wxChar *) 0xb6a654
(gdb) x/20s msg.m_pchData
0xb6a654:        "t"
0xb6a656:        "e"
0xb6a658:        "s"
0xb6a65a:        "t"
0xb6a65c:        " "
0xb6a65e:        "u"
0xb6a660:        "n"
0xb6a662:        "i"
0xb6a664:        "c"
0xb6a666:        "o"
0xb6a668:        "d"
0xb6a66a:        "e"
0xb6a66c:        " "
0xb6a66e:        "s"
0xb6a670:        "t"
0xb6a672:        "r"
0xb6a674:        "i"
0xb6a676:        "n"
0xb6a678:        "g"
0xb6a67a:        ""
(gdb)
« Last Edit: February 12, 2007, 08:30:49 pm by Pecan »

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Crash using copy and paste (reproducable)
« Reply #26 on: February 13, 2007, 05:48:20 am »
Thanks for the details.  :D

Today I ran C::B through GDB. I got no crash during Copy-Paste operation. But I got some warning and critical error messages and one SIGSEGV fault. I'm attaching the full log alongwith BackTrace.

I'll post a link to your reply in wxWidgets forum, may be that would be helpful for the user.

I'm no script wizard, not even a novice, but you might be able to issue these commands to gdb and show the results:

BTW, I'm no script wiz, too. ;)  Coz I was working on modifying the project wizards of C::B, I got that name.  :D

Please post if you need more GDB logs.

Regards,

Biplab



Edit 1: I observed the SIGSEGV fault during exit. :)

[attachment deleted by admin]
« Last Edit: February 13, 2007, 12:44:10 pm by Biplab »
Be a part of the solution, not a part of the problem.

fleuba

  • Guest
Re: Crash using copy and paste (reproducable)
« Reply #27 on: February 13, 2007, 10:44:20 am »
Hi all,

C::B just crashed during copying a piece of code.
Attached is the backtrace, with some info on top of the file.

I'm available to help fixing this bug...
Give me instructions here to search, what to test for you.

CU,
Fred

[attachment deleted by admin]