From: Jason Luo <jasonl@turbolinux.com.cn>
To: gdb@sources.redhat.com
Subject: What make the directive run twice?
Date: Thu, 03 Jun 2004 07:10:00 -0000 [thread overview]
Message-ID: <40BECE4F.7090002@turbolinux.com.cn> (raw)
Hi all,
I use gdb 6.1 to debug Grub 0.94.When I debug the function check_device
in lib/device.c,I found that the fopen directive was run twice.
[root@jason build]# gdb grub/grub
.........
(gdb) b device.c:617
Breakpoint 1 at 0x805dc29: file ../../lib/device.c, line 617.
(gdb) r
Starting program: /home/jason/sources/grub-0.94/build/grub/grub
Probing devices to guess BIOS drives. This may take a long time.
Breakpoint 1, init_device_map (map=0x806609c, map_file=0xbfffd350 "",
floppy_disks=1)
at ../../lib/device.c:617
617 get_ide_disk_name (name, i);
(gdb) n
618 if (check_device (name))
(gdb) s //here,I step in check_device
check_device (device=0xbfffd350 "/dev/hda") at ../../lib/device.c:321
321 if (*device == 0)
(gdb) p device
$1 = 0xbfffd350 "/dev/hda"
(gdb) n
324 fp = fopen (device, "r");
(gdb)
325 if (! fp)
(gdb)
346 return 0; //return from here,but...
(gdb)
324 fp = fopen (device, "r"); //come to here!!!
(gdb) p device
$2 = 0x8073860 "\210$?" //the parameter device was changed!!!!
(gdb) n
346 return 0; //return from here,but
(gdb)
353 if (ioctl (fileno (fp), CDROM_GET_CAPABILITY, 0) >= 0)
(gdb)
When this section in gdb,the process is not correct and the device
parameter of check_device function was changed.
what cause it?How can I do it?
My env is gcc 3.3.1,glibc 2.3.2,Intel(R) Pentium(R) 4 CPU 2.60GHz with HT.
Jason
next reply other threads:[~2004-06-03 7:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-03 7:10 Jason Luo [this message]
2004-06-03 20:44 ` Daniel Jacobowitz
2004-06-04 2:34 ` Jason Luo
2004-06-04 12:11 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=40BECE4F.7090002@turbolinux.com.cn \
--to=jasonl@turbolinux.com.cn \
--cc=gdb@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox