Conference Room SAD
[thread display] [new arrival display] [word search] [past log] [管理用]

Subject Re^4: Install SAD on FreeBSD/amd64 9.3
Date: 2014/08/04(Mon) 14:15:13
ContributorAkio Morita

> > > > 東北大の武藤です
> > > >
> > > > intel corei5のマシンにFreeBSD/amd64 9.3を導入してSADをインストールを試みたのですが
> > > >
> > > > コンパイルは通ったようなのですがexampleの実行でこけていることがわかりました
> > > >
> > > > oldsad/bin/gsは生成されているので単体で実行したところ
> > > > $ ./gs
> > > > *** Welcome to SAD Ver.1.0.10.6.13.2k64 built at 2014-07-31 02:39:25 +0900 ***
> > > > *** Today: 02:40:44 Thursday 07/31/2014 ***
> > > > Segmentation fault
> > > > のように単体で実行してもセグメンテーションフォルトですぐに落ちてしまいます
> > > >
> > > > まったく情報が足りないと思いますが何かお気づきの点があれば教えていただきたいです
> > > >
> > > 何が起こっているかを把握するために、-g -O1辺りでコンパイルして、SEGVで生成された core fileから
> > > バックトレースを取るべきです
> > >
> > > また、COPTへ -DDEBUG_MEMORY=3を付けてコンパイルするとSADの内部allocatorからデバックメッセージが取り出せます
> >
> > コメントありがとうございます
> > 試してみました。結果は以下のようになりました
> >
> > -DDEBUG_MEMORY=3を付けて実行
> > > bin/gs
> > *** Welcome to SAD Ver.1.0.10.6.13.2k64 built at 2014-08-04 01:31:35 +0900 ***
> > *** Today: 01:54:28 Monday 08/04/2014 ***
> > lminit: rlist0=0x800000000 align=8 bits=61 offset=0
> > Segmentation fault (core dumped)
> >
> > コアファイルをみてみると
> > > gdb771 obj/AMD64-FreeBSD9/sad1.exe sad1.exe.core
> > GNU gdb (GDB) 7.7.1 [GDB v7.7.1 for FreeBSD]
> > Copyright (C) 2014 Free Software Foundation, Inc.
> > License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> > This is free software: you are free to change and redistribute it.
> > There is NO WARRANTY, to the extent permitted by law. Type "show copying"
> > and "show warranty" for details.
> > This GDB was configured as "x86_64-portbld-freebsd9.3".
> > Type "show configuration" for configuration details.
> > For bug reporting instructions, please see:
> > <http://www.gnu.org/software/gdb/bugs/>.
> > Find the GDB manual and other documentation resources online at:
> > <http://www.gnu.org/software/gdb/documentation/>.
> > For help, type "help".
> > Type "apropos word" to search for commands related to "word"...
> > Reading symbols from obj/AMD64-FreeBSD9/sad1.exe...done.
> > [New process 100114]
> > Cannot access memory at address 0x800aa9808
> > Cannot access memory at address 0x800aa9800
> > (gdb) where
> > #0 0x000000080330e3c0 in ?? ()
> > #1 0x00007ffffffff003 in ?? ()
> > #2 0x000000080330e3c0 in ?? ()
> > #3 0x0000000000000000 in ?? ()
> > (gdb)
> >
> > 別途gdb上でrunしてみると
> > (gdb) run
> > Starting program: /usr/home/tmuto/oldsad/obj/AMD64-FreeBSD9/sad1.exe
> > [New LWP 100251]
> > [New Thread 80501f400 (LWP 100251)]
> > *** Welcome to SAD Ver.1.0.10.6.13.2k64 built at 2014-08-04 01:31:35 +0900 ***
> > *** Today: 02:42:21 Monday 08/04/2014 ***
> > lminit: rlist0=0x800000000 align=8 bits=61 offset=0
> > [New LWP 100251]
> >
> > Program received signal SIGSEGV, Segmentation fault.
> > [Switching to LWP 100251]
> > 0x000000080303207c in ?? () from /lib/libc.so.7
> > (gdb) where
> > #0 0x000000080303207c in ?? () from /lib/libc.so.7
> > #1 0x0000000000423a1d in mapallocfixed8_ (base=0x800000000,
> > usize=usize@entry=0x7fffffffe448, unit=unit@entry=0x649a3c,
> > irtc=irtc@entry=0x7fffffffe45c)
> > at /usr/home/tmuto/oldsad/src/sim/unix_memory_.c:412
> > #2 0x00000000004adad3 in tfstk::talocinit ()
> > at /usr/home/tmuto/oldsad/src/tfstk.f:348
> > #3 0x000000000043c1a1 in inimem () at /usr/home/tmuto/oldsad/src/pfalloc.f:24
> > #4 0x0000000000422b36 in MAIN__ () at /usr/home/tmuto/oldsad/src/MAIN.f:27
> > (gdb)
> >
> > のような結果を得ましたがこれでなにか情報は得られるでしょうか?
> > 正直なところ当方浅学のためよくわかりません
> >
> src/sim/unix_memory_.c(正確には、unix_memory8_.c)にある mapallocfixed_()にて、mmap(2)の呼び出しで失敗しているようです
> mmap(2)の呼び出しの確認前後の状況は、ktrace(1)/kdump(1)で確認できるかと思われます
>
> inimem_()から始まる一連のSAD内部のheap管理構造の初期化に失敗しているので、
> その辺のコードを修正すれば良いと思います
>
つらつらと眺めた限り、src/tfstk.fで定義されている maccbk module内の integer(8), pointer: klist(:)が未初期化のまま
call lminitにてdereferenceされてるのが原因かなぁ・・・

多分、未定義動作になるので、SEGVしても Fortran的には正しい実装動作です


- 関連一覧ツリー (Click ▼ to display all articles in a thread.)