2. run gdb

So far you must have two terminals on your docker container:

  1. One that shows the output of qemu ... -s -S
  2. One that is in a bash. See that you can give commands such as: ls, cd, etc. 
You see something like this:
$ docker exec -ti upbeat_khorana bash
root@db40c62a2c8d:/# su student
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

student@db40c62a2c8d:/$ alias
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias gdb='arm-none-eabi-gdb -ex '\''target remote:1234'\'' /home/student/src/linux/vmlinux'
alias grep='grep --color=auto'
alias l='ls -CF'
alias la='ls -A'
alias ll='ls -alF'
alias ls='ls --color=auto'
student@db40c62a2c8d:/$ 


Note the gdb alias. This "gdb"  command will make arm-none-eabi-gdb connect to qemu using port 1234. Type gdb and you will get:

student@db40c62a2c8d:/$ gdb
GNU gdb (7.10-1ubuntu3+9) 7.10
Copyright (C) 2015 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 "--host=x86_64-linux-gnu --target=arm-none-eabi".
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 /home/student/src/linux/vmlinux...done.
Remote debugging using :1234
0x00000000 in ?? ()
(gdb) b start_kernel
Breakpoint 1 at 0xc04398d8: file init/main.c, line 489.
(gdb) c
Continuing.

Breakpoint 1, start_kernel () at init/main.c:489
489 {
(gdb) 

Now you may run normal commands in this gdb. You may insert breakpoints (ex: b start_kernel) and continue to run as show above.

Comentários

Postagens mais visitadas deste blog

Basics on ARM processor

Assignments - 1

Assignments 2- 2021