| PLEX86 | ||
|
file pointers in gdbVim on really old Laptop Slackware 2590 Unfortunately much of this is babbling-- ie many words with very little data. What does your... I'm writing some code that does a lot of moving around and manipulating stuff inside files. I have trouble debugging it because so much of it is going on in files and I haven't learned how to see what is inside the files from inside gdb. For example, in a simple program that just opens the file README and reads 4 characters from it (snip indicates where I truncated what gdb wrote): (gdb) b main Breakpoint 1 at 0x80484e6: file hello.c, line 7. (gdb) r Starting program:home-allan-a.out Breakpoint 1, main () at hello.c:7 7 fp = fopen("README","r"); (gdb) n 8 c = fgetc(fp); (gdb) print *fp $1 = {flags = -72539000, IOreadptr = 0x0, IOreadend = 0x0, IOreadbase = 0x0, IOwritebase = 0x0, IOwriteptr = 0x0, IOwriteend = 0x0, IObufbase = 0x0, IObufend = 0x0, IOsavebase = 0x0, IObackupbase = 0x0, IOsaveend = 0x0, markers = 0x0, chain = 0x4014abe0, fileno = 5, blksize = 0, oldoffset = 0, curcolumn = 0, vtableoffset = 0 '-000', shortbuf = , lock = 0x8049780, offset = -1, pad1 = 0x0, pad2 = 0x8049798, (gdb) n 9 c = fgetc(fp); (gdb) print *fp $2 = {flags = -72539000, IOreadptr = 0x40018001 "ug.5, 2005-n", '=' snip IOreadbase = 0x40018000 "Aug.5, 2005-n", '=' snip IOwritebase = 0x40018000 "Aug.5, 2005-n", '=' snip IOwriteptr = 0x40018000 "Aug.5, 2005-n", '=' snip IOwriteend = 0x40018000 "Aug.5, 2005-n", '=' snip IObufbase = 0x40018000 "Aug.5, 2005-n", '=' snip IOsavebase = 0x0, IObackupbase = 0x0, IOsaveend = 0x0, markers = 0x0, chain = 0x4014abe0, fileno = 5, blksize = 0, oldoffset = 0, curcolumn = 0, vtableoffset = 0 '-000', shortbuf = , lock = 0x8049780, offset = -1, pad1 = 0x0, pad2 = 0x8049798, Creating & tracking invoices for products Greetings. I work for a small non-profit organization, part of whose activity includes publishing literature and audio-video discs, and selling them direct to bookstores and... Vim on really old Laptop Slackware 2591 As you have discovered, using floppies and installing an extremely old version of Slackware is not going to work. I buttume your laptop does have a... It's clear that IOreadptr points to the first (counting from zero) character of the file in this instance, but several of the other fields are identical to each other and start at the beginning of the file. There is nothing that seems to give the value of ftell at that point, even though I can certainly tell gdb to print ftell(fp). So, how do I make better use of the various fields of *fp from inside gdb? -- Ignorantly, * Disclaimer: I am a guest and *not* a member of the MIT CSAIL. My actions and * comments do not reflect in any way on MIT. Also, I am nowhere near Boston.
|
||||
Creating & tracking invoices for products Linux groups from Newsgroups The #1 Usenet Provider on the Internet
|
||||