From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23205 invoked by alias); 3 Jun 2004 07:10:44 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 23194 invoked from network); 3 Jun 2004 07:10:40 -0000 Received: from unknown (HELO ns.turbolinux.com.cn) (210.77.38.126) by sourceware.org with SMTP; 3 Jun 2004 07:10:40 -0000 Received: from turbolinux.com.cn (kunlun.turbolinux.com.cn [202.108.132.18]) by ns.turbolinux.com.cn (8.12.5/8.12.5) with ESMTP id i537GoNM011381 for ; Thu, 3 Jun 2004 15:16:50 +0800 Message-ID: <40BECE4F.7090002@turbolinux.com.cn> Date: Thu, 03 Jun 2004 07:10:00 -0000 From: Jason Luo User-Agent: Mozilla/5.0 (X11; U; Linux i686; zh-CN; rv:1.6) Gecko/20040601 MIME-Version: 1.0 To: gdb@sources.redhat.com Subject: What make the directive run twice? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-MailScanner-Information: Please contact the ISP for more information X-MailScanner: Found to be clean X-SW-Source: 2004-06/txt/msg00018.txt.bz2 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