- 论坛徽章:
- 0
|
回复 #1 wliang511 的帖子
- [?1034hGNU gdb Red Hat Linux (6.6-8.fc7rh)
- Copyright (C) 2006 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 "i386-redhat-linux-gnu".
- (gdb) file a.out
- Reading symbols from /home/share/driver/cdev/exam_1/test/a.out...done.
- Using host libthread_db library "/lib/libthread_db.so.1".
- (gdb) l
- 272
- 273 }
- 274
- 275 int main(void)
- 276 {
- 277 char bufp[300];
- 278 unsigned long off;
- 279 int ret;
- 280
- 281 memset(bufp,0xee,sizeof(bufp));
- (gdb) b 281
- Breakpoint 1 at 0x80488d4: file scull.c, line 281.
- (gdb) r
- Starting program: /home/share/driver/cdev/exam_1/test/a.out
- Breakpoint 1, main () at scull.c:281
- 281 memset(bufp,0xee,sizeof(bufp));
- (gdb) n
- 283 scull_init();
- (gdb)
- 285 off = 0;
- (gdb)
- 287 ret = scull_write(myscull,bufp,300,&off);
- (gdb) s
- scull_write (devp=0x8049bf0, bufp=0xbfff0654 '? <repeats 200 times>..., count=300,
- offp=0xbfff0650) at scull.c:97
- 97 int ret = 0,i;
- (gdb)
- 106 if (devp == NULL)
- (gdb)
- 111 devp->data = malloc(sizeof(struct scull_qset));
- (gdb)
- 112 if (devp->data == NULL)
- (gdb) p devp-?data[K[K[K[K[K>data
- $1 = (struct scull_qset *) 0x8429008
- (gdb) s
- 117 itemp = devp->data;
- (gdb)
- 118 itemp->data = NULL;
- (gdb)
- 119 itemp->next = NULL;
- (gdb)
- 121 itemp->data = malloc(sizeof(devp->qset * sizeof(char *)));
- (gdb)
- 122 if (itemp->data == NULL)
- (gdb) p itemp-?[K>data
- $2 = (void **) 0x8429018
- (gdb) p itemp
- $3 = (struct scull_qset *) 0x8429008
- (gdb) s
- 128 for (i = 0;i < devp->qset;i ++)
- (gdb)
- 129 itemp->data[i] = NULL;
- (gdb) l
- 124 ret = -5;
- 125 goto out;
- 126 }
- 127 //memset((void *)itemp->data,0,sizeof(devp->qset * sizeof(char *)));
- 128 for (i = 0;i < devp->qset;i ++)
- 129 itemp->data[i] = NULL;
- 130
- 131
- 132
- 133 return 0;
- (gdb) u 133
- scull_write (devp=0x8049bf0, bufp=0xbfff0654 '? <repeats 200 times>..., count=300,
- offp=0xbfff0650) at scull.c:133
- 133 return 0;
- (gdb) s
- 217 }
- (gdb)
- main () at scull.c:291
- 291 scull_exit();
- (gdb)
- scull_exit () at scull.c:246
- 246 for (i = 0;i < MYSCULL_NO;i ++)
- (gdb)
- 248 qsetnp = myscull[i].data;
- (gdb)
- 249 while (qsetnp != NULL)
- (gdb)
- 251 if (qsetnp->data != NULL)
- (gdb)
- 253 for (j = 0;j < myscull[i].qset;j++)
- (gdb) p qsetnp
- $4 = (struct scull_qset *) 0x8429008
- (gdb) p s[Kqsetnp_[K-?dat[K[K[K[K>data
- $5 = (void **) 0x8429018
- (gdb) s
- 255 if (qsetnp->data[j] != NULL)
- (gdb)
- 253 for (j = 0;j < myscull[i].qset;j++)
- (gdb) l
- 248 qsetnp = myscull[i].data;
- 249 while (qsetnp != NULL)
- 250 {
- 251 if (qsetnp->data != NULL)
- 252 {
- 253 for (j = 0;j < myscull[i].qset;j++)
- 254 {
- 255 if (qsetnp->data[j] != NULL)
- 256 free(qsetnp->data[j]);
- 257 }
- (gdb) l 256
- 251 if (qsetnp->data != NULL)
- 252 {
- 253 for (j = 0;j < myscull[i].qset;j++)
- 254 {
- 255 if (qsetnp->data[j] != NULL)
- 256 free(qsetnp->data[j]);
- 257 }
- 258 free(qsetnp->data);
- 259 }
- 260 qsetp = qsetnp;
- (gdb) u 260
- scull init return:0
- Program received signal SIGABRT, Aborted.
- 0x0092c402 in __kernel_vsyscall ()
- (gdb) q
- The program is running. Exit anyway? (y or n) Not confirmed.
- (gdb) bt
- #0 0x0092c402 in __kernel_vsyscall ()
- #1 0x00129fa0 in raise () from /lib/libc.so.6
- #2 0x0012b8b1 in abort () from /lib/libc.so.6
- #3 0x00160ebb in __libc_message () from /lib/libc.so.6
- #4 0x00168f41 in _int_free () from /lib/libc.so.6
- #5 0x0016c580 in free () from /lib/libc.so.6
- #6 0x08048819 in scull_exit () at scull.c:258
- #7 0x08048931 in main () at scull.c:291
- (gdb) quit[K[K[K
- The program is running. Exit anyway? (y or n)
复制代码 |
|