From owner-FreeBSD-users-jp@jp.FreeBSD.org Wed Jun 18 17:56:40 2008
Received: (from daemon@localhost)
	by castle.jp.FreeBSD.org (8.11.6p2+3.4W/8.11.3) id m5I8ueV85534;
	Wed, 18 Jun 2008 17:56:40 +0900 (JST)
	(envelope-from owner-FreeBSD-users-jp@jp.FreeBSD.org)
Received: from outmail1.nikon.co.jp (outmail1.nikon.co.jp [133.169.10.12])
	by castle.jp.FreeBSD.org (8.11.6p2+3.4W/8.11.3) with ESMTP/inet id m5I8ue985529
	for <FreeBSD-users-jp@jp.FreeBSD.org>; Wed, 18 Jun 2008 17:56:40 +0900 (JST)
	(envelope-from osawa.hisao@nikon.co.jp)
Received: by outmail1.nikon.co.jp (Postfix, from userid 60001)
	id 08CF25D9; Wed, 18 Jun 2008 17:56:39 +0900 (JST)
Received: from mailhub4.nikon.co.jp (unknown [133.169.3.14])
	by outmail1.nikon.co.jp (Postfix) with ESMTP id B69FD549
	for <FreeBSD-users-jp@jp.FreeBSD.org>; Wed, 18 Jun 2008 17:56:39 +0900 (JST)
Received: from mailhub4.nikon.co.jp (localhost [127.0.0.1])
	by localhost.nikon.co.jp (Postfix) with ESMTP id 8A79154C
	for <FreeBSD-users-jp@jp.FreeBSD.org>; Wed, 18 Jun 2008 17:56:39 +0900 (JST)
Received: from Bellatrix.nikon.co.jp.nikon.co.jp (unknown [10.203.122.30])
	by mailhub4.nikon.co.jp (Postfix) with ESMTP id 71FCA545
	for <FreeBSD-users-jp@jp.FreeBSD.org>; Wed, 18 Jun 2008 17:56:39 +0900 (JST)
From: "Hisao Osawa" <osawa.hisao@nikon.co.jp>
To: FreeBSD-users-jp@jp.FreeBSD.org
User-Agent: Wanderlust/2.14.0 (Africa) EMIKO/1.14.1 (Choanoflagellata) LIMIT/1.14.10 (Furuichi) APEL/10.7 Emacs/22.1 (i386-pc-freebsd) MULE/5.0 (SAKAKI)
Organization: Nikon Corporation
MIME-Version: 1.0 (generated by EMIKO 1.14.1 - "Choanoflagellata")
Content-Type: text/plain; charset=ISO-2022-JP
Message-Id: <20080618085639.71FCA545@mailhub4.nikon.co.jp>
Reply-To: FreeBSD-users-jp@jp.FreeBSD.org
Precedence: list
Date: Wed, 18 Jun 2008 17:57:05 +0900
X-Sequence: FreeBSD-users-jp 91693
Subject: [FreeBSD-users-jp 91693] gcc -pg
Sender: owner-FreeBSD-users-jp@jp.FreeBSD.org
X-Originator: osawa.hisao@nikon.co.jp
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+060209

$BBg_7$G$9(B

  $B<B9T%U%!%$%k$N%W%m%U%!%$%k$r$H$m$&$H$7$F$D$^$:$$$F$$$^$9!#(B
  -pg$B%*%W%7%g%s$r$D$1$k$H(Bmain()$B$X$N0z?tEO$7$,$G$-$J$/$J$C$F(B
$B$$$k$h$&$G$9!#(B
  gcc$B$O(B7.0-Stable$B$N(Bgcc-4.2.1$B$H(Bports$B$N(Bgcc-4.3.1$B$NN>J}$G5/$3$j$^$9!#(B

> cat hello.c
#include <stdio.h>

int main(int argc, char **argv)
{
  printf("hello world: %d, %s\n", argc, argv[1]);
}
> gcc -g -o hello hello.c
> ./hello abc
hello world: 2, abc

$B$H$J$k$o$1$G$9$,!"(B

> gcc -pg -g -o hello hello.c
> ./hello abc
Segmentation fault (core dumped)
> gdb ./hello
GNU gdb 6.1.1 [FreeBSD]
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 "i386-marcel-freebsd"...
(gdb) b main
Breakpoint 1 at 0x80481e0: file hello.c, line 4.
(gdb) run abc
Starting program: /home/osawa/Microsc/SIM/restoration/newsrc/IM2/hello abc
SSH_TTY: Undefined variable.

Breakpoint 1, main (argc=Error accessing memory address 0x1ea8c: Bad address.
) at hello.c:4
4       {
(gdb) s

Program received signal SIGSEGV, Segmentation fault.
main (argc=Error accessing memory address 0x19: Bad address.
) at hello.c:5
5         printf("hello world: %d, %s\n", argc, argv[1]);

$B$H$J$C$F$7$^$$$^$9!#(B


-- 
$B!!Bg_7!!F|:4M:!!!!(Bosawa.hisao@nikon.co.jp$B!!(B $B!y%_(B
