peter-dwarf has bug to decode c++ dwarf file
Author: admin
my way to compile binutils in mac
Is it a bochs bug? bochs forgets to translate linear addr to physical addr?
Is it a bochs bug? bochs forgets to translate linear addr to physical addr?
describe how to exact bytes from memory
my colleague suggested me to use this method to describe how to exact bytes from memory: using pairs of 2-numbers. The formula is that: So if the formula is “1,2”, then x1 is 1, y1 is 2 . That mean it will exact 1 byte then jump to 2 offset and keep do it repeatedly. […]
GKD debugger shortcut
GKD debugger shortcut
Fixed one important bug in grub
I am doing kernel development in mac, my kernel is loaded up by grub because it relay on multiboot spec. I was unable to install grub in a loopback device on mac, so my mac is running a small linux vm in virtual box, i write a simple php to let me upload my kernel, […]
Defining Scalable OS Requirements for Exascale and Beyond
Defining Scalable OS Requirements for Exascale and Beyond Robert W. Wisniewski, Chief Software Architect for Extreme Scale Computing, Intel Defining Scalable OS Requirements for Exascale and Beyond Over the past couple of decades two primary trends have driven system software for supercomputers to become significantly more complex. First, hardware has become more complex. Massive inter-node […]
just bought stm32 nucleo
just bought stm32 nucleo, learning Cortex-M. But my final target is Cortex-A, i am more interesting in general-OS than rtos.
libelf example can print out bytes in sections
newlib linker script summary for you own executable
After i build my newlib by “../newlib-2.1.0/configure –target=$TARGET –prefix=$PREFIX”, except the libc.a and crt0.o, i got these linker scripts. I am still thinking which one i should use for my own executables in my OS. elf_i386.x Default linker script, for normal executables elf_i386.xbn Script for -N: mix text and data on same page; don’t align […]
YEAH, page tables is ok now
After 100 times of failure, i finally loaded a exe into an independent address space (independent page tables and LDT). I meet all kind of failures: wrong page directory, wrong page table, wrong virtual address mapping, wrong code selector, wrong LDT, etc…
A guide to how the FreeBSD kernel manages the IA32 processors in Protected Mode
Download : A guide to how the FreeBSD kernel manages the IA32 processors in Protected Mode
Kernel can load up all segments to correct v-addr and p-addr now
Kernel can load up all segments to correct v-addr and p-addr now
Tutorial : import svn with all history into github
Tutorial : import svn with all history into github Step 1) Create a project on github Step 2) Init the github project by : Step 3) git clone https://github.com/mcheung63/GKD.git <— replace your project url Step 4) cd to that directory Step 5) user https://github.com/nirvdrum/svn2git and run: Step 6) svn2git –rebase Step 7) git pull Step […]
All svn history for peter-bochs debugger
Its time to keep track of all history, peter-bochs change svn server for a few times. Here are all svn history: peter-bochs-self-host <– peter-bochs svn history hosted in my own server peter-bochs-google <– peter-bochs svn history hosted in google code gkd <– peter-bochs renamed to GKD, svn history hosted in my own server
Netbeans – Maven Runner
Eclipse has a great plugin call “Eclipse runner” https://marketplace.eclipse.org/content/eclipse-runner , i found out netbeans doesn’t have any similar one. So i develop one for netbeans. You can add maven goals under the tree node of any project. Double click the goal name will run maven in netbeans. You can download it from http://plugins.netbeans.org/plugin/60381/?show=true, or search “Maven […]
ported libelf
finally ported libel to my os, my linker script won’t warn me I crossed the kernel boundary. So libelf’s variables becoming exist in a memory area that they shouldn’t be there.
This battery save my apple magic mouse
When you change your mouse from logitech mouse to magic mouse, the first feeling is that magic mouse is much much heavier. This battery save my apple magic mouse, although it has lesser mah, but it is 5 times lighter than normal battery, so i much my magic mouse much lighter weight. And it is only […]
Enable peter-swing theme in netbeans
Edit : /Applications/NetBeans/NetBeans 8.0.2.app/Contents/Resources/NetBeans/etc/netbeans.conf Change the line to:
Enhancement of the OS debug format, support scripting
OS debug format https://code.google.com/p/peter-bochs/wiki/OSDebugStandard is a xml based document stays in memory of the emulator, brining out the debug information in real time to the debugger, make the debugger understand what data structure they want to debug. In the early stage of kernel debugger, people rely on printk to dump out the debug information. At that […]
http://www.kaizou.org/2015/01/linux-libraries/
Originally from http://www.kaizou.org/2015/01/linux-libraries/ , it is a super professional article that explain the LD process. 08 Jan 2015 by David Corvoysier A few months ago I stumbled upon a linking problem with secondary dependencies I couldn’t solved without overlinking the corresponding libraries. I only realized today in a discussion with my friend Yann E. Morin that not only did I use the […]
Amazing recording feature by specific which code-block you want to record
In the original GKD design, it works with bochs instrumentation. Being helped (https://sourceforge.net/p/bochs/discussion/39593/thread/d960fe94/?limit=50) by the author of bochs (Mr Stanislav Shwartsman ) emulator, now we can use the prefetch instruction to specific which code-block you want to record, it becomes even more useful now. Every code surrounded by PREFETCHT0 and PREFETCHT1 instruction, GKD will record jumping instruction […]
handling exception 7
the easiest way to handle exception 7 is to execute clts then iret. My kernel was crashed because it generated a exception 0x7.
GKD can dump the exceptions now
GKD can dump the exceptions now, it helps me to trace what happened to my kernel
hard to theme netbeans perfectly
It is hard to theme netbeans using traditional swing look & feel. The reason is netbean’s tab container is not traditional swing JTabbedPane. See the post https://netbeans.org/bugzilla/show_bug.cgi?id=150393 Netbeans use a AbstractViewTabDisplayerUI to support only few “default look & feel”, such as Metal, Nimbus, Aqua. see below: The problem is : This default look & feel tab container […]
Peter-swing java look & feel
https://github.com/mcheung63/peter-swing
grub is slow on bochs
if grub is running slowly on bochs, try to add “–no-rs-codes” to your grub-bios-setup command. It will be 0.5 sec versus 5 seconds different.
gcc can’t handle too much #if macro
gcc can’t handle too much macro (#if, #define), the output dwarf will have wrong line number. So when you disassemble the assembly with c/c++ source, everything are wrong, including wrong line number, wrong assembly code to c source code, duplicated c/c++ line. https://github.com/gcc-mirror/gcc/blob/master/libgcc/libgcc2.c In GKD, i add an on/off button to filter out those […]
GKD is running fast with bochs instrumentation stub now
GKD is running fast with bochs instrumentation stub now, it captures all jmp/call/int/ret, all instructions that change you EIP. I am using H2 as the backbone database, every second can records over 100,000 instruction, which is pretty fast. Turn on subtitle when you are watching it:
Nazi gun tower
Getting the parameters by parsing the dwarf directly
I used another two months to getting correct location of each parameter of a functions. Mission sounds stupid, the timeframe i spent sounds stupid. If I use GDB, i perhaps never know how parameters are stored in memory. Now i know how computer ACTUALLY works. People think the parameters are store in the stack, and […]
libelf include issue
When you meet this: Just comment out the following line in /toolchain/include/libelf/sys_elf.h When I build the libelf in mac and in linux, the output sys_elf.h is different, in mac, the above line is not exist, so my OS is able to compile. Peter.
How to lookup the value of each parameter from dwarf and memory location
Here are the steps to lookup the parameter value 1) Look into the “info” section from dwarf, “objdump –dwarf=info”. There is a die DW_AT_LOCATION (DW_OP_freg:0), telling you the offset to the frame register. 2) Look at the CIE from .eh_frames section, “objdump –dwarf=frames”. It will tell you the formula of calculating the CFA, such as […]
Linux view csv command
alias csv=’column -s, -t’ csv your_file
Successfully decode .eh_frame
Successfully decode .eh_frame, now able to calculate the base offset of each parameter, can keep going on profiling feature of GKD
objdump 2.24 has bug
objdump 2.24 has bug, but this bug is fixed in 2.25. It dump the wrong address for my 32 bits kernel.
Decoded first two instructions of .eh_frame
Decoded first two instructions of .eh_frame, dwarf spec is lack of detail, need to hack into the objdump to understand each byte, it is time consuming.
binutils compile error
If you compiling binutils and have these error, just remove d-exp.c and try again. d-exp.c should be generated by d-exp.y but binutils makefile won’t delete it during “make distclean”
Tsinghua ucore kernel with GKD
I talked to Professor Chen from Tsing Hua (http://media.cs.tsinghua.edu.cn/cn/cheny), i tried their education kernel (https://github.com/chyyuu/ucore_lab). I modified a little bit their Makefile so that it can be compiled in Mac and debug using my GKD debugger.
I finally understand why “DW_OP_fbreg: 0” is possible
In the following function kmalloc2, take a look the first parameter, the memory location of that parameter is stated by dwarf “DW_AT_location : 2 byte block: 91 0 (DW_OP_fbreg: 0)”, where “DW_OP_fbreg: 0” means stack+0. I was thinking why it is possible. Because when cpu executed call instruction, it already pushed 4 bytes into the […]