(gdb) run
Starting program: /export/virtual/usermode/machine.test/uml_moo root_fs.cow
newroot
Program received signal SIGFPE, Arithmetic exception.
0x0000000000402021 in read_cow_header (reader=0x401d51 <file_reader>,
arg=0x7fffffffe1b4, version_out=0x7fffffffe0cc,
backing_file_out=0x7fffffffe0b8, mtime_out=0x7fffffffe0b0,
size_out=0x7fffffffe0e0, sectorsize_out=0x7fffffffe0ac,
align_out=0x7fffffffe0c8, bitmap_offset_out=0x7fffffffe0a8) at
cow.c:309
309 *bitmap_offset_out = ROUND_UP(sizeof(header->v3),
*align_out);
(gdb)
The relevant piece of code is (in cow.c, read_cow_header() ):
else if(version == 3){
if(n < sizeof(header->v3)){
cow_printf("read_cow_header - failed to read V2 "
"header\n");
goto out;
}
*mtime_out = ntohl(header->v3.mtime);
*size_out = ntohll(header->v3.size);
*sectorsize_out = ntohl(header->v3.sectorsize);
*align_out = ntohl(header->v3.alignment);
*bitmap_offset_out = ROUND_UP(sizeof(header->v3), *align_out);
file = header->v3.backing_file;
}
Where did the version three thing enter? I'm running 2.6.13.4-bs4, and the
cow file was created just now. I thought only v1 and v2 were supported?
I added three lines of code to be able to see some values in plain text:
else if(version == 3){
if(n < sizeof(header->v3)){
cow_printf("read_cow_header - failed to read V2 "
"header\n");
goto out;
}
*mtime_out = ntohl(header->v3.mtime);
*size_out = ntohll(header->v3.size);
*sectorsize_out = ntohl(header->v3.sectorsize);
*align_out = ntohl(header->v3.alignment);
int headersize = sizeof(header->v3);
cow_printf("Size of header: %d\n", headersize);
cow_printf("Alignment: %d\n\n", header->v3.alignment);
*bitmap_offset_out = ROUND_UP(sizeof(header->v3), *align_out);
file = header->v3.backing_file;
}
Gdb now says:
(gdb) run
Starting program: /export/virtual/usermode/machine.test/uml_moo
root_fs.cow newroot
Size of header: 4136
Alignment: 0
Program received signal SIGFPE, Arithmetic exception.
0x0000000000402050 in read_cow_header (reader=0x401d51 <file_reader>,
arg=0x7fffffffe1b4, version_out=0x7fffffffe0cc,
backing_file_out=0x7fffffffe0b8, mtime_out=0x7fffffffe0b0,
size_out=0x7fffffffe0e0, sectorsize_out=0x7fffffffe0ac,
align_out=0x7fffffffe0c8, bitmap_offset_out=0x7fffffffe0a8) at
cow.c:312
312 *bitmap_offset_out = ROUND_UP(sizeof(header->v3),
*align_out);
(gdb)
Is this a division by zero thingie?
This is how far my C knowledge runs atm. I actually programmed some C like
seven years ago, but that obviously was a bit too long ago. :-)
// Joel
On Tue, 18 Oct 2005, Blaisorblade wrote:
On Tuesday 18 October 2005 00:29, Joel Palmius wrote:
It was altogether too long since I did any lowlevel programming. I must
admit I don't get a whole lot out of gdb.
[EMAIL PROTECTED] /export/virtual/usermode/machine.test $ gdb --args
/usr/bin/uml_moo root_fs.cow newroot
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 "x86_64-pc-linux-gnu"...(no debugging symbols
found)
(no debugging symbols found)
(no debugging symbols found)
See this?
Program received signal SIGFPE, Arithmetic exception.
(gdb) backtrace
#0 0x00000000004018b1 in ?? ()
#1 0x0000000000400d61 in ?? ()
#2 0x00000000004011ac in ?? ()
#3 0x00002aaaaabddd00 in __libc_start_main () from /lib/libc.so.6
#4 0x0000000000400c5a in ?? ()
#5 0x00007fffffffe2a8 in ?? ()
#6 0x000000000000001c in ?? ()
Well, this certainly doesn't tell me a whole lot. :-)
This didn't tell me a whole lot either. :-)
I hope any of this was more intelligible to someone else than it was to
me. Otherwise, suggest what I should do further to debug.
Recompile with -g (and probably without -O, or with -O0), that would give a
sensible backtrace. And you can say "frame n" and inspect local vars, to see
what's happening. That's why I suggest -O0 (no optim).
Finally, (see info gdb - TUI) there's a semi-graphical GDB user interface,
which is useful (just make sure to look at the keybindings before - without
them you wouldn't go far).
Additionally, what you did is already far more than a newbie would have
done...
--
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade
___________________________________
Yahoo! Messenger: chiamate gratuite in tutto il mondo
http://it.messenger.yahoo.com
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
User-mode-linux-user mailing list
User-mode-linux-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
User-mode-linux-user mailing list
User-mode-linux-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user