Hi Jean,

Thanks for your help!


在 2017年06月03日 04:56, Jean Wolter 写道:
Hello Leslie,

On 02/06/17 11:33, Jean Wolter wrote:
I replaced my "ned" binary with yours and the system boots up fine.

Now I wonder how I could reproduce your problem. It looks like I

Since I neither have your binaries nor know how you build them
I follow the http://os.inf.tu-dresden.de/fiasco/build.html and http://l4re.org/build.html
and my environment is Fedora 24, gcc 6.3.1, qemu 2.6.2 and clang-5.0svn.
hello example is able to work :)


I thought about how you could diagnose the problem further. To demonstrate how to do this I intentionally added a null pointer dereference to ned and would like to discuss how I would diagnose this.
--- ned/server/src/main.cc    (revision 72)
+++ ned/server/src/main.cc    (working copy)
@@ -35,6 +35,8 @@
   Dbg::set_level(Dbg::Warn);
   info.printf("Hello from Ned\n");
 
+  *(int *)0 = 0;
+
   boot_info.printf("cmdline: ");
   for (int i = 0; i < argc; ++i)
     boot_info.cprintf("%s ", argv[i]);
1. Add -serial_esc -wait to kernel options in conf/modules.list
--- modules.list    (revision 72)
+++ modules.list    (working copy)
@@ -80,6 +80,7 @@
 module libuc_c.so
 
 entry framebuffer-example-x86
+kernel fiasco -serial_esc -wait
 roottask moe rom/x86-fb.cfg
 module x86-fb.cfg
 module l4re
If you boot this the kernel will enter the kernel debugger before doing anything else. Enter the following commands:
The kernel should stop when the access to 0x18 happens, then you can enter the kernel debugger using 'i' and can check who is responsible and maybe get a correct instruction pointer. If I do this here it looks like follows (I added -serial stdio to the qemu options):

qemu-system-x86_64 -kernel /home/jw5/build/tmp/l4re/bin/amd64_K8/bootstrap -append "bootstrap -modaddr 0x01100000" -serial stdio -initrd "/home/jw5/build/tmp/fiasco//fiasco -serial_esc -wait,/home/jw5/build/tmp/l4re/bin/amd64_K8/l4f/sigma0 ,/home/jw5/build/tmp/l4re/bin/amd64_K8/l4f/moe rom/x86-fb.cfg,/home/jw5/src/l4resvn/src/l4/conf/examples//x86-fb.cfg ,/home/jw5/build/tmp/l4re/bin/amd64_K8/l4f/l4re ,/home/jw5/build/tmp/l4re/bin/amd64_K8/l4f/ned ,/home/jw5/build/tmp/l4re/bin/amd64_K8/l4f/io ,/home/jw5/src/l4resvn/src/l4/pkg/io/io/config//x86-legacy.devs ,/home/jw5/src/l4resvn/src/l4/conf/examples//x86-fb.io ,/home/jw5/build/tmp/l4re/bin/amd64_K8/l4f/fb-drv ,/home/jw5/build/tmp/l4re/bin/amd64_K8/l4f/mag ,/home/jw5/build/tmp/l4re/bin/amd64_K8/l4f/ex_fb_spectrum_cc "
...
Freeing init code/data: 49152 bytes (12 pages)

Calibrating timer loop... done.

    ---------------------------------------------------------------------     
    CPU 0 [fffffffff003df99]: Wait
jdb: P+
when I input p+ then pressed Enter, but jdb did not print out "PF logging enabled" to me https://pbs.twimg.com/media/DBcu1DUUwAAkiDl.png


PF logging enabled
jdb: Pr restrict to addr in [0-100]     /* pressed Prx0<space>100<space> */
PF logging enabled, restricted to 0000000000000000 <= pfa <= 0000000000000100
jdb: g     /* g does no show up in output */
but input g then pressed Enter will continue to go https://pbs.twimg.com/media/DBc0XlWUAAAmgSN.png sorry I am not familiar with jdb, but have some experience with gdb.


...
MOE: cmdline: /home/jw5/build/tmp/l4re/bin/amd64_K8/l4f/moe rom/x86-fb.cfg
MOE: Starting: rom/ned rom/x86-fb.cfg
MOE: loading 'rom/ned'
pf:  0022 pfa=0000000000000000 ip=00000000010038a2 (w-) spc=0xffffffff807c3dd8
/* press i */
    ---------------------------------------------------------------------     
    CPU 0 [fffffffff0062116]: LOG
jdb:

Now you can use the kernel debugger to inspect the current state of the system. Here I simply use addr2line to find the error:
so I failed to debug the on purpose null ptr dereference issue *(int *)0 = 0; in your patch via jdb.


addr2line -p -i -e bin/amd64_K8/l4f/ned -a 10038a2
0x00000000010038a2: /home/jw5/src/l4resvn/src/l4/pkg/l4re-core/ned/server/src/main.cc:38
 (inlined by) /home/jw5/src/l4resvn/src/l4/pkg/l4re-core/ned/server/src/main.cc:77

Line 38 is the line with the null pointer dereference.

I hope this helps,
Jean




-- 
Regards,
Leslie Zhai - a LLVM hacker https://reviews.llvm.org/p/xiangzhai/