Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

Help reading codeblocks.RPT

<< < (6/7) > >>

ollydbg:

--- Quote from: daniloz on June 15, 2012, 08:33:31 am ---Thanks for the hint. However, I inspected the path and the running process and indeed it's C::B exchndl which is loaded.
I also tried to compile a test program from here including the exchndl.dll from C::B and it works, I got a report with the right information...

--- End quote ---
I can't understand how(what is the steps) you did this?  

--- Quote ---So, my next task is to be able to easily reproduce a crash from C::B, but I can't, since the code from ollydbg doesn't produce a crash and I don't understand why...

--- End quote ---
Why? You mean put the code below:

--- Code: ---char * p = 0;
 *p = 0;

--- End code ---
in C::B source does not cause a crash??

EDIT:
Produce a crash is quite easy:

--- Code: ---void CodeCompletion::OnProjectClosed(CodeBlocksEvent& event)
{
    char * p = 0;
    *p = 0;
...


--- End code ---

You see, the code is in the event handler: OnProjectClosed, reproduce the crash is quite simple, you run the c::b, and open a project, then you close the project, this will trigger the OnProjectClosed function be called, then you will get c::b crash. :)

daniloz:

--- Quote from: ollydbg on June 15, 2012, 08:42:23 am ---
--- Quote from: daniloz on June 15, 2012, 08:33:31 am ---Thanks for the hint. However, I inspected the path and the running process and indeed it's C::B exchndl which is loaded.
I also tried to compile a test program from here including the exchndl.dll from C::B and it works, I got a report with the right information...

--- End quote ---
I can't understand how(what is the steps) you did this?  

--- End quote ---
I did a new console project with the following code to test if the eschndl.dll library was being loaded and working (and it works perfectly fine, as expected, generating a RPT file with all information):

--- Code: ---/* test-c.c
#include <stdio.h>
#include <iostream>
#include "windows.h"

using namespace std;

typedef char * cp;

static void YetAnotherFunction( int i, double j, const char * pszString )
{
        int k;

#if 0
        /* Other ways to cause a GPF */
        *(int *)i = 5;
        __asm ("int $3");
        (*((void (*)(void)) 0x12345678))();
#endif

        sscanf("12345", "%i", (int *) (k=i));
}

static void MyWonderfulFunction( int i, float j )
{
        YetAnotherFunction( i * 2, j, "Hello" );
}

int main()
{
    cout << "Hello world!" << endl;

DWORD err;
    HINSTANCE hDLL = LoadLibrary("exchndl.dll");
    if(hDLL != NULL)
{
printf("Library has been loaded\n");
}
else
{
        err = GetLastError();
printf("Couldn't load dll\n");
}

    MyWonderfulFunction( 4, float(5.6) );

    return 0;
}

--- End code ---



--- Quote from: ollydbg on June 15, 2012, 08:42:23 am ---So, my next task is to be able to easily reproduce a crash from C::B, but I can't, since the code from ollydbg doesn't produce a crash and I don't understand why...
Why? You mean put the code below:

--- Code: ---char * p = 0;
 *p = 0;

--- End code ---
in C::B source does not cause a crash??

You see, the code is in the event handler: OnProjectClosed, reproduce the crash is quite simple, you run the c::b, and open a project, then you close the project, this will trigger the OnProjectClosed function be called, then you will get c::b crash. :)

--- End quote ---
That's what I did and when I close the project, the project is not closed because something goes wrong, but I get the Start window and there's no crash.  :o

If I run it with the debugger, then I get a SEGMENTATION FAULT.

ollydbg:

--- Quote from: daniloz on June 15, 2012, 08:54:37 am ---
--- Code: ---int main()
{
    cout << "Hello world!" << endl;

DWORD err;
    HINSTANCE hDLL = LoadLibrary("exchndl.dll");
    if(hDLL != NULL)
{
printf("Library has been loaded\n");
}
else
{
        err = GetLastError();
printf("Couldn't load dll\n");
}

    MyWonderfulFunction( 4, float(5.6) );

    return 0;
}

--- End code ---

--- End quote ---
Aha, I understand now, you just load the exchndl.dll in your app.


--- Quote ---
--- Quote from: ollydbg on June 15, 2012, 08:42:23 am ---So, my next task is to be able to easily reproduce a crash from C::B, but I can't, since the code from ollydbg doesn't produce a crash and I don't understand why...
Why? You mean put the code below:

--- Code: ---char * p = 0;
 *p = 0;

--- End code ---
in C::B source does not cause a crash??

You see, the code is in the event handler: OnProjectClosed, reproduce the crash is quite simple, you run the c::b, and open a project, then you close the project, this will trigger the OnProjectClosed function be called, then you will get c::b crash. :)

--- End quote ---
That's what I did and when I close the project, the project is not closed because something goes wrong, but I get the Start window and there's no crash.  :o

If I run it with the debugger, then I get a SEGMENTATION FAULT.

--- End quote ---
What does "Start window" mean? It looks like "something goes wrong" are quite different in your system and mine. In my system(WinXP), the c::b just crashed and closed, then I can see the correct report file with line information.

daniloz:

--- Quote from: ollydbg on June 15, 2012, 09:03:41 am ---What does "Start window" mean? It looks like "something goes wrong" are quite different in your system and mine. In my system(WinXP), the c::b just crashed and closed, then I can see the correct report file with line information.

--- End quote ---
"Start Window" is the "Start Here" windows from C::B where you have the logo, list of recent projects and files...
I agree that "something goes wrong" is very strange on my system (Win7 x64), but I don't understand why...

ollydbg:

--- Quote from: daniloz on June 15, 2012, 09:06:23 am ---
--- Quote from: ollydbg on June 15, 2012, 09:03:41 am ---What does "Start window" mean? It looks like "something goes wrong" are quite different in your system and mine. In my system(WinXP), the c::b just crashed and closed, then I can see the correct report file with line information.

--- End quote ---
"Start Window" is the "Start Here" windows from C::B where you have the logo, list of recent projects and files...
I agree that "something goes wrong" is very strange on my system (Win7 x64), but I don't understand why...

--- End quote ---
Ok, it looks like this code does not crash c::b on you win7 system. (Win7 is robust than WinXP)
What I can suggest is you can write to some other address:


--- Code: ---char * p = anyIntValue;
*p = 0;

--- End code ---
Then, change anyIntValue until your c::b crashed, or you just do a loop like:

--- Code: ---for (int i=0;i<0xfffffffffff;i++)
{
char * p = i;
*p = 0;
}

--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version