gdb debugging

Need help with C, C++, perl, python, etc?

gdb debugging

Postby cassio » 2007-02-17 16:38

Hello,

Everytime I use gdb I get a strange warning and I would like to know if that's a problem or what that is.

For example:

The following code:

Code: Select all
int main()
{
    int x = 1;
    x++;
    return 0;

}


if compiled:

Code: Select all
$ gcc -g hello.c -o hello


and started in gdb:

Code: Select all
$ gdb ./hello


if i break at main:

Code: Select all
(gdb) b main
Breakpoint 1 at 0x8048335: file hello.c, line 3.
(gdb) run
Starting program: /home/user/hello
Failed to read a valid object file image from memory.

Breakpoint 1, main () at hello.c:3
3           int x = 1;



What does that warning "Failed to read a valid object file image from memory." mean?

Thank you.
cassio
 
Posts: 8
Joined: 2007-01-24 15:38

Postby Ed Hall » 2007-02-17 23:35

Sorry, not really a direct answer to your question, but thought I'd provide something, hopefully useful, at least. I'm also fairly new to linux, but your program ran fine for me. (I used the name Test1.) Here's what I show:

Code: Select all
(gdb) b main
Breakpoint 1 at 0x8048364: file Test1.c, line 3.
(gdb) run
Starting program: /home/tester/Programming/Test1

Breakpoint 1, main () at Test1.c:3
3           int x = 1;
(gdb)


In doing a Google search on the error you stated, there was mention of a couple of bug reports and it seemed that perhaps there was trouble with certain kernels in relation to this.

uname -r gives me 2.4.27-2-386 for my debian system, if that helps.

Sorry I couldn't provide more.

Take Care,
Ed
Ed Hall
 

Postby cassio » 2007-02-18 01:15

Thanks Ed, yeah, that seems to be a problem with newer kernels. i'm using 2.6.18-3-686. Hopefully it will be resolved in a future release of gdb.
cassio
 
Posts: 8
Joined: 2007-01-24 15:38


Return to Programming

Who is online

Users browsing this forum: No registered users and 5 guests

fashionable