实验地址

Exercise 3

Q1

At what point does the processor start executing 32-bit code? What exactly causes the switch from 16- to 32-bit mode?

boot/boot.S 中有代码:

1
2
3
# Jump to next instruction, but in 32-bit code segment.
# Switches processor into 32-bit mode.
ljmp    $PROT_MODE_CSEG, $protcseg

ljmp $PROT_MODE_CSEG, $protcseg 表示从这里用一个长跳转进 32 位代码里面,转向位置为 $PROT_MODE_CSEG(0x8) 内。

所以,是从

1
movl    %eax, %cr0

开始转入,这条指令主要把 cr0 寄存器最后一位(PE 位)打开,即开启保护模式。

以下是从实模式到保护模式的转换。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
(gdb) x/i
0x7c1e:      lgdtw  0x7c64
(gdb) x/i
0x7c23:      mov    %cr0,%eax
(gdb) x/i
0x7c26:      or     $0x1,%eax
(gdb) x/i
0x7c2a:      mov    %eax,%cr0
(gdb) x/i
0x7c2d:      ljmp   $0x8,$0x7c32

Q2

What is the last instruction of the boot loader executed, and what is the first instruction of the kernel it just loaded?

boot/main.c 中代码

1
2
3
// call the entry point from the ELF header
// note: does not return!
((void (*)(void)) (ELFHDR->e_entry))();

是加载引导程序的最后一条指令

obj/boot/boot.asm 中找到

1
7d6b: ff 15 18 00 01 00     call   *0x10018

gdb 设置断点

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
(gdb) b *0x7d6b
Breakpoint 2 at 0x7d6b
(gdb) c
Continuing.
The target architecture is assumed to be i386
=> 0x7d6b:      call   *0x10018

Breakpoint 2, 0x00007d6b in ?? ()
(gdb) si
=> 0x10000c:    movw   $0x1234,0x472
0x0010000c in ?? ()

得到内核执行的第一条指令是 movw $0x1234,0x472

也可通过命令查看内核入口信息

1
2
3
4
5
6
7
[email protected]:~/lab# objdump -x obj/kern/kernel

obj/kern/kernel:     file format elf32-i386
obj/kern/kernel
architecture: i386, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x0010000c

并通过在 0x10000c 设置断点查看

1
2
3
4
5
6
7
8
(gdb) b *0x10000c
Breakpoint 1 at 0x10000c
(gdb) c
Continuing.
The target architecture is assumed to be i386
=> 0x10000c:    movw   $0x1234,0x472

Breakpoint 1, 0x0010000c in ?? ()

Q3

Where is the first instruction of the kernel?

0x10000c

通过 objdump 也得到

1
2
3
4
5
6
[email protected]:~/lab# objdump -f obj/kern/kernel

obj/kern/kernel:     file format elf32-i386
architecture: i386, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x0010000c

Q4

How does the boot loader decide how many sectors it must read in order to fetch the entire kernel from disk? Where does it find this information?

boot/main.c 中得知通过 ELF 文件获取读取扇区信息。

objdump 查看

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
[email protected]:~/lab# objdump -p obj/kern/kernel

obj/kern/kernel:     file format elf32-i386

Program Header:
LOAD off    0x00001000 vaddr 0xf0100000 paddr 0x00100000 align 2**12
filesz 0x0000759d memsz 0x0000759d flags r-x
LOAD off    0x00009000 vaddr 0xf0108000 paddr 0x00108000 align 2**12
filesz 0x0000b6a8 memsz 0x0000b6a8 flags rw-
STACK off    0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**4
filesz 0x00000000 memsz 0x00000000 flags rwx

Exercise 4

Read about programming with pointers in C. The best reference for the C language is The C Programming Language by Brian Kernighan and Dennis Ritchie (known as ‘K&R’). We recommend that students purchase this book (here is an Amazon Link) or find one of MIT’s 7 copies.

Read 5.1 (Pointers and Addresses) through 5.5 (Character Pointers and Functions) in K&R. Then download the code for pointers.c, run it, and make sure you understand where all of the printed values come from. In particular, make sure you understand where the pointer addresses in printed lines 1 and 6 come from, how all the values in printed lines 2 through 4 get there, and why the values printed in line 5 are seemingly corrupted.

There are other references on pointers in C (e.g., A tutorial by Ted Jensen that cites K&R heavily), though not as strongly recommended.

Warning: Unless you are already thoroughly versed in C, do not skip or even skim this reading exercise. If you do not really understand pointers in C, you will suffer untold pain and misery in subsequent labs, and then eventually come to understand them the hard way. Trust us; you don’t want to find out what “the hard way” is.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <stdio.h>
#include <stdlib.h>

void
f(void)
{
  int a[4];
  int *b = malloc(16);
  int *c;
  int i;

  printf("1: a = %p, b = %p, c = %p\n", a, b, c);

  c = a;
  for (i = 0; i < 4; i++)
    a[i] = 100 + i;
  c[0] = 200;
  printf("2: a[0] = %d, a[1] = %d, a[2] = %d, a[3] = %d\n",
         a[0], a[1], a[2], a[3]);

  c[1] = 300;
  *(c + 2) = 301;
  3[c] = 302;  // 汇编地址的偏移写法
  printf("3: a[0] = %d, a[1] = %d, a[2] = %d, a[3] = %d\n",
         a[0], a[1], a[2], a[3]);

  c = c + 1;
  *c = 400;
  printf("4: a[0] = %d, a[1] = %d, a[2] = %d, a[3] = %d\n",
         a[0], a[1], a[2], a[3]);

  /*
   * c : 0x7f6b710afba5
   * c + 1 地址: 0x7f6b710afba6
   * 指向错误地方,产生数据偏移
   */
  c = (int *) ((char *) c + 1);
  *c = 500;
  printf("5: a[0] = %d, a[1] = %d, a[2] = %d, a[3] = %d\n",
         a[0], a[1], a[2], a[3]);

  b = (int *) a + 1;
  c = (int *) ((char *) a + 1);
  printf("6: a = %p, b = %p, c = %p\n", a, b, c);
}

int
main(int ac, char **av)
{
  f();
  return 0;
}
1: a = 0x7ffdcc9514e0 b = 0x55e358970260 c = 0x7f6b710afba5
2: a[0] = 200 a[1] = 101 a[2] = 102 a[3] = 103
3: a[0] = 200 a[1] = 300 a[2] = 301 a[3] = 302
4: a[0] = 200 a[1] = 400 a[2] = 301 a[3] = 302
5: a[0] = 200 a[1] = 128144 a[2] = 256 a[3] = 302
6: a = 0x7ffdcc9514e0 b = 0x7ffdcc9514e4 c = 0x7ffdcc9514e1

Exercise 5

Trace through the first few instructions of the boot loader again and identify the first instruction that would “break” or otherwise do the wrong thing if you were to get the boot loader’s link address wrong. Then change the link address in boot/Makefrag to something wrong, run make clean, recompile the lab with make, and trace into the boot loader again to see what happens. Don’t forget to change the link address back and make clean again afterward!

boot/Makefrag 中进行如下修改

1
2
3
4
5
6
$(OBJDIR)/boot/boot: $(BOOT_OBJS)
@echo + ld boot/boot
$(V)$(LD) $(LDFLAGS) -N -e start -Ttext 0x8C00 -o [email protected].out $^
$(V)$(OBJDUMP) -S [email protected].out >[email protected].asm
$(V)$(OBJCOPY) -S -O binary -j .text [email protected].out [email protected]
$(V)perl boot/sign.pl $(OBJDIR)/boot/boot

由于修改了程序链接地址,在 0x7c2d crash 掉

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
(gdb) b *0x7c00
b *0x7c00
Breakpoint 1 at 0x7c00
(gdb) c
c
Continuing.
[   0:7c00] => 0x7c00:	cli

Breakpoint 1, 0x00007c00 in ?? ()
(gdb) c

Continuing.

Program received signal SIGTRAP, Trace/breakpoint trap.
[   0:7c2d] => 0x7c2d:	ljmp   $0x8,$0x8c32
0x00007c2d in ?? ()

qemu 提示

EAX=00000011 EBX=00000000 ECX=00000000 EDX=00000080 ESI=00000000 EDI=00000000 EBP=00000000 ESP=00006f20 EIP=00007c2d EFL=00000006 [—–P-] CPL=0 II=0 A20=1 SMM=0 HLT=0 ES =0000 00000000 0000ffff 00009300 DPL=0 DS16 [-WA] CS =0000 00000000 0000ffff 00009b00 DPL=0 CS16 [-RA] SS =0000 00000000 0000ffff 00009300 DPL=0 DS16 [-WA] DS =0000 00000000 0000ffff 00009300 DPL=0 DS16 [-WA] FS =0000 00000000 0000ffff 00009300 DPL=0 DS16 [-WA] GS =0000 00000000 0000ffff 00009300 DPL=0 DS16 [-WA] LDT=0000 00000000 0000ffff 00008200 DPL=0 LDT TR 0000 00000000 0000ffff 00008b00 DPL=0 TSS32-busy GDT 00000000 00000000 IDT= 00000000 000003ff CR0=00000011 CR2=00000000 CR3=00000000 CR4=00000000 DR0=00000000 DR1=00000000 DR2=00000000 DR3=00000000 DR6=ffff0ff0 DR7=00000400 EFER=0000000000000000 Triple fault. Halting for inspection via QEMU monitor.

Exercise 6

We can examine memory using GDB’s x command. The GDB manual has full details, but for now, it is enough to know that the command x/Nx ADDR prints N words of memory at ADDR. (Note that both ‘x’s in the command are lowercase.) Warning: The size of a word is not a universal standard. In GNU assembly, a word is two bytes (the ‘w’ in xorw, which stands for word, means 2 bytes).

Reset the machine (exit QEMU/GDB and start them again). Examine the 8 words of memory at 0x00100000 at the point the BIOS enters the boot loader, and then again at the point the boot loader enters the kernel. Why are they different? What is there at the second breakpoint? (You do not really need to use QEMU to answer this question. Just think.)

0x7c00 打断点,用 x/8x 0x100000 查看

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
(gdb) b *0x7c00
Breakpoint 1 at 0x7c00
(gdb) c
Continuing.
[   0:7c00] => 0x7c00:  cli

Breakpoint 1, 0x00007c00 in ?? ()

(gdb) x/8x 0x100000
0x100000:       0x00000000      0x00000000      0x00000000      0x00000000
0x100010:       0x00000000      0x00000000      0x00000000      0x00000000

根据前面得到程序入口点为 0x10000c ,所以在 0x10000c 打断点并能看到

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
(gdb) b *0x10000c
Breakpoint 2 at 0x10000c
(gdb) c
Continuing.
The target architecture is assumed to be i386
=> 0x10000c:    movw   $0x1234,0x472

Breakpoint 2, 0x0010000c in ?? ()

(gdb) x/8x 0x100000
0x100000:       0x1badb002      0x00000000      0xe4524ffe      0x7205c766
0x100010:       0x34000004      0x2000b812      0x220f0011      0xc0200fd8

前 3 个值对应 kern/entry.S

1
2
3
#define MULTIBOOT_HEADER_MAGIC (0x1BADB002)
#define MULTIBOOT_HEADER_FLAGS (0)
#define CHECKSUM (-(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS))

Exercise 7

Use QEMU and GDB to trace into the JOS kernel and stop at the movl %eax, %cr0. Examine memory at 0x00100000 and at 0xf0100000. Now, single step over that instruction using the stepi GDB command. Again, examine memory at 0x00100000 and at 0xf0100000. Make sure you understand what just happened.

What is the first instruction after the new mapping is established that would fail to work properly if the mapping weren’t in place? Comment out the movl %eax, %cr0 in kern/entry.S, trace into it, and see if you were right.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
(gdb) b *0x7d6b
Breakpoint 1 at 0x7d6b
(gdb) c
Continuing.
The target architecture is assumed to be i386
=> 0x7d6b:      call   *0x10018

Breakpoint 1, 0x00007d6b in ?? ()
(gdb) si
=> 0x10000c:    movw   $0x1234,0x472
0x0010000c in ?? ()
(gdb) si
=> 0x100015:    mov    $0x112000,%eax
0x00100015 in ?? ()
(gdb) si
=> 0x10001a:    mov    %eax,%cr3
0x0010001a in ?? ()
(gdb) si
=> 0x10001d:    mov    %cr0,%eax
0x0010001d in ?? ()
(gdb) si
=> 0x100020:    or     $0x80010001,%eax
0x00100020 in ?? ()
(gdb) si
=> 0x100025:    mov    %eax,%cr0
0x00100025 in ?? ()
(gdb) x/8x 0x100000
0x100000:       0x1badb002      0x00000000      0xe4524ffe      0x7205c766
0x100010:       0x34000004      0x2000b812      0x220f0011      0xc0200fd8
(gdb) x/8x 0xf0100000
0xf0100000 <_start+4026531828>: 0x00000000      0x00000000      0x00000000      0x00000000
0xf0100010 <entry+4>:   0x00000000      0x00000000      0x00000000      0x00000000
(gdb) si
=> 0x100028:    mov    $0xf010002f,%eax
0x00100028 in ?? ()
(gdb) x/8x 0x100000
0x100000:       0x1badb002      0x00000000      0xe4524ffe      0x7205c766
0x100010:       0x34000004      0x2000b812      0x220f0011      0xc0200fd8
(gdb) x/8x 0xf0100000
0xf0100000 <_start+4026531828>: 0x1badb002      0x00000000      0xe4524ffe      0x7205c766
0xf0100010 <entry+4>:   0x34000004      0x2000b812      0x220f0011      0xc0200fd8
(gdb)

执行完 movl %eax, %cr0 后, 0x1000000xf0100000 相同,即 0x100000 被映射到 0xf0100000 处。

注释 movl %eax, %cr0 后,程序崩溃

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
(gdb) b *0x7d6b
Breakpoint 1 at 0x7d6b
(gdb) c
Continuing.
The target architecture is assumed to be i386
=> 0x7d6b:      call   *0x10018

Breakpoint 1, 0x00007d6b in ?? ()
(gdb) si
=> 0x10000c:    movw   $0x1234,0x472
0x0010000c in ?? ()
(gdb) si
=> 0x100015:    mov    $0x112000,%eax
0x00100015 in ?? ()
(gdb) si
=> 0x10001a:    mov    %eax,%cr3
0x0010001a in ?? ()
(gdb) si
=> 0x10001d:    mov    %cr0,%eax
0x0010001d in ?? ()
(gdb) si
=> 0x100020:    or     $0x80010001,%eax
0x00100020 in ?? ()
(gdb) si
=> 0x100025:    mov    $0xf010002c,%eax
0x00100025 in ?? ()
(gdb) si
=> 0x10002a:    jmp    *%eax
0x0010002a in ?? ()
(gdb) si
=> 0xf010002c <relocated>:      add    %al,(%eax)
relocated () at kern/entry.S:74
74              movl    $0x0,%ebp                       # nuke frame pointer
(gdb) si
Remote connection closed

Exercise 8

We have omitted a small fragment of code - the code necessary to print octal numbers using patterns of the form “%o”. Find and fill in this code fragment.

修改 lib/printfmt.c 并参考 %d 写法,重新 make 输出结果

6828 decimal is 15254 octal!

Q1

Explain the interface between printf.c and console.c. Specifically, what function does console.c export? How is this function used by printf.c?

printf.c 调用链

cprintf() -> vcprintf() -> vprintfmt() -> putch() -> cputchar()

cputchar() 定义在 lib/console.c

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
void
cputchar(int c)
{
  cons_putc(c);
}

// output a character to the console
static void
cons_putc(int c)
{
  serial_putc(c);
  lpt_putc(c);
  cga_putc(c);
}

cga_putc() 主要把字符输出至屏幕,并显示移动光标。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
static void
cga_putc(int c)
{
  // if no attribute given, then use black on white
  if (!(c & ~0xFF))
    c |= 0x0700;

  switch (c & 0xff) {
    case '\b':
      if (crt_pos > 0) {
        crt_pos--;
        crt_buf[crt_pos] = (c & ~0xff) | ' ';
      }
      break;
    case '\n':
      crt_pos += CRT_COLS;
      /* fallthru */
    case '\r':
      crt_pos -= (crt_pos % CRT_COLS);
      break;
    case '\t':
      cons_putc(' ');
      cons_putc(' ');
      cons_putc(' ');
      cons_putc(' ');
      cons_putc(' ');
      break;
    default:
      crt_buf[crt_pos++] = c;		/* write the character */
      break;
  }

  // What is the purpose of this?
  if (crt_pos >= CRT_SIZE) {
    int i;

    memmove(crt_buf, crt_buf + CRT_COLS, (CRT_SIZE - CRT_COLS) * sizeof(uint16_t));
    for (i = CRT_SIZE - CRT_COLS; i < CRT_SIZE; i++)
      crt_buf[i] = 0x0700 | ' ';
    crt_pos -= CRT_COLS;
  }

  /* move that little blinky thing */
  outb(addr_6845, 14);
  outb(addr_6845 + 1, crt_pos >> 8);
  outb(addr_6845, 15);
  outb(addr_6845 + 1, crt_pos);
}

Q2

Explain the following from console.c:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
// 一页写满,滚动一行
if (crt_pos >= CRT_SIZE) {
  int i;
  // 把从第 1~n 行的内容复制到 0~(n-1)行,第 n 行不变
  // 完成整个屏幕向上移动一行
  memmove(crt_buf, crt_buf + CRT_COLS, (CRT_SIZE - CRT_COLS) * sizeof(uint16_t));
  // 清空最后一行
  for (i = CRT_SIZE - CRT_COLS; i < CRT_SIZE; i++)
    crt_buf[i] = 0x0700 | ' ';
  // 同步 crt_pos
  crt_pos -= CRT_COLS;
}

Q3

For the following questions you might wish to consult the notes for Lecture 2. These notes cover GCC’s calling convention on the x86. Trace the execution of the following code step-by-step:

1
2
int x = 1, y = 3, z = 4;
cprintf("x %d, y %x, z %d\n", x, y, z);

分析

cprintf() 代码如下

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
int
cprintf(const char *fmt, ...)
{
  va_list ap;
  int cnt;

  va_start(ap, fmt);
  cnt = vcprintf(fmt, ap);
  va_end(ap);

  return cnt;
}

va_list 定义运用了 GCC 提供的

1
2
3
4
typedef __builtin_va_list va_list;
#define va_start(ap, last) __builtin_va_start(ap, last)
#define va_arg(ap, type) __builtin_va_arg(ap, type)
#define va_end(ap) __builtin_va_end(ap)

而根据 mit 6.828 2007 代码中能找到

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
typedef char *va_list;

// 类型大小
// sizeof(long) 作用:与 CPU 位数对齐
#define	__va_size(type)                                               \
  (((sizeof(type) + sizeof(long) - 1) / sizeof(long)) * sizeof(long))

// 参数从什么地方开始放
#define	va_start(ap, last)                      \
  ((ap) = (va_list)&(last) + __va_size(last))

// 取参数的起始地址,返回 type 类型
// 等价于(*(type*)ap)
// 实际上使 ap 指针移动一个参数大小
#define	va_arg(ap, type)                                        \
  (*(type *)((ap) += __va_size(type), (ap) - __va_size(type)))

// 空指令
#define	va_end(ap)	((void)0)

Q3.1

In the call to cprintf(), to what does fmt point? To what does ap point?

fmt 指向 const char * 字符串(”x %d, y %x, z %d\n”),栈方向从高地址压向低地址,调用时栈中结构

1
2
3
4
5
6
7
8
9
+-----+
|  Z  |
+-----+
|  Y  |
+-----+
|  X  |
+-----+
| fmt |
+-----+ <---+&fmt

ap 通过 va_start(fmt, ap) 得到

1
2
3
4
5
6
#define	va_start(ap, last)                      \
  ((ap) = (va_list)&(last) + __va_size(last))

// 展开式

ap = (char *)&(fmt) + (((sizeof(fmt) + sizeof(long) - 1) / sizeof(long)) * sizeof(long));
1
2
3
4
5
6
7
8
9
+-----+
|  Z  |
+-----+
|  Y  |
+-----+
|  X  |
+-----+ <---+ap
| fmt |
+-----+

Q3.2

List (in order of execution) each call to cons_putc, va_arg, and vcprintf. For cons_putc, list its argument as well. For va_arg, list what ap points to before and after the call. For vcprintf list the values of its two arguments.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
vprintfmt(void (*putch)(int, void*), void *putdat, const char *fmt, va_list ap)
{
  while (1) {
    // 一般字符串直接输出
    while ((ch = *(unsigned char *) fmt++) != '%') {
      if (ch == '\0')
        return;
      putch(ch, putdat);
    }

 reswitch:
    // 去除 '%'
    switch (ch = *(unsigned char *) fmt++) {
      // 当为字符时直接输出
      // character
      case 'c':
        putch(va_arg(ap, int), putdat);
        break;
    }
  }
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
va_arg(ap, int);


// 展开后
va_arg(ap, int) = (*(int *)((ap) += __va_size(int), (ap) - __va_size(int)))
                = (*(int *)((ap) += 4, (ap) - 4))
                = *(char *)ap;

// 可视为
putch(*(int *)ap, putdat);
ap += 4; // ap += __va_size(int);
1
2
3
4
5
6
7
8
9
+-----+
|  Z  |
+-----+
|  Y  |
+-----+ <---+ap
|  X  | 这个 x 会被%d 提出来进行输出
+-----+
| fmt |
+-----+

cons_putc 调用顺序:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
cons_putc('x');
cons_putc(' ');
cons_putc('1');
cons_putc(',');
cons_putc(' ');
cons_putc('y');
cons_putc(' ');
cons_putc('3');
cons_putc(',');
cons_putc(' ');
cons_putc('z');
cons_putc(' ');
cons_putc('4');
cons_putc('\n');

va_arg 调用顺序:

调用次数 调用前 ap 指向 调用后 ap 指向
1 x y
2 y z
3 z z 后 4 个字节

vcprintf 参数为 x %d, y %x, z %d\n 和参数 x 对应调用栈地址。

Q4

Run the following code.

1
2
unsigned int i = 0x00646c72;
cprintf("H%x Wo%s", 57616, &i);

What is the output? Explain how this output is arrived at in the step-by-step manner of the previous exercise. Here’s an ASCII table that maps bytes to characters. The output depends on that fact that the x86 is little-endian. If the x86 were instead big-endian what would you set i to in order to yield the same output? Would you need to change 57616 to a different value? Here’s a description of little- and big-endian and a more whimsical description.

首先 %x 是输出十六进制。

i 看作 char[4] 数组,得到:

1
2
3
4
// 57616 = 0xe110
char c[4] = {0x72, 0x6c, 0x64, 0x00} // 小端机,从右往左
          = {114, 108, 100, 0}
          = {'r', 'l', 'd', '\0'};

所以输出是:

1
Hell0 World

Q5

In the following code, what is going to be printed after ‘y=’? (note: the answer is not a specific value.) Why does this happen?

1
cprintf("x=%d y=%d", 3);

y 没有指定值,输出的是不确定值。

Q6

Let’s say that GCC changed its calling convention so that it pushed arguments on the stack in declaration order, so that the last argument is pushed last. How would you have to change cprintf or its interface so that it would still be possible to pass it a variable number of arguments?

能取到参数,但是需要把宏的加减法互换。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
typedef char *va_list;

#define	__va_size(type)                                               \
  (((sizeof(type) + sizeof(long) - 1) / sizeof(long)) * sizeof(long))

#define	va_start(ap, last)                      \
  ((ap) = (va_list)&(last) - __va_size(last))

#define	va_arg(ap, type)                                        \
  (*(type *)((ap) -= __va_size(type), (ap) + __va_size(type)))

#define	va_end(ap)	((void)0)

Exercise 9

Determine where the kernel initializes its stack, and exactly where in memory its stack is located. How does the kernel reserve space for its stack? And at which “end” of this reserved area is the stack pointer initialized to point to?

首先 boot/boot.S 中初始化了 SS 段描述符

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
protcseg:
  # Set up the protected-mode data segment registers
  movw    $PROT_MODE_DSEG, %ax    # Our data segment selector
  movw    %ax, %ds                # -> DS: Data Segment
  movw    %ax, %es                # -> ES: Extra Segment
  movw    %ax, %fs                # -> FS
  movw    %ax, %gs                # -> GS
  movw    %ax, %ss                # -> SS: Stack Segment

  # Set up the stack pointer and call into C.
  movl    $start, %esp
  call bootmain

随后从 kern/entry.S 中得到如下信息

1
2
3
4
5
6
7
# Clear the frame pointer register (EBP)
# so that once we get into debugging C code,
# stack backtraces will be terminated properly.
movl	$0x0,%ebp			# nuke frame pointer

# Set the stack pointer
movl	$(bootstacktop),%esp

obj/kern/kernel.asm 中可以看到

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
relocated:

  # Clear the frame pointer register (EBP)
  # so that once we get into debugging C code,
  # stack backtraces will be terminated properly.
  movl	$0x0,%ebp			# nuke frame pointer
f010002f:	bd 00 00 00 00       	mov    $0x0,%ebp

  # Set the stack pointer
  movl	$(bootstacktop),%esp
f0100034:	bc 00 00 11 f0       	mov    $0xf0110000,%esp

movl $0x0, %ebp 位于 f010002f 内,所以 0xf010002f 是开启的虚拟地址。

随后在 movl $(bootstacktop),%espbootstacktop 的值为 0xf0110000 ,即栈被加载到该地址中。

而从 kern/entry.S 中找到

1
2
3
4
5
6
7
8
9
###################################################################
# boot stack
###################################################################
  .p2align	PGSHIFT		# force page alignment
  .globl		bootstack
bootstack:
  .space		KSTKSIZE
  .globl		bootstacktop
bootstacktop:

KSTKSIZE 为栈大小,而 KSTKSIZE 定义在 inc/memlayout.h 中。

1
2
3
4
// Kernel stack.
#define KSTACKTOP	KERNBASE
#define KSTKSIZE	(8*PGSIZE)   		// size of a kernel stack
#define KSTKGAP		(8*PGSIZE)   		// size of a kernel stack guard

PGSIZE 定义在 inc/mmu.h

1
2
#define PGSIZE		4096		// bytes mapped by a page
#define PGSHIFT		12		// log2(PGSIZE)

所以

1
2
3
4
KSTKSIZE = 8 * PGSIZE
         = 8 * 4096
         = 32768
         = 32KB

x86 架构中栈从高位向低位增长,所以栈指针初始指向这个保留区的上面(大地址端)。

Exercise 10

To become familiar with the C calling conventions on the x86, find the address of the test_backtrace function in obj/kern/kernel.asm, set a breakpoint there, and examine what happens each time it gets called after the kernel starts. How many 32-bit words does each recursive nesting level of test_backtrace push on the stack, and what are those words?

Note that, for this exercise to work properly, you should be using the patched version of QEMU available on the tools page or on Athena. Otherwise, you’ll have to manually translate all breakpoint and memory addresses to linear addresses.

分析

test_backtracekern/init.c 中定义

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
// Test the stack backtrace function (lab 1 only)
void
test_backtrace(int x)
{
  cprintf("entering test_backtrace %d\n", x);
  if (x > 0)
    test_backtrace(x-1);
  else
    mon_backtrace(0, 0, 0);
  cprintf("leaving test_backtrace %d\n", x);
}

对应汇编代码 obj/kern/kernel.asm

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
void
test_backtrace(int x)
{
f0100040:	55                   	push   %ebp
f0100041:	89 e5                	mov    %esp,%ebp
f0100043:	56                   	push   %esi
f0100044:	53                   	push   %ebx
f0100045:	e8 72 01 00 00       	call   f01001bc <__x86.get_pc_thunk.bx>
f010004a:	81 c3 be 12 01 00    	add    $0x112be,%ebx
f0100050:	8b 75 08             	mov    0x8(%ebp),%esi
  cprintf("entering test_backtrace %d\n", x);
f0100053:	83 ec 08             	sub    $0x8,%esp
f0100056:	56                   	push   %esi
f0100057:	8d 83 98 07 ff ff    	lea    -0xf868(%ebx),%eax
f010005d:	50                   	push   %eax
f010005e:	e8 e6 09 00 00       	call   f0100a49 <cprintf>
  if (x > 0)
f0100063:	83 c4 10             	add    $0x10,%esp
f0100066:	85 f6                	test   %esi,%esi
f0100068:	7f 2b                	jg     f0100095 <test_backtrace+0x55>
    test_backtrace(x-1);
  else
    mon_backtrace(0, 0, 0);
f010006a:	83 ec 04             	sub    $0x4,%esp
f010006d:	6a 00                	push   $0x0
f010006f:	6a 00                	push   $0x0
f0100071:	6a 00                	push   $0x0
f0100073:	e8 0b 08 00 00       	call   f0100883 <mon_backtrace>
f0100078:	83 c4 10             	add    $0x10,%esp
  cprintf("leaving test_backtrace %d\n", x);
f010007b:	83 ec 08             	sub    $0x8,%esp
f010007e:	56                   	push   %esi
f010007f:	8d 83 b4 07 ff ff    	lea    -0xf84c(%ebx),%eax
f0100085:	50                   	push   %eax
f0100086:	e8 be 09 00 00       	call   f0100a49 <cprintf>
}
f010008b:	83 c4 10             	add    $0x10,%esp
f010008e:	8d 65 f8             	lea    -0x8(%ebp),%esp
f0100091:	5b                   	pop    %ebx
f0100092:	5e                   	pop    %esi
f0100093:	5d                   	pop    %ebp
f0100094:	c3                   	ret
    test_backtrace(x-1);
f0100095:	83 ec 0c             	sub    $0xc,%esp
f0100098:	8d 46 ff             	lea    -0x1(%esi),%eax
f010009b:	50                   	push   %eax
f010009c:	e8 9f ff ff ff       	call   f0100040 <test_backtrace>
f01000a1:	83 c4 10             	add    $0x10,%esp
f01000a4:	eb d5                	jmp    f010007b <test_backtrace+0x3b>

观察 test_backtrace 调用栈,其中:

%esp
栈顶位置
%ebp
调用者栈顶位置
%eax
test_backtrace 参数值

test_backtracekern/init.c 中被调用

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
void
i386_init(void)
{
  extern char edata[], end[];

  // Before doing anything else, complete the ELF loading process.
  // Clear the uninitialized global data (BSS) section of our program.
  // This ensures that all static/global variables start out zero.
  memset(edata, 0, end - edata);

  // Initialize the console.
  // Can't call cprintf until after we do this!
  cons_init();

  cprintf("6828 decimal is %o octal!\n", 6828);

  // Test the stack backtrace function (lab 1 only)
  test_backtrace(5);

  // Drop into the kernel monitor.
  while (1)
    monitor(NULL);
}

对应汇编代码 obj/kern/kernel.asm

1
2
3
4
5
  // Test the stack backtrace function (lab 1 only)
  test_backtrace(5);
f01000e8:	c7 04 24 05 00 00 00 	movl   $0x5,(%esp)
f01000ef:	e8 4c ff ff ff       	call   f0100040 <test_backtrace>
f01000f4:	83 c4 10             	add    $0x10,%esp
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
(gdb) b *0xf01000e8
Breakpoint 1 at 0xf01000e8: file kern/init.c, line 39.
(gdb) c
Continuing.
The target architecture is assumed to be i386
=> 0xf01000e8 <i386_init+66>:   movl   $0x5,(%esp)

Breakpoint 1, i386_init () at kern/init.c:39
39              test_backtrace(5);
(gdb) si
=> 0xf01000ef <i386_init+73>:   call   0xf0100040 <test_backtrace>
0xf01000ef      39              test_backtrace(5);
0xf010ffe0:     5
(gdb) x/d 0xf010ffe0
0xf010ffe0:     5
(gdb) x/d 0xf010fff8
0xf010fff8:     0
(gdb) si
=> 0xf0100040 <test_backtrace>: push   %ebp
test_backtrace (x=5) at kern/init.c:13
13      {
(gdb) i r
eax            0x0      0
ecx            0x3d4    980
edx            0x3d5    981
ebx            0xf0111308       -267316472
esp            0xf010ffdc       0xf010ffdc
ebp            0xf010fff8       0xf010fff8
esi            0x10094  65684
edi            0x0      0
eip            0xf0100040       0xf0100040 <test_backtrace>
eflags         0x46     [ PF ZF ]
cs             0x8      8
ss             0x10     16
ds             0x10     16
es             0x10     16
fs             0x10     16
gs             0x10     16
(gdb) x/d 0xf010ffe0
0xf010ffe0:     5
(gdb) x/d 0xf010fff8
0xf010fff8:     0

有两个 4 字节整数被压入栈中

  1. 输入参数(5)
  2. call 指令下一条指令的地址(f01000f4)

    1
    2
    3
    4
    5
    6
    
    %esp = 0xf010ffdc
    %ebp = 0xf010fff8
    
    // 栈内信息
    0xf010ffe0: 0x00000005  // 输入参数 5
    0xf010ffdc: 0xf01000f4  // 调用时返回地址(0xf01000f4)

进入 test_backtrace(5) 后栈内数据修改指令分为三部分:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
// function start
// 函数开头,将寄存器中值压栈,以便函数结束后恢复
f0100040:	55                   	push   %ebp
f0100041:	89 e5                	mov    %esp,%ebp
f0100043:	56                   	push   %esi
f0100044:	53                   	push   %ebx
// cprintf("entering test_backtrace %d\n", x);
// 调用 cprintf 前参数压栈
f0100053:	83 ec 08             	sub    $0x8,%esp
f0100056:	56                   	push   %esi
f0100057:	8d 83 98 07 ff ff    	lea    -0xf868(%ebx),%eax
f010005d:	50                   	push   %eax
f010005e:	e8 e6 09 00 00       	call   f0100a49 <cprintf>
// test_backtrace(x-1);
//  2 次调用时将输入参数压栈
f0100095:	83 ec 0c             	sub    $0xc,%esp
f0100098:	8d 46 ff             	lea    -0x1(%esi),%eax
f010009b:	50                   	push   %eax
f010009c:	e8 9f ff ff ff       	call   f0100040 <test_backtrace>

进入 test_backtrace(4) m 前栈内数据

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
(gdb) br *0xf0100068
Breakpoint 3 at 0xf0100068: file kern/init.c, line 15.
(gdb) c
Continuing.
=> 0xf0100068 <test_backtrace+40>:      jg     0xf0100095 <test_backtrace+85>

Breakpoint 3, 0xf0100068 in test_backtrace (x=5) at kern/init.c:15
15              if (x > 0)
(gdb) si
=> 0xf0100095 <test_backtrace+85>:      sub    $0xc,%esp
16                      test_backtrace(x-1);
(gdb) si
=> 0xf0100098 <test_backtrace+88>:      lea    -0x1(%esi),%eax
0xf0100098      16                      test_backtrace(x-1);
(gdb) si
=> 0xf010009b <test_backtrace+91>:      push   %eax
0xf010009b      16                      test_backtrace(x-1);
(gdb) si
=> 0xf010009c <test_backtrace+92>:      call   0xf0100040 <test_backtrace>
0xf010009c      16                      test_backtrace(x-1);
(gdb) i r
eax            0x4      4
ecx            0x3d4    980
edx            0x3d5    981
ebx            0xf0111308       -267316472
esp            0xf010ffc0       0xf010ffc0
ebp            0xf010ffd8       0xf010ffd8
esi            0x5      5
edi            0x0      0
eip            0xf010009c       0xf010009c <test_backtrace+92>
eflags         0x92     [ AF SF ]
cs             0x8      8
ss             0x10     16
ds             0x10     16
es             0x10     16
fs             0x10     16
gs             0x10     16
(gdb) x/64x $esp
0xf010ffc0:     0x00000004      0x00000005      0x00000000      0xf010004a
0xf010ffd0:     0xf0111308      0x00010094      0xf010fff8      0xf01000f4
0xf010ffe0:     0x00000005      0x00001aac      0x00000640      0x00000000
0xf010fff0:     0x00000000      0x00010094      0x00000000      0xf010003e
0xf0110000 <entry_pgtable>:     0x00000003      0x00001003      0x00002003      0x00003003
0xf0110010 <entry_pgtable+16>:  0x00004003      0x00005003      0x00006003      0x00007003
0xf0110020 <entry_pgtable+32>:  0x00008003      0x00009003      0x0000a003      0x0000b003
0xf0110030 <entry_pgtable+48>:  0x0000c003      0x0000d003      0x0000e003      0x0000f003
0xf0110040 <entry_pgtable+64>:  0x00010003      0x00011003      0x00012003      0x00013003
0xf0110050 <entry_pgtable+80>:  0x00014003      0x00015003      0x00016003      0x00017003
0xf0110060 <entry_pgtable+96>:  0x00018003      0x00019003      0x0001a003      0x0001b003
0xf0110070 <entry_pgtable+112>: 0x0001c003      0x0001d003      0x0001e003      0x0001f003
0xf0110080 <entry_pgtable+128>: 0x00020003      0x00021003      0x00022003      0x00023003
0xf0110090 <entry_pgtable+144>: 0x00024003      0x00025003      0x00026003      0x00027003
0xf01100a0 <entry_pgtable+160>: 0x00028003      0x00029003      0x0002a003      0x0002b003
0xf01100b0 <entry_pgtable+176>: 0x0002c003      0x0002d003      0x0002e003      0x0002f003

整理后

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
%esp = 0xf010ffc0
%ebp = 0xf010ffd8

// 栈内信息
0xf010ffe0: 0x00000005  // 第 1 次调用输入参数:5
0xf010ffdc: 0xf01000f4  // 第 1 次调用时返回的地址
0xf010ffd8: 0xf010fff8  // 第 1 次调用时寄存器%ebp 的值
0xf010ffd4: 0x10094     // 第 1 次调用时寄存器%esi 的值
0xf010ffd0: 0xf0111308  // 第 1 次调用时寄存器%ebx 的值
0xf010ffcc: 0xf010004a  // 残留数据,不需关注
0xf010ffc8: 0x00000000  // 残留数据,不需关注
0xf010ffc4: 0x00000005  // 残留数据,不需关注
0xf010ffc0: 0x00000004  // 第 2 次调用时的输入参数

在进入 mon_backtrace(0, 0, 0) 前栈内数据如下:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
(gdb) b *0xf010006a
Breakpoint 1 at 0xf010006a: file kern/init.c, line 18.
(gdb) c
Continuing.
The target architecture is assumed to be i386
=> 0xf010006a <test_backtrace+42>:      sub    $0x4,%esp

Breakpoint 1, test_backtrace (x=0) at kern/init.c:18
18                      mon_backtrace(0, 0, 0);
(gdb) i r
eax            0x0      0
ecx            0x3d4    980
edx            0x3d5    981
ebx            0xf0111308       -267316472
esp            0xf010ff20       0xf010ff20
ebp            0xf010ff38       0xf010ff38
esi            0x0      0
edi            0x0      0
eip            0xf010006a       0xf010006a <test_backtrace+42>
eflags         0x46     [ PF ZF ]
cs             0x8      8
ss             0x10     16
ds             0x10     16
es             0x10     16
fs             0x10     16
gs             0x10     16
(gdb) x/64x $esp
0xf010ff20:     0x00000000      0x00000000      0x00000000      0xf010004a
0xf010ff30:     0xf0111308      0x00000001      0xf010ff58      0xf01000a1
0xf010ff40:     0x00000000      0x00000001      0xf010ff78      0xf010004a
0xf010ff50:     0xf0111308      0x00000002      0xf010ff78      0xf01000a1
0xf010ff60:     0x00000001      0x00000002      0xf010ff98      0xf010004a
0xf010ff70:     0xf0111308      0x00000003      0xf010ff98      0xf01000a1
0xf010ff80:     0x00000002      0x00000003      0xf010ffb8      0xf010004a
0xf010ff90:     0xf0111308      0x00000004      0xf010ffb8      0xf01000a1
0xf010ffa0:     0x00000003      0x00000004      0x00000000      0xf010004a
0xf010ffb0:     0xf0111308      0x00000005      0xf010ffd8      0xf01000a1
0xf010ffc0:     0x00000004      0x00000005      0x00000000      0xf010004a
0xf010ffd0:     0xf0111308      0x00010094      0xf010fff8      0xf01000f4
0xf010ffe0:     0x00000005      0x00001aac      0x00000640      0x00000000
0xf010fff0:     0x00000000      0x00010094      0x00000000      0xf010003e
0xf0110000 <entry_pgtable>:     0x00000003      0x00001003      0x00002003      0x00003003
0xf0110010 <entry_pgtable+16>:  0x00004003      0x00005003      0x00006003      0x00007003
0xf0110020 <entry_pgtable+32>:  0x00008003      0x00009003      0x0000a003      0x0000b003

整理后

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
%esp = 0xf010ff20
%ebp = 0xf010ff38

// 栈内信息

0xf010ffe0: 0x00000005  // 第 1 次调用时的输入参数:5
0xf010ffdc: 0xf01000f4  // 第 1 次调用时的返回地址
0xf010ffd8: 0xf010fff8  // 第 1 次调用开始时寄存器%ebp 的值
0xf010ffd4: 0x10094     // 第 1 次调用开始时寄存器%esi 的值
0xf010ffd0: 0xf0111308  // 第 1 次调用开始时寄存器%ebx 的值
0xf010ffcc: 0xf010004a  // 预留空间,不需关注
0xf010ffc8: 0x00000000  // 预留空间,不需关注
0xf010ffc4: 0x00000005  // 预留空间,不需关注
0xf010ffc0: 0x00000004  // 第 2 次调用时的输入参数:4
0xf010ffbc: 0xf01000a1  // 第 2 次调用时的返回地址
0xf010ffb8: 0xf010ffd8  // 第 2 次调用开始时寄存器%ebp 的值
0xf010ffb4: 0x00000005  // 第 2 次调用开始时寄存器%esi 的值
0xf010ffb0: 0xf0111308  // 第 2 次调用开始时寄存器%ebx 的值
0xf010ffac: 0xf010004a  // 预留空间,不需关注
0xf010ffa8: 0x00000000  // 预留空间,不需关注
0xf010ffa4: 0x00000004  // 预留空间,不需关注
0xf010ffa0: 0x00000003  // 第 3 次调用时的输入参数:3
0xf010ff9c: 0xf01000a1  // 第 3 次调用时的返回地址
0xf010ff98: 0xf010ffb8  // 第 3 次调用开始时寄存器%ebp 的值
0xf010ff94: 0x00000004  // 第 3 次调用开始时寄存器%esi 的值
0xf010ff90: 0xf0111308  // 第 3 次调用开始时寄存器%ebx 的值
0xf010ff8c: 0xf010004a  // 预留空间,不需关注
0xf010ff88: 0xf010ffb8  // 预留空间,不需关注
0xf010ff84: 0x00000003  // 预留空间,不需关注
0xf010ff80: 0x00000002  // 第 4 次调用时的输入参数:2
0xf010ff7c: 0xf01000a1  // 第 4 次调用时的返回地址
0xf010ff78: 0xf010ff98  // 第 4 次调用开始时寄存器%ebp 的值
0xf010ff74: 0x00000003  // 第 4 次调用开始时寄存器%esi 的值
0xf010ff70: 0xf0111308  // 第 4 次调用开始时寄存器%ebx 的值
0xf010ff6c: 0xf010004a  // 预留空间,不需关注
0xf010ff68: 0xf010ff98  // 预留空间,不需关注
0xf010ff64: 0x00000002  // 预留空间,不需关注
0xf010ff60: 0x00000001  // 第 5 次调用时的输入参数:1
0xf010ff5c: 0xf01000a1  // 第 5 次调用时的返回地址
0xf010ff58: 0xf010ff78  // 第 5 次调用开始时寄存器%ebp 的值
0xf010ff54: 0x00000002  // 第 5 次调用开始时寄存器%esi 的值
0xf010ff50: 0xf0111308  // 第 5 次调用开始时寄存器%ebx 的值
0xf010ff4c: 0xf010004a  // 预留空间,不需关注
0xf010ff48: 0xf010ff78  // 预留空间,不需关注
0xf010ff44: 0x00000001  // 预留空间,不需关注
0xf010ff40: 0x00000000  // 第 6 次调用时的输入参数:0
0xf010ff3c: 0xf01000a1  // 第 6 次调用时的返回地址
0xf010ff38: 0xf010ff58  // 第 6 次调用开始时寄存器%ebp 的值
0xf010ff34: 0x00000001  // 第 6 次调用开始时寄存器%esi 的值
0xf010ff30: 0xf0111308  // 第 6 次调用开始时寄存器%ebx 的值
0xf010ff28: 0x00000000  // 第 7 次调用时的第 1 个输入参数:0
0xf010ff24: 0x00000000  // 第 7 次调用时的第 2 个输入参数:0
0xf010ff20: 0x00000000  // 第 7 次调用时的第 3 个输入参数:0

退出 mon_backtrace(0, 0, 0)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
(gdb) b *0xf0100078
Breakpoint 2 at 0xf0100078: file kern/init.c, line 18.
(gdb) c
Continuing.
=> 0xf0100078 <test_backtrace+56>:      add    $0x10,%esp

Breakpoint 2, 0xf0100078 in test_backtrace (x=0) at kern/init.c:18
18                      mon_backtrace(0, 0, 0);
(gdb) si
=> 0xf010007b <test_backtrace+59>:      sub    $0x8,%esp
19              cprintf("leaving test_backtrace %d\n", x);
(gdb) i r
eax            0x0      0
ecx            0x3d4    980
edx            0x3d5    981
ebx            0xf0111308       -267316472
esp            0xf010ff30       0xf010ff30
ebp            0xf010ff38       0xf010ff38
esi            0x0      0
edi            0x0      0
eip            0xf010007b       0xf010007b <test_backtrace+59>
eflags         0x86     [ PF SF ]
cs             0x8      8
ss             0x10     16
ds             0x10     16
es             0x10     16
fs             0x10     16
gs             0x10     16
(gdb) x/64x $esp
0xf010ff30:     0xf0111308      0x00000001      0xf010ff58      0xf01000a1
0xf010ff40:     0x00000000      0x00000001      0xf010ff78      0xf010004a
0xf010ff50:     0xf0111308      0x00000002      0xf010ff78      0xf01000a1
0xf010ff60:     0x00000001      0x00000002      0xf010ff98      0xf010004a
0xf010ff70:     0xf0111308      0x00000003      0xf010ff98      0xf01000a1
0xf010ff80:     0x00000002      0x00000003      0xf010ffb8      0xf010004a
0xf010ff90:     0xf0111308      0x00000004      0xf010ffb8      0xf01000a1
0xf010ffa0:     0x00000003      0x00000004      0x00000000      0xf010004a
0xf010ffb0:     0xf0111308      0x00000005      0xf010ffd8      0xf01000a1
0xf010ffc0:     0x00000004      0x00000005      0x00000000      0xf010004a
0xf010ffd0:     0xf0111308      0x00010094      0xf010fff8      0xf01000f4
0xf010ffe0:     0x00000005      0x00001aac      0x00000640      0x00000000
0xf010fff0:     0x00000000      0x00010094      0x00000000      0xf010003e
0xf0110000 <entry_pgtable>:     0x00000003      0x00001003      0x00002003      0x00003003
0xf0110010 <entry_pgtable+16>:  0x00004003      0x00005003      0x00006003      0x00007003
0xf0110020 <entry_pgtable+32>:  0x00008003      0x00009003      0x0000a003      0x0000b003

通过 add $0x10,%esp 后输入参数与预留 4 个字节出栈

1
2
%esp = 0xf010ff30
%ebp = 0xf010ff38

退出 test_backtrace(0, 0, 0)

1
2
3
4
f0100091:	5b                   	pop    %ebx
f0100092:	5e                   	pop    %esi
f0100093:	5d                   	pop    %ebp
f0100094:	c3                   	ret

%ebx, %esi, %ebp 寄存器依次出栈,并通过 ret 返回

Q1

examine what happens each time it gets called after the kernel starts.

  1. 将返回地址( call 的下一条指令)压栈
  2. %ebp, %esi, ebx 三个寄存器的值压栈,以便退出函数时恢复
  3. 调用 cprintf 打印 “entering test_backtrace x”
  4. x - 1 压栈,并分配 3 个 words 以方便清栈
  5. 调用 test_backtrace(x-1)
  6. 调用 cprintf 打印 “leaving test_backtrace x”

QEMU 打印结果

entering test_backtrace 5 entering test_backtrace 4 entering test_backtrace 3 entering test_backtrace 2 entering test_backtrace 1 entering test_backtrace 0 leaving test_backtrace 0 leaving test_backtrace 1 leaving test_backtrace 2 leaving test_backtrace 3 leaving test_backtrace 4 leaving test_backtrace 5

Q2

How many 32-bit words does each recursive nesting level of test_backtrace push on the stack, and what are those words?

将 8 个 words 压栈

  1. 返回地址
  2. %ebp, %esi, %ebx 三个寄存器的值
  3. 输入参数 x - 1
  4. 3 个预留 words

Exercise 11

Implement the backtrace function as specified above. Use the same format as in the example, since otherwise the grading script will be confused. When you think you have it working right, run make grade to see if its output conforms to what our grading script expects, and fix it if it doesn’t. After you have handed in your Lab 1 code, you are welcome to change the output format of the backtrace function any way you like.

If you use read_ebp(), note that GCC may generate “optimized” code that calls read_ebp() before mon_backtrace()’s function prologue, which results in an incomplete stack trace (the stack frame of the most recent function call is missing). While we have tried to disable optimizations that cause this reordering, you may want to examine the assembly of mon_backtrace() and make sure the call to read_ebp() is happening after the function prologue.

  1. read_ebp 中读取 ebp 存储的值。 ebp 实际上是一个指针,指向当前函数栈帧的底部( esp 指向栈顶)
  2. 当前 ebp 指针存储的是调用者的 ebp 寄存器值
  3. 结束从 kern/entry.S 中可得到

    1
    2
    3
    4
    
    # Clear the frame pointer register (EBP)
    # so that once we get into debugging C code,
    # stack backtraces will be terminated properly.
    movl	$0x0,%ebp			# nuke frame pointer
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    
    int mon_backtrace(int argc, char **argv, struct Trapframe *tf)
    {
    // Your code here.
    cprintf("Stack backtrace:\n");
    int i = 0;
    uint32_t *ebp = (uint32_t *)read_ebp();
    while (ebp) {
    uint32_t eip = *((uint32_t *)ebp + 1);
    uint32_t *args = (uint32_t *)ebp + 2;
    cprintf("  ebp %08x  eip %08x  args", ebp, eip);
    for (i = 0; i < 5; ++i) {
      cprintf(" %08x", args[i]);
    }
    cprintf("\n");
    ebp = (uint32_t *)*ebp;
    }
    return 0;
    }
Figure 1: ebp 调用解释图

Figure 1: ebp 调用解释图

Exercise 12

Modify your stack backtrace function to display, for each eip, the function name, source file name, and line number corresponding to that eip.

Q1

In debuginfo_eip, where do __STAB_* come from? This question has a long answer; to help you to discover the answer, here are some things you might want to do:

S1

look in the file kern/kernel.ld for __STAB_*

__STAB_* 均在 kern/kernel.ld 中定义,其中:

  • __STAB_BEGIN, __STAB_END 代表 .stab 段开头与结尾地址
  • __STABSTR_BEGIN, __STABSTR_END 代表 .stabstr 段开头与结尾地址

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    
    /* Include debugging information in kernel memory */
    .stab : {
    PROVIDE(__STAB_BEGIN__ = .);
    *(.stab);
    PROVIDE(__STAB_END__ = .);
    BYTE(0)		/* Force the linker to allocate space
         for this section */
    }
    
    .stabstr : {
    PROVIDE(__STABSTR_BEGIN__ = .);
    *(.stabstr);
    PROVIDE(__STABSTR_END__ = .);
    BYTE(0)		/* Force the linker to allocate space
         for this section */
    }

S2

run objdump -h obj/kern/kernel

.text, .rodata, .stab, .stabstr 等几个段都是从加载地址起点 f0100000 依次放置

__STAR_BEGIN = 0xf0102234 , __STAR_END = 0xf0102234 + 0x00003c9d - 1 = 0xf0105ed0

__STARSTR_BEGIN = 0xf0105ed1 , __STARSTR_END = 0xf0105ed1 + 0x00001950 - 1 = 0xf0107eed

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
[email protected]:~/lab# objdump -h obj/kern/kernel

obj/kern/kernel:     file format elf32-i386

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         00001b29  f0100000  00100000  00001000  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 .rodata       000006f4  f0101b40  00101b40  00002b40  2**5
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  2 .stab         00003c9d  f0102234  00102234  00003234  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  3 .stabstr      00001950  f0105ed1  00105ed1  00006ed1  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  4 .data         00009300  f0108000  00108000  00009000  2**12
                  CONTENTS, ALLOC, LOAD, DATA
  5 .got          00000008  f0111300  00111300  00012300  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  6 .got.plt      0000000c  f0111308  00111308  00012308  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  7 .data.rel.local 00001000  f0112000  00112000  00013000  2**12
                  CONTENTS, ALLOC, LOAD, DATA
  8 .data.rel.ro.local 00000044  f0113000  00113000  00014000  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  9 .bss          00000648  f0113060  00113060  00014060  2**5
                  CONTENTS, ALLOC, LOAD, DATA
 10 .comment      0000002b  00000000  00000000  000146a8  2**0
                  CONTENTS, READONLY

S3

run objdump -G obj/kern/kernel

共显示 1294 个 stab 信息

   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
[email protected]:~/lab# objdump -G obj/kern/kernel

obj/kern/kernel:     file format elf32-i386

Contents of .stab section:

Symnum n_type n_othr n_desc n_value  n_strx String

-1     HdrSym 0      1292   0000194f 1
0      SO     0      0      f0100000 1      {standard input}
1      SOL    0      0      f010000c 18     kern/entry.S
2      SLINE  0      44     f010000c 0
3      SLINE  0      57     f0100015 0
4      SLINE  0      58     f010001a 0
5      SLINE  0      60     f010001d 0
6      SLINE  0      61     f0100020 0
7      SLINE  0      62     f0100025 0
8      SLINE  0      67     f0100028 0
9      SLINE  0      68     f010002d 0
10     SLINE  0      74     f010002f 0
11     SLINE  0      77     f0100034 0
12     SLINE  0      80     f0100039 0
13     SLINE  0      83     f010003e 0
14     SO     0      2      f0100040 31     kern/entrypgdir.c
15     OPT    0      0      00000000 49     gcc2_compiled.
16     LSYM   0      0      00000000 64     int:t(0,1)=r(0,1);-2147483648;2147483647;
17     LSYM   0      0      00000000 106    char:t(0,2)=r(0,2);0;127;
18     LSYM   0      0      00000000 132    long int:t(0,3)=r(0,3);-2147483648;2147483647;
19     LSYM   0      0      00000000 179    unsigned int:t(0,4)=r(0,4);0;4294967295;
20     LSYM   0      0      00000000 220    long unsigned int:t(0,5)=r(0,5);0;4294967295;
21     LSYM   0      0      00000000 266    __int128:t(0,6)=r(0,6);0;-1;
22     LSYM   0      0      00000000 295    __int128 unsigned:t(0,7)=r(0,7);0;-1;
23     LSYM   0      0      00000000 333    long long int:t(0,8)=r(0,8);-0;4294967295;
24     LSYM   0      0      00000000 376    long long unsigned int:t(0,9)=r(0,9);0;-1;
25     LSYM   0      0      00000000 419    short int:t(0,10)=r(0,10);-32768;32767;
26     LSYM   0      0      00000000 459    short unsigned int:t(0,11)=r(0,11);0;65535;
27     LSYM   0      0      00000000 503    signed char:t(0,12)=r(0,12);-128;127;
28     LSYM   0      0      00000000 541    unsigned char:t(0,13)=r(0,13);0;255;
29     LSYM   0      0      00000000 578    float:t(0,14)=r(0,1);4;0;
30     LSYM   0      0      00000000 604    double:t(0,15)=r(0,1);8;0;
31     LSYM   0      0      00000000 631    long double:t(0,16)=r(0,1);12;0;
32     LSYM   0      0      00000000 664    _Float32:t(0,17)=r(0,1);4;0;
33     LSYM   0      0      00000000 693    _Float64:t(0,18)=r(0,1);8;0;
34     LSYM   0      0      00000000 722    _Float128:t(0,19)=r(0,1);16;0;
35     LSYM   0      0      00000000 753    _Float32x:t(0,20)=r(0,1);8;0;
36     LSYM   0      0      00000000 783    _Float64x:t(0,21)=r(0,1);12;0;
37     LSYM   0      0      00000000 814    _Decimal32:t(0,22)=r(0,1);4;0;
38     LSYM   0      0      00000000 845    _Decimal64:t(0,23)=r(0,1);8;0;
39     LSYM   0      0      00000000 876    _Decimal128:t(0,24)=r(0,1);16;0;
40     LSYM   0      0      00000000 909    void:t(0,25)=(0,25)
41     BINCL  0      0      000159c2 929    ./inc/mmu.h
42     BINCL  0      0      000060d4 941    ./inc/types.h
43     LSYM   0      0      00000000 955    bool:t(2,1)=(2,2)=eFalse:0,True:1,;
44     LSYM   0      0      00000000 991     :T(2,3)=efalse:0,true:1,;
45     LSYM   0      0      00000000 1018   int8_t:t(2,4)=(0,12)
46     LSYM   0      0      00000000 1039   uint8_t:t(2,5)=(0,13)
47     LSYM   0      0      00000000 1061   int16_t:t(2,6)=(0,10)
48     LSYM   0      0      00000000 1083   uint16_t:t(2,7)=(0,11)
49     LSYM   0      0      00000000 1106   int32_t:t(2,8)=(0,1)
50     LSYM   0      0      00000000 1127   uint32_t:t(2,9)=(0,4)
51     LSYM   0      0      00000000 1149   int64_t:t(2,10)=(0,8)
52     LSYM   0      0      00000000 1171   uint64_t:t(2,11)=(0,9)
53     LSYM   0      0      00000000 1194   intptr_t:t(2,12)=(2,8)
54     LSYM   0      0      00000000 1217   uintptr_t:t(2,13)=(2,9)
55     LSYM   0      0      00000000 1241   physaddr_t:t(2,14)=(2,9)
56     LSYM   0      0      00000000 1266   ppn_t:t(2,15)=(2,9)
57     LSYM   0      0      00000000 1286   size_t:t(2,16)=(2,9)
58     LSYM   0      0      00000000 1307   ssize_t:t(2,17)=(2,8)
59     LSYM   0      0      00000000 1329   off_t:t(2,18)=(2,8)
60     EINCL  0      0      00000000 0
61     LSYM   0      0      00000000 1349   Segdesc:T(1,1)=s8sd_lim_15_0:(0,4),0,16;sd_base_15_0:(0,4),16,16;sd_base_23_16:(0,4),32,8;sd_type:(0,4),40,4;sd_s:(0,4),44,1;sd_dpl:(0,4),45,2;sd_p:(0,4),47,1;sd_lim_1
9_16:(0,4),48,4;sd_avl:(0,4),52,1;sd_rsv1:(0,4),53,1;sd_db:(0,4),54,1;sd_g:(0,4),55,1;sd_base_31_24:(0,4),56,8;;
62     LSYM   0      0      00000000 1629   Taskstate:T(1,2)=s104ts_link:(2,9),0,32;ts_esp0:(2,13),32,32;ts_ss0:(2,7),64,16;ts_padding1:(2,7),80,16;ts_esp1:(2,13),96,32;ts_ss1:(2,7),128,16;ts_padding2:(2,7),144,
16;ts_esp2:(2,13),160,32;ts_ss2:(2,7),192,16;ts_padding3:(2,7),208,16;ts_cr3:(2,14),224,32;ts_eip:(2,13),256,32;ts_eflags:(2,9),288,32;ts_eax:(2,9),320,32;ts_ecx:(2,9),352,32;ts_edx:(2,9),384,32;ts_ebx:(2,9),416
,32;ts_esp:(2,13),448,32;ts_ebp:(2,13),480,32;ts_esi:(2,9),512,32;ts_edi:(2,9),544,32;ts_es:(2,7),576,16;ts_padding4:(2,7),592,16;ts_cs:(2,7),608,16;ts_padding5:(2,7),624,16;ts_ss:(2,7),640,16;ts_padding6:(2,7),
656,16;ts_ds:(2,7),672,16;ts_padding7:(2,7),688,16;ts_fs:(2,7),704,16;ts_padding8:(2,7),720,16;ts_gs:(2,7),736,16;ts_padding9:(2,7),752,16;ts_ldt:(2,7),768,16;ts_padding10:(2,7),784,16;ts_t:(2,7),800,16;ts_iomb:
(2,7),816,16;;
63     LSYM   0      0      00000000 2444   Gatedesc:T(1,3)=s8gd_off_15_0:(0,4),0,16;gd_sel:(0,4),16,16;gd_args:(0,4),32,5;gd_rsv1:(0,4),37,3;gd_type:(0,4),40,4;gd_s:(0,4),44,1;gd_dpl:(0,4),45,2;gd_p:(0,4),47,1;
gd_off_31_16:(0,4),48,16;;
64     LSYM   0      0      00000000 2638   Pseudodesc:T(1,4)=s6pd_lim:(2,7),0,16;pd_base:(2,9),16,32;;
65     EINCL  0      0      00000000 0
66     BINCL  0      0      000008c7 2698   ./inc/memlayout.h
67     LSYM   0      0      00000000 2716   pte_t:t(3,1)=(2,9)
68     LSYM   0      0      00000000 2735   pde_t:t(3,2)=(2,9)
69     EINCL  0      0      00000000 0
70     GSYM   0      0      00000000 2754   entry_pgdir:G(0,26)=ar(0,27)=r(0,27);0;4294967295;;0;1023;(3,2)
71     GSYM   0      0      00000000 2818   entry_pgtable:G(0,28)=ar(0,27);0;1023;(3,1)
72     SO     0      0      f0100040 0
73     SO     0      2      f0100040 2862   kern/init.c
74     OPT    0      0      00000000 49     gcc2_compiled.
75     LSYM   0      0      00000000 64     int:t(0,1)=r(0,1);-2147483648;2147483647;
76     LSYM   0      0      00000000 106    char:t(0,2)=r(0,2);0;127;
77     LSYM   0      0      00000000 132    long int:t(0,3)=r(0,3);-2147483648;2147483647;
78     LSYM   0      0      00000000 179    unsigned int:t(0,4)=r(0,4);0;4294967295;
79     LSYM   0      0      00000000 220    long unsigned int:t(0,5)=r(0,5);0;4294967295;
80     LSYM   0      0      00000000 266    __int128:t(0,6)=r(0,6);0;-1;
81     LSYM   0      0      00000000 295    __int128 unsigned:t(0,7)=r(0,7);0;-1;
82     LSYM   0      0      00000000 333    long long int:t(0,8)=r(0,8);-0;4294967295;
83     LSYM   0      0      00000000 376    long long unsigned int:t(0,9)=r(0,9);0;-1;
84     LSYM   0      0      00000000 419    short int:t(0,10)=r(0,10);-32768;32767;
85     LSYM   0      0      00000000 459    short unsigned int:t(0,11)=r(0,11);0;65535;
86     LSYM   0      0      00000000 503    signed char:t(0,12)=r(0,12);-128;127;
87     LSYM   0      0      00000000 541    unsigned char:t(0,13)=r(0,13);0;255;
88     LSYM   0      0      00000000 578    float:t(0,14)=r(0,1);4;0;
89     LSYM   0      0      00000000 604    double:t(0,15)=r(0,1);8;0;
90     LSYM   0      0      00000000 631    long double:t(0,16)=r(0,1);12;0;
91     LSYM   0      0      00000000 664    _Float32:t(0,17)=r(0,1);4;0;
92     LSYM   0      0      00000000 693    _Float64:t(0,18)=r(0,1);8;0;
93     LSYM   0      0      00000000 722    _Float128:t(0,19)=r(0,1);16;0;
94     LSYM   0      0      00000000 753    _Float32x:t(0,20)=r(0,1);8;0;
95     LSYM   0      0      00000000 783    _Float64x:t(0,21)=r(0,1);12;0;
96     LSYM   0      0      00000000 814    _Decimal32:t(0,22)=r(0,1);4;0;
97     LSYM   0      0      00000000 845    _Decimal64:t(0,23)=r(0,1);8;0;
98     LSYM   0      0      00000000 876    _Decimal128:t(0,24)=r(0,1);16;0;
99     LSYM   0      0      00000000 909    void:t(0,25)=(0,25)
100    BINCL  0      0      00000000 2874   ./inc/stdio.h
101    BINCL  0      0      00000650 2888   ./inc/stdarg.h
102    LSYM   0      0      00000000 2903   va_list:t(2,1)=(2,2)=*(0,2)
103    EINCL  0      0      00000000 0
104    EINCL  0      0      00000000 0
105    BINCL  0      0      00000000 2931   ./inc/string.h
106    EXCL   0      0      000060d4 941    ./inc/types.h
107    EINCL  0      0      00000000 0
108    FUN    0      0      f0100040 2946   test_backtrace:F(0,25)
109    PSYM   0      0      00000008 2969   x:p(0,1)
110    SLINE  0      13     00000000 0
111    SLINE  0      14     00000013 0
112    SLINE  0      15     00000023 0
113    SLINE  0      18     0000002a 0
114    SLINE  0      19     0000003b 0
115    SLINE  0      20     0000004b 0
116    SLINE  0      16     00000055 0
117    RSYM   0      0      00000006 2978   x:r(0,1)
118    FUN    0      0      f01000a6 2987   i386_init:F(0,25)
119    SLINE  0      24     00000000 0
120    SLINE  0      30     00000012 0
121    SLINE  0      34     00000029 0
122    SLINE  0      36     0000002e 0
123    SLINE  0      39     00000042 0
124    SLINE  0      43     00000051 0
125    FUN    0      0      f0100106 3005   _panic:F(0,25)
126    PSYM   0      0      00000008 3020   file:p(0,26)=*(0,2)
127    PSYM   0      0      0000000c 3040   line:p(0,1)
128    PSYM   0      0      00000010 3052   fmt:p(0,26)
129    SLINE  0      59     00000000 0
130    SLINE  0      62     00000017 0
131    SLINE  0      78     00000022 0
132    SLINE  0      64     00000031 0
133    SLINE  0      67     00000033 0
134    SLINE  0      69     00000035 0
135    SLINE  0      70     00000038 0
136    SLINE  0      71     0000004d 0
137    SLINE  0      72     00000057 0
138    RSYM   0      0      00000007 3064   fmt:r(0,26)
139    FUN    0      0      f0100170 3076   _warn:F(0,25)
140    PSYM   0      0      00000008 3090   file:p(0,26)
141    PSYM   0      0      0000000c 3040   line:p(0,1)
142    PSYM   0      0      00000010 3052   fmt:p(0,26)
143    SLINE  0      84     00000000 0
144    SLINE  0      87     00000010 0
145    SLINE  0      88     00000013 0
146    SLINE  0      89     00000028 0
147    SLINE  0      90     00000034 0
148    SLINE  0      92     00000042 0
149    GSYM   0      0      00000000 3103   panicstr:G(0,26)
150    SO     0      0      f01001bc 0
151    SO     0      2      f01001c0 3120   kern/console.c
152    OPT    0      0      00000000 49     gcc2_compiled.
153    LSYM   0      0      00000000 64     int:t(0,1)=r(0,1);-2147483648;2147483647;
154    LSYM   0      0      00000000 106    char:t(0,2)=r(0,2);0;127;
155    LSYM   0      0      00000000 132    long int:t(0,3)=r(0,3);-2147483648;2147483647;
156    LSYM   0      0      00000000 179    unsigned int:t(0,4)=r(0,4);0;4294967295;
157    LSYM   0      0      00000000 220    long unsigned int:t(0,5)=r(0,5);0;4294967295;
158    LSYM   0      0      00000000 266    __int128:t(0,6)=r(0,6);0;-1;
159    LSYM   0      0      00000000 295    __int128 unsigned:t(0,7)=r(0,7);0;-1;
160    LSYM   0      0      00000000 333    long long int:t(0,8)=r(0,8);-0;4294967295;
161    LSYM   0      0      00000000 376    long long unsigned int:t(0,9)=r(0,9);0;-1;
162    LSYM   0      0      00000000 419    short int:t(0,10)=r(0,10);-32768;32767;
163    LSYM   0      0      00000000 459    short unsigned int:t(0,11)=r(0,11);0;65535;
164    LSYM   0      0      00000000 503    signed char:t(0,12)=r(0,12);-128;127;
165    LSYM   0      0      00000000 541    unsigned char:t(0,13)=r(0,13);0;255;
166    LSYM   0      0      00000000 578    float:t(0,14)=r(0,1);4;0;
167    LSYM   0      0      00000000 604    double:t(0,15)=r(0,1);8;0;
168    LSYM   0      0      00000000 631    long double:t(0,16)=r(0,1);12;0;
169    LSYM   0      0      00000000 664    _Float32:t(0,17)=r(0,1);4;0;
170    LSYM   0      0      00000000 693    _Float64:t(0,18)=r(0,1);8;0;
171    LSYM   0      0      00000000 722    _Float128:t(0,19)=r(0,1);16;0;
172    LSYM   0      0      00000000 753    _Float32x:t(0,20)=r(0,1);8;0;
173    LSYM   0      0      00000000 783    _Float64x:t(0,21)=r(0,1);12;0;
174    LSYM   0      0      00000000 814    _Decimal32:t(0,22)=r(0,1);4;0;
175    LSYM   0      0      00000000 845    _Decimal64:t(0,23)=r(0,1);8;0;
176    LSYM   0      0      00000000 876    _Decimal128:t(0,24)=r(0,1);16;0;
177    LSYM   0      0      00000000 909    void:t(0,25)=(0,25)
178    BINCL  0      0      00000000 3135   ./inc/x86.h
179    EXCL   0      0      000060d4 941    ./inc/types.h
180    EINCL  0      0      00000000 0
181    EXCL   0      0      000008c7 2698   ./inc/memlayout.h
182    EXCL   0      0      000159c2 929    ./inc/mmu.h
183    BINCL  0      0      00000000 3147   ./inc/assert.h
184    EXCL   0      0      00000000 2874   ./inc/stdio.h
185    EXCL   0      0      00000650 2888   ./inc/stdarg.h
186    EINCL  0      0      00000000 0
187    FUN    0      0      f01001c0 3162   serial_proc_data:f(0,1)
188    SLINE  0      52     00000000 0
189    SOL    0      0      f01001c3 3135   ./inc/x86.h
190    SLINE  0      16     00000003 0
191    SOL    0      0      f01001c9 3120   kern/console.c
192    SLINE  0      53     00000009 0
193    SOL    0      0      f01001cd 3135   ./inc/x86.h
194    SLINE  0      16     0000000d 0
195    SOL    0      0      f01001d3 3120   kern/console.c
196    SLINE  0      55     00000013 0
197    SLINE  0      56     00000016 0
198    SLINE  0      54     00000018 0
199    FUN    0      0      f01001df 3186   cons_intr:f(0,25)
200    RSYM   0      0      00000006 3204   proc:P(0,26)=*(0,27)=f(0,1)
201    SLINE  0      397    00000000 0
202    SLINE  0      400    00000012 0
203    SLINE  0      401    00000019 0
204    SLINE  0      403    0000001d 0
205    SLINE  0      404    00000033 0
206    SLINE  0      405    0000003b 0
207    SLINE  0      407    00000047 0
208    RSYM   0      0      00000000 3232   c:r(0,1)
209    LBRAC  0      0      00000000 0
210    RBRAC  0      0      0000004b 0
211    FUN    0      0      f010022a 3241   kbd_proc_data:f(0,1)
212    SLINE  0      317    00000000 0
213    SOL    0      0      f010023a 3135   ./inc/x86.h
214    SLINE  0      16     00000010 0
215    SOL    0      0      f0100240 3120   kern/console.c
216    SLINE  0      323    00000016 0
217    SLINE  0      326    0000001e 0
218    SOL    0      0      f0100250 3135   ./inc/x86.h
219    SLINE  0      16     00000026 0
220    SOL    0      0      f0100258 3120   kern/console.c
221    SLINE  0      331    0000002e 0
222    SLINE  0      335    00000036 0
223    SLINE  0      340    0000003e 0
224    SLINE  0      342    00000049 0
225    SLINE  0      343    0000004e 0
226    SLINE  0      346    00000057 0
227    SLINE  0      347    00000068 0
228    SLINE  0      349    00000078 0
229    SLINE  0      350    0000008b 0
230    SLINE  0      351    0000008f 0
231    SLINE  0      352    00000099 0
232    SLINE  0      359    0000009c 0
233    SLINE  0      360    000000aa 0
234    SOL    0      0      f01002e3 3135   ./inc/x86.h
235    SLINE  0      66     000000b9 0
236    SOL    0      0      f01002f3 3120   kern/console.c
237    SLINE  0      333    000000c9 0
238    SLINE  0      334    000000d0 0
239    SLINE  0      365    000000d5 0
240    SLINE  0      337    000000de 0
241    SLINE  0      338    000000f1 0
242    SLINE  0      339    0000010c 0
243    SLINE  0      353    00000113 0
244    SLINE  0      354    00000116 0
245    SLINE  0      324    00000124 0
246    SLINE  0      327    0000012b 0
247    RSYM   0      0      00000006 3232   c:r(0,1)
248    RSYM   0      0      00000002 3262   data:r(2,5)
249    LCSYM  0      0      f0113060 3274   shift:V(2,9)
250    LBRAC  0      0      00000000 0
251    RSYM   0      0      00000002 3262   data:r(2,5)
252    LBRAC  0      0      00000026 0
253    RBRAC  0      0      0000002e 0
254    RBRAC  0      0      00000132 0
255    FUN    0      0      f010035c 3287   cons_putc:f(0,25)
256    RSYM   0      0      00000000 3305   c:P(0,1)
257    SLINE  0      434    00000000 0
258    SLINE  0      70     00000017 0
259    SOL    0      0      f0100378 3135   ./inc/x86.h
260    SLINE  0      16     0000001c 0
261    SOL    0      0      f010038a 3120   kern/console.c
262    SLINE  0      72     0000002e 0
263    SOL    0      0      f010038d 3135   ./inc/x86.h
264    SLINE  0      16     00000031 0
265    SOL    0      0      f0100390 3120   kern/console.c
266    SLINE  0      71     00000034 0
267    SLINE  0      75     00000040 0
268    SOL    0      0      f01003a4 3135   ./inc/x86.h
269    SLINE  0      66     00000048 0
270    SOL    0      0      f01003aa 3120   kern/console.c
271    SLINE  0      116    0000004e 0
272    SOL    0      0      f01003af 3135   ./inc/x86.h
273    SLINE  0      16     00000053 0
274    SOL    0      0      f01003c1 3120   kern/console.c
275    SLINE  0      116    00000065 0
276    SOL    0      0      f01003c4 3135   ./inc/x86.h
277    SLINE  0      16     00000068 0
278    SOL    0      0      f01003c7 3120   kern/console.c
279    SLINE  0      116    0000006b 0
280    SOL    0      0      f01003d3 3135   ./inc/x86.h
281    SLINE  0      66     00000077 0
282    SOL    0      0      f01003ee 3120   kern/console.c
283    SLINE  0      166    00000092 0
284    SLINE  0      167    0000009d 0
285    SLINE  0      169    000000aa 0
286    SLINE  0      180    000000cd 0
287    SLINE  0      195    000000ea 0
288    SLINE  0      205    000000f9 0
289    SOL    0      0      f010045b 3135   ./inc/x86.h
290    SLINE  0      66     000000ff 0
291    SOL    0      0      f0100463 3120   kern/console.c
292    SLINE  0      206    00000107 0
293    SOL    0      0      f0100473 3135   ./inc/x86.h
294    SLINE  0      66     00000117 0
295    SOL    0      0      f0100483 3120   kern/console.c
296    SLINE  0      438    00000127 0
297    SLINE  0      169    0000012f 0
298    SLINE  0      171    00000134 0
299    SLINE  0      172    00000140 0
300    SLINE  0      173    0000014a 0
301    SLINE  0      177    00000162 0
302    SLINE  0      183    0000016f 0
303    SLINE  0      184    00000179 0
304    SLINE  0      185    00000183 0
305    SLINE  0      186    0000018d 0
306    SLINE  0      187    00000197 0
307    SLINE  0      190    000001a6 0
308    SLINE  0      198    000001cd 0
309    SLINE  0      200    000001e8 0
310    SLINE  0      199    00000205 0
311    SLINE  0      201    00000209 0
312    RSYM   0      0      00000006 3314   i:r(0,1)
313    LBRAC  0      0      00000017 0
314    RBRAC  0      0      0000004e 0
315    RSYM   0      0      00000006 3314   i:r(0,1)
316    LBRAC  0      0      0000004e 0
317    RBRAC  0      0      00000092 0
318    FUN    0      0      f0100572 3323   serial_intr:F(0,25)
319    SLINE  0      60     00000000 0
320    SLINE  0      61     0000000a 0
321    SLINE  0      60     00000015 0
322    SLINE  0      62     0000001b 0
323    SLINE  0      63     00000026 0
324    FUN    0      0      f010059a 3343   kbd_intr:F(0,25)
325    SLINE  0      369    00000000 0
326    SLINE  0      370    00000010 0
327    SLINE  0      371    0000001b 0
328    FUN    0      0      f01005b7 3360   cons_getc:F(0,1)
329    SLINE  0      412    00000000 0
330    SLINE  0      418    00000012 0
331    SLINE  0      419    00000017 0
332    SLINE  0      422    0000001c 0
333    SLINE  0      428    00000022 0
334    SLINE  0      422    00000027 0
335    SLINE  0      423    0000002f 0
336    SLINE  0      424    00000040 0
337    SLINE  0      429    00000048 0
338    SLINE  0      425    0000004e 0
339    RSYM   0      0      00000000 3232   c:r(0,1)
340    LBRAC  0      0      00000000 0
341    RBRAC  0      0      0000005a 0
342    FUN    0      0      f0100611 3377   cons_init:F(0,25)
343    SLINE  0      443    00000000 0
344    SLINE  0      140    00000014 0
345    SLINE  0      141    0000001b 0
346    SLINE  0      142    00000024 0
347    SLINE  0      144    00000035 0
348    SLINE  0      143    0000003f 0
349    SLINE  0      151    00000046 0
350    SOL    0      0      f010065d 3135   ./inc/x86.h
351    SLINE  0      66     0000004c 0
352    SOL    0      0      f0100665 3120   kern/console.c
353    SLINE  0      152    00000054 0
354    SOL    0      0      f0100668 3135   ./inc/x86.h
355    SLINE  0      16     00000057 0
356    SOL    0      0      f010066b 3120   kern/console.c
357    SLINE  0      152    0000005a 0
358    SOL    0      0      f0100671 3135   ./inc/x86.h
359    SLINE  0      66     00000060 0
360    SLINE  0      16     00000068 0
361    SOL    0      0      f010067c 3120   kern/console.c
362    SLINE  0      156    0000006b 0
363    SLINE  0      154    00000074 0
364    SLINE  0      157    00000079 0
365    SOL    0      0      f0100691 3135   ./inc/x86.h
366    SLINE  0      66     00000080 0
367    SLINE  0      16     000000c7 0
368    SOL    0      0      f01006e0 3120   kern/console.c
369    SLINE  0      99     000000cf 0
370    SOL    0      0      f01006e9 3135   ./inc/x86.h
371    SLINE  0      16     000000d8 0
372    SOL    0      0      f01006f5 3120   kern/console.c
373    SLINE  0      448    000000e4 0
374    SLINE  0      450    000000e9 0
375    SLINE  0      146    000000f1 0
376    SLINE  0      147    000000f8 0
377    SLINE  0      139    00000102 0
378    SLINE  0      449    0000010e 0
379    SLINE  0      450    00000120 0
380    RSYM   0      0      00000002 3395   was:r(2,7)
381    LBRAC  0      0      00000014 0
382    RBRAC  0      0      00000080 0
383    RSYM   0      0      00000002 3395   was:r(2,7)
384    LBRAC  0      0      000000f1 0
385    RBRAC  0      0      0000010e 0
386    FUN    0      0      f0100733 3406   cputchar:F(0,25)
387    PSYM   0      0      00000008 3423   c:p(0,1)
388    SLINE  0      457    00000000 0
389    SLINE  0      458    00000006 0
390    SLINE  0      459    0000000e 0
391    FUN    0      0      f0100743 3432   getchar:F(0,1)
392    SLINE  0      463    00000000 0
393    SLINE  0      466    00000006 0
394    SLINE  0      469    0000000f 0
395    RSYM   0      0      00000000 3232   c:r(0,1)
396    LBRAC  0      0      00000000 0
397    RBRAC  0      0      00000011 0
398    FUN    0      0      f0100754 3447   iscons:F(0,1)
399    PSYM   0      0      00000008 3461   fdnum:p(0,1)
400    SLINE  0      473    00000000 0
401    SLINE  0      476    00000003 0
402    LCSYM  0      0      f0113060 3274   shift:V(2,9)
403    LCSYM  0      0      f0113080 3474   cons:S(0,28)=s520buf:(0,29)=ar(0,30)=r(0,30);0;4294967295;;0;511;(2,5),0,4096;rpos:(2,9),4096,32;wpos:(2,9),4128,32;;
404    STSYM  0      0      f0113000 3592   charcode:S(0,31)=ar(0,30);0;3;(0,32)=*(2,5)
405    STSYM  0      0      f0111000 3636   ctlmap:S(0,33)=ar(0,30);0;255;(2,5)
406    STSYM  0      0      f0111100 3672   shiftmap:S(0,33)
407    STSYM  0      0      f0111200 3689   normalmap:S(0,33)
408    STSYM  0      0      f0101c00 3707   togglecode:S(0,33)
409    STSYM  0      0      f0101d00 3726   shiftcode:S(0,33)
410    LCSYM  0      0      f0113288 3744   crt_pos:S(2,7)
411    LCSYM  0      0      f011328c 3759   crt_buf:S(0,34)=*(2,7)
412    LCSYM  0      0      f0113290 3782   addr_6845:S(0,4)
413    LCSYM  0      0      f0113294 3799   serial_exists:S(2,1)
414    SO     0      0      f010075e 0
415    SO     0      2      f0100762 3820   kern/monitor.c
416    OPT    0      0      00000000 49     gcc2_compiled.
417    LSYM   0      0      00000000 64     int:t(0,1)=r(0,1);-2147483648;2147483647;
418    LSYM   0      0      00000000 106    char:t(0,2)=r(0,2);0;127;
419    LSYM   0      0      00000000 132    long int:t(0,3)=r(0,3);-2147483648;2147483647;
420    LSYM   0      0      00000000 179    unsigned int:t(0,4)=r(0,4);0;4294967295;
421    LSYM   0      0      00000000 220    long unsigned int:t(0,5)=r(0,5);0;4294967295;
422    LSYM   0      0      00000000 266    __int128:t(0,6)=r(0,6);0;-1;
423    LSYM   0      0      00000000 295    __int128 unsigned:t(0,7)=r(0,7);0;-1;
424    LSYM   0      0      00000000 333    long long int:t(0,8)=r(0,8);-0;4294967295;
425    LSYM   0      0      00000000 376    long long unsigned int:t(0,9)=r(0,9);0;-1;
426    LSYM   0      0      00000000 419    short int:t(0,10)=r(0,10);-32768;32767;
427    LSYM   0      0      00000000 459    short unsigned int:t(0,11)=r(0,11);0;65535;
428    LSYM   0      0      00000000 503    signed char:t(0,12)=r(0,12);-128;127;
429    LSYM   0      0      00000000 541    unsigned char:t(0,13)=r(0,13);0;255;
430    LSYM   0      0      00000000 578    float:t(0,14)=r(0,1);4;0;
431    LSYM   0      0      00000000 604    double:t(0,15)=r(0,1);8;0;
432    LSYM   0      0      00000000 631    long double:t(0,16)=r(0,1);12;0;
433    LSYM   0      0      00000000 664    _Float32:t(0,17)=r(0,1);4;0;
434    LSYM   0      0      00000000 693    _Float64:t(0,18)=r(0,1);8;0;
435    LSYM   0      0      00000000 722    _Float128:t(0,19)=r(0,1);16;0;
436    LSYM   0      0      00000000 753    _Float32x:t(0,20)=r(0,1);8;0;
437    LSYM   0      0      00000000 783    _Float64x:t(0,21)=r(0,1);12;0;
438    LSYM   0      0      00000000 814    _Decimal32:t(0,22)=r(0,1);4;0;
439    LSYM   0      0      00000000 845    _Decimal64:t(0,23)=r(0,1);8;0;
440    LSYM   0      0      00000000 876    _Decimal128:t(0,24)=r(0,1);16;0;
441    LSYM   0      0      00000000 909    void:t(0,25)=(0,25)
442    EXCL   0      0      00000000 2874   ./inc/stdio.h
443    EXCL   0      0      00000650 2888   ./inc/stdarg.h
444    EXCL   0      0      00000000 2931   ./inc/string.h
445    EXCL   0      0      000060d4 941    ./inc/types.h
446    EXCL   0      0      000008c7 2698   ./inc/memlayout.h
447    EXCL   0      0      000159c2 929    ./inc/mmu.h
448    BINCL  0      0      0000300f 3835   ./kern/kdebug.h
449    LSYM   0      0      00000000 3851   Eipdebuginfo:T(7,1)=s24eip_file:(7,2)=*(0,2),0,32;eip_line:(0,1),32,32;eip_fn_name:(7,2),64,32;eip_fn_namelen:(0,1),96,32;eip_fn_addr:(4,13),128,32;eip_fn_narg:(0,1),1
60,32;;
450    EINCL  0      0      00000000 0
451    LSYM   0      0      00000000 4026   Command:T(0,26)=s12name:(7,2),0,32;desc:(7,2),32,32;func:(0,27)=*(0,28)=f(0,1),64,32;;
452    FUN    0      0      f0100762 4113   mon_help:F(0,1)
453    PSYM   0      0      00000008 4129   argc:p(0,1)
454    PSYM   0      0      0000000c 4141   argv:p(0,29)=*(2,2)
455    PSYM   0      0      00000010 4161   tf:p(0,30)=*(0,31)=xsTrapframe:
456    SLINE  0      33     00000000 0
457    SLINE  0      37     00000010 0
458    SLINE  0      39     00000044 0
459    FUN    0      0      f01007b2 4193   mon_kerninfo:F(0,1)
460    PSYM   0      0      00000008 4129   argc:p(0,1)
461    PSYM   0      0      0000000c 4213   argv:p(0,29)
462    PSYM   0      0      00000010 4226   tf:p(0,30)
463    SLINE  0      43     00000000 0
464    SLINE  0      46     00000014 0
465    SLINE  0      47     00000020 0
466    SLINE  0      48     00000035 0
467    SLINE  0      49     00000052 0
468    SLINE  0      50     0000006f 0
469    SLINE  0      51     0000008c 0
470    SLINE  0      52     000000a9 0
471    SLINE  0      53     000000ac 0
472    SLINE  0      52     000000b4 0
473    SLINE  0      55     000000c4 0
474    FUN    0      0      f0100883 4237   mon_backtrace:F(0,1)
475    PSYM   0      0      00000008 4129   argc:p(0,1)
476    PSYM   0      0      0000000c 4213   argv:p(0,29)
477    PSYM   0      0      00000010 4226   tf:p(0,30)
478    SLINE  0      59     00000000 0
479    SLINE  0      61     00000014 0
480    SOL    0      0      f01008a3 3135   ./inc/x86.h
481    SLINE  0      214    00000020 0
482    SOL    0      0      f01008a5 3820   kern/monitor.c
483    SLINE  0      63     00000022 0
484    SLINE  0      64     00000024 0
485    SLINE  0      67     00000027 0
486    SLINE  0      69     00000030 0
487    SLINE  0      64     00000039 0
488    SLINE  0      67     0000003b 0
489    SLINE  0      69     0000005c 0
490    SLINE  0      68     0000006a 0
491    SLINE  0      71     00000075 0
492    SLINE  0      72     00000084 0
493    SLINE  0      64     00000089 0
494    SLINE  0      75     0000008d 0
495    RSYM   0      0      00000007 4258   ebp:r(0,32)=*(4,9)
496    LBRAC  0      0      00000000 0
497    RBRAC  0      0      0000009a 0
498    FUN    0      0      f010091d 4277   monitor:F(0,25)
499    PSYM   0      0      00000008 4226   tf:p(0,30)
500    SLINE  0      125    00000000 0
501    SLINE  0      128    00000014 0
502    SLINE  0      129    00000020 0
503    SLINE  0      96     00000031 0
504    SLINE  0      97     0000004d 0
505    SLINE  0      98     00000055 0
506    SLINE  0      102    0000005a 0
507    SLINE  0      106    00000060 0
508    SLINE  0      103    0000006f 0
509    SLINE  0      133    00000083 0
510    SLINE  0      134    00000099 0
511    SLINE  0      93     000000a0 0
512    SLINE  0      92     000000a7 0
513    SLINE  0      108    000000b0 0
514    SLINE  0      107    000000b3 0
515    SLINE  0      96     000000ce 0
516    SLINE  0      110    000000d9 0
517    SLINE  0      113    000000e4 0
518    SLINE  0      116    000000e8 0
519    SLINE  0      119    0000011a 0
520    SLINE  0      115    00000134 0
521    SLINE  0      117    00000139 0
522    SLINE  0      135    00000150 0
523    SLINE  0      138    0000015b 0
524    RSYM   0      0      00000006 4293   buf:r(2,2)
525    LBRAC  0      0      00000000 0
526    LSYM   0      0      ffffffb8 4304   argv:(0,33)=ar(0,34)=r(0,34);0;4294967295;;0;15;(2,2)
527    RSYM   0      0      00000000 3314   i:r(0,1)
528    LBRAC  0      0      00000031 0
529    RBRAC  0      0      00000083 0
530    LSYM   0      0      ffffffb8 4358   argv:(0,33)
531    RSYM   0      0      00000000 3314   i:r(0,1)
532    LBRAC  0      0      000000a0 0
533    RBRAC  0      0      00000150 0
534    RBRAC  0      0      00000163 0
535    STSYM  0      0      f0113010 4370   commands:S(0,35)=ar(0,34);0;1;(0,26)
536    SO     0      0      f0100a80 0
537    SO     0      2      f0100a80 4407   kern/printf.c
538    OPT    0      0      00000000 49     gcc2_compiled.
539    LSYM   0      0      00000000 64     int:t(0,1)=r(0,1);-2147483648;2147483647;
540    LSYM   0      0      00000000 106    char:t(0,2)=r(0,2);0;127;
541    LSYM   0      0      00000000 132    long int:t(0,3)=r(0,3);-2147483648;2147483647;
542    LSYM   0      0      00000000 179    unsigned int:t(0,4)=r(0,4);0;4294967295;
543    LSYM   0      0      00000000 220    long unsigned int:t(0,5)=r(0,5);0;4294967295;
544    LSYM   0      0      00000000 266    __int128:t(0,6)=r(0,6);0;-1;
545    LSYM   0      0      00000000 295    __int128 unsigned:t(0,7)=r(0,7);0;-1;
546    LSYM   0      0      00000000 333    long long int:t(0,8)=r(0,8);-0;4294967295;
547    LSYM   0      0      00000000 376    long long unsigned int:t(0,9)=r(0,9);0;-1;
548    LSYM   0      0      00000000 419    short int:t(0,10)=r(0,10);-32768;32767;
549    LSYM   0      0      00000000 459    short unsigned int:t(0,11)=r(0,11);0;65535;
550    LSYM   0      0      00000000 503    signed char:t(0,12)=r(0,12);-128;127;
551    LSYM   0      0      00000000 541    unsigned char:t(0,13)=r(0,13);0;255;
552    LSYM   0      0      00000000 578    float:t(0,14)=r(0,1);4;0;
553    LSYM   0      0      00000000 604    double:t(0,15)=r(0,1);8;0;
554    LSYM   0      0      00000000 631    long double:t(0,16)=r(0,1);12;0;
555    LSYM   0      0      00000000 664    _Float32:t(0,17)=r(0,1);4;0;
556    LSYM   0      0      00000000 693    _Float64:t(0,18)=r(0,1);8;0;
557    LSYM   0      0      00000000 722    _Float128:t(0,19)=r(0,1);16;0;
558    LSYM   0      0      00000000 753    _Float32x:t(0,20)=r(0,1);8;0;
559    LSYM   0      0      00000000 783    _Float64x:t(0,21)=r(0,1);12;0;
560    LSYM   0      0      00000000 814    _Decimal32:t(0,22)=r(0,1);4;0;
561    LSYM   0      0      00000000 845    _Decimal64:t(0,23)=r(0,1);8;0;
562    LSYM   0      0      00000000 876    _Decimal128:t(0,24)=r(0,1);16;0;
563    LSYM   0      0      00000000 909    void:t(0,25)=(0,25)
564    EXCL   0      0      000060d4 941    ./inc/types.h
565    EXCL   0      0      00000000 2874   ./inc/stdio.h
566    EXCL   0      0      00000650 2888   ./inc/stdarg.h
567    FUN    0      0      f0100a80 4421   putch:f(0,25)
568    PSYM   0      0      00000008 4435   ch:p(0,1)
569    PSYM   0      0      0000000c 4445   cnt:p(0,26)=*(0,1)
570    SLINE  0      11     00000000 0
571    SLINE  0      12     00000012 0
572    SLINE  0      14     0000001a 0
573    FUN    0      0      f0100aa2 4464   vcprintf:F(0,1)
574    PSYM   0      0      00000008 4480   fmt:p(0,27)=*(0,2)
575    PSYM   0      0      0000000c 4499   ap:p(3,1)
576    SLINE  0      18     00000000 0
577    SLINE  0      19     00000012 0
578    SLINE  0      21     00000019 0
579    SLINE  0      23     0000002f 0
580    LSYM   0      0      fffffff4 4509   cnt:(0,1)
581    LBRAC  0      0      00000000 0
582    RBRAC  0      0      00000037 0
583    FUN    0      0      f0100ad9 4519   cprintf:F(0,1)
584    PSYM   0      0      00000008 4534   fmt:p(0,27)
585    SLINE  0      27     00000000 0
586    SLINE  0      31     00000006 0
587    SLINE  0      32     00000009 0
588    SLINE  0      36     00000012 0
589    RSYM   0      0      00000000 4546   cnt:r(0,1)
590    LBRAC  0      0      00000000 0
591    RBRAC  0      0      00000014 0
592    SO     0      0      f0100aed 0
593    SO     0      2      f0100aed 4557   kern/kdebug.c
594    OPT    0      0      00000000 49     gcc2_compiled.
595    LSYM   0      0      00000000 64     int:t(0,1)=r(0,1);-2147483648;2147483647;
596    LSYM   0      0      00000000 106    char:t(0,2)=r(0,2);0;127;
597    LSYM   0      0      00000000 132    long int:t(0,3)=r(0,3);-2147483648;2147483647;
598    LSYM   0      0      00000000 179    unsigned int:t(0,4)=r(0,4);0;4294967295;
599    LSYM   0      0      00000000 220    long unsigned int:t(0,5)=r(0,5);0;4294967295;
600    LSYM   0      0      00000000 266    __int128:t(0,6)=r(0,6);0;-1;
601    LSYM   0      0      00000000 295    __int128 unsigned:t(0,7)=r(0,7);0;-1;
602    LSYM   0      0      00000000 333    long long int:t(0,8)=r(0,8);-0;4294967295;
603    LSYM   0      0      00000000 376    long long unsigned int:t(0,9)=r(0,9);0;-1;
604    LSYM   0      0      00000000 419    short int:t(0,10)=r(0,10);-32768;32767;
605    LSYM   0      0      00000000 459    short unsigned int:t(0,11)=r(0,11);0;65535;
606    LSYM   0      0      00000000 503    signed char:t(0,12)=r(0,12);-128;127;
607    LSYM   0      0      00000000 541    unsigned char:t(0,13)=r(0,13);0;255;
608    LSYM   0      0      00000000 578    float:t(0,14)=r(0,1);4;0;
609    LSYM   0      0      00000000 604    double:t(0,15)=r(0,1);8;0;
610    LSYM   0      0      00000000 631    long double:t(0,16)=r(0,1);12;0;
611    LSYM   0      0      00000000 664    _Float32:t(0,17)=r(0,1);4;0;
612    LSYM   0      0      00000000 693    _Float64:t(0,18)=r(0,1);8;0;
613    LSYM   0      0      00000000 722    _Float128:t(0,19)=r(0,1);16;0;
614    LSYM   0      0      00000000 753    _Float32x:t(0,20)=r(0,1);8;0;
615    LSYM   0      0      00000000 783    _Float64x:t(0,21)=r(0,1);12;0;
616    LSYM   0      0      00000000 814    _Decimal32:t(0,22)=r(0,1);4;0;
617    LSYM   0      0      00000000 845    _Decimal64:t(0,23)=r(0,1);8;0;
618    LSYM   0      0      00000000 876    _Decimal128:t(0,24)=r(0,1);16;0;
619    LSYM   0      0      00000000 909    void:t(0,25)=(0,25)
620    BINCL  0      0      00001ca6 4571   ./inc/stab.h
621    EXCL   0      0      000060d4 941    ./inc/types.h
622    LSYM   0      0      00000000 4584   Stab:T(1,1)=s12n_strx:(2,9),0,32;n_type:(2,5),32,8;n_other:(2,5),40,8;n_desc:(2,7),48,16;n_value:(2,13),64,32;;
623    EINCL  0      0      00000000 0
624    EXCL   0      0      000008c7 2698   ./inc/memlayout.h
625    EXCL   0      0      000159c2 929    ./inc/mmu.h
626    EXCL   0      0      00000000 3147   ./inc/assert.h
627    EXCL   0      0      00000000 2874   ./inc/stdio.h
628    EXCL   0      0      00000650 2888   ./inc/stdarg.h
629    EXCL   0      0      0000300f 3835   ./kern/kdebug.h
630    FUN    0      0      f0100aed 4696   stab_binsearch:f(0,25)
631    RSYM   0      0      00000000 4719   stabs:P(0,26)=*(1,1)
632    RSYM   0      0      00000002 4740   region_left:P(0,27)=*(0,1)
633    RSYM   0      0      00000001 4767   region_right:P(0,27)
634    PSYM   0      0      00000008 4788   type:p(0,1)
635    PSYM   0      0      0000000c 4800   addr:p(2,13)
636    SLINE  0      53     00000000 0
637    SLINE  0      54     00000015 0
638    SLINE  0      56     00000023 0
639    SLINE  0      61     00000025 0
640    SLINE  0      60     00000028 0
641    SLINE  0      60     0000002c 0
642    SLINE  0      69     00000036 0
643    SLINE  0      70     00000045 0
644    SLINE  0      71     0000004a 0
645    SLINE  0      68     0000004d 0
646    SLINE  0      56     00000054 0
647    SLINE  0      57     00000059 0
648    SLINE  0      60     00000073 0
649    SLINE  0      63     00000075 0
650    SLINE  0      64     00000078 0
651    SLINE  0      72     0000007a 0
652    SLINE  0      73     0000007f 0
653    SLINE  0      68     0000008a 0
654    SLINE  0      78     00000093 0
655    SLINE  0      80     00000098 0
656    SLINE  0      68     0000009e 0
657    SLINE  0      84     000000a7 0
658    SLINE  0      88     000000ad 0
659    SLINE  0      89     000000b2 0
660    SLINE  0      88     000000c1 0
661    SLINE  0      85     000000c3 0
662    SLINE  0      90     000000d2 0
663    SLINE  0      88     000000d5 0
664    SLINE  0      89     000000d9 0
665    SLINE  0      92     000000e3 0
666    SLINE  0      94     000000e8 0
667    RSYM   0      0      00000007 4813   type:r(0,1)
668    RSYM   0      0      00000000 4825   m:r(0,1)
669    LBRAC  0      0      00000025 0
670    RBRAC  0      0      00000054 0
671    RSYM   0      0      00000000 4825   m:r(0,1)
672    LBRAC  0      0      00000059 0
673    RBRAC  0      0      000000a7 0
674    FUN    0      0      f0100bdd 4834   debuginfo_eip:F(0,1)
675    PSYM   0      0      00000008 4800   addr:p(2,13)
676    PSYM   0      0      0000000c 4855   info:p(0,28)=*(8,1)
677    SLINE  0      106    00000000 0
678    SLINE  0      112    0000001d 0
679    SLINE  0      113    00000025 0
680    SLINE  0      114    0000002c 0
681    SLINE  0      115    0000002f 0
682    SLINE  0      116    00000036 0
683    SLINE  0      117    00000039 0
684    SLINE  0      120    00000040 0
685    SLINE  0      131    0000004c 0
686    SLINE  0      131    0000005e 0
687    SLINE  0      140    00000071 0
688    SLINE  0      141    00000078 0
689    SLINE  0      142    00000095 0
690    SLINE  0      143    000000a6 0
691    SLINE  0      148    000000b4 0
692    SLINE  0      149    000000b7 0
693    SLINE  0      150    000000bd 0
694    SLINE  0      152    000000d7 0
695    SLINE  0      155    000000e2 0
696    SLINE  0      156    00000103 0
697    SLINE  0      157    0000010c 0
698    SLINE  0      170    00000112 0
699    SLINE  0      189    00000128 0
700    SLINE  0      127    00000140 0
701    SLINE  0      165    0000015b 0
702    SLINE  0      166    0000015e 0
703    SLINE  0      192    00000163 0
704    SLINE  0      189    00000169 0
705    SLINE  0      190    0000016d 0
706    SLINE  0      191    00000175 0
707    SLINE  0      191    0000017a 0
708    SLINE  0      193    00000180 0
709    SLINE  0      194    0000019f 0
710    SLINE  0      199    000001a7 0
711    SLINE  0      205    000001ad 0
712    SLINE  0      199    000001b2 0
713    SLINE  0      200    000001b6 0
714    SLINE  0      203    000001cb 0
715    SLINE  0      202    000001cf 0
716    SLINE  0      200    000001d2 0
717    SLINE  0      201    000001d9 0
718    SLINE  0      205    000001df 0
719    SLINE  0      132    000001e6 0
720    SLINE  0      144    000001f4 0
721    SLINE  0      205    000001fb 0
722    SLINE  0      206    00000200 0
723    LSYM   0      0      fffffff4 4875   lfile:(0,1)
724    LSYM   0      0      fffffff0 4887   rfile:(0,1)
725    LSYM   0      0      ffffffec 4899   lfun:(0,1)
726    LSYM   0      0      ffffffe8 4910   rfun:(0,1)
727    RSYM   0      0      00000003 4921   addr:r(2,13)
728    RSYM   0      0      00000007 4934   info:r(0,28)
729    LBRAC  0      0      00000000 0
730    RBRAC  0      0      00000208 0
731    SO     0      0      f0100de5 0
732    SO     0      2      f0100de9 4947   lib/printfmt.c
733    OPT    0      0      00000000 49     gcc2_compiled.
734    LSYM   0      0      00000000 64     int:t(0,1)=r(0,1);-2147483648;2147483647;
735    LSYM   0      0      00000000 106    char:t(0,2)=r(0,2);0;127;
736    LSYM   0      0      00000000 132    long int:t(0,3)=r(0,3);-2147483648;2147483647;
737    LSYM   0      0      00000000 179    unsigned int:t(0,4)=r(0,4);0;4294967295;
738    LSYM   0      0      00000000 220    long unsigned int:t(0,5)=r(0,5);0;4294967295;
739    LSYM   0      0      00000000 266    __int128:t(0,6)=r(0,6);0;-1;
740    LSYM   0      0      00000000 295    __int128 unsigned:t(0,7)=r(0,7);0;-1;
741    LSYM   0      0      00000000 333    long long int:t(0,8)=r(0,8);-0;4294967295;
742    LSYM   0      0      00000000 376    long long unsigned int:t(0,9)=r(0,9);0;-1;
743    LSYM   0      0      00000000 419    short int:t(0,10)=r(0,10);-32768;32767;
744    LSYM   0      0      00000000 459    short unsigned int:t(0,11)=r(0,11);0;65535;
745    LSYM   0      0      00000000 503    signed char:t(0,12)=r(0,12);-128;127;
746    LSYM   0      0      00000000 541    unsigned char:t(0,13)=r(0,13);0;255;
747    LSYM   0      0      00000000 578    float:t(0,14)=r(0,1);4;0;
748    LSYM   0      0      00000000 604    double:t(0,15)=r(0,1);8;0;
749    LSYM   0      0      00000000 631    long double:t(0,16)=r(0,1);12;0;
750    LSYM   0      0      00000000 664    _Float32:t(0,17)=r(0,1);4;0;
751    LSYM   0      0      00000000 693    _Float64:t(0,18)=r(0,1);8;0;
752    LSYM   0      0      00000000 722    _Float128:t(0,19)=r(0,1);16;0;
753    LSYM   0      0      00000000 753    _Float32x:t(0,20)=r(0,1);8;0;
754    LSYM   0      0      00000000 783    _Float64x:t(0,21)=r(0,1);12;0;
755    LSYM   0      0      00000000 814    _Decimal32:t(0,22)=r(0,1);4;0;
756    LSYM   0      0      00000000 845    _Decimal64:t(0,23)=r(0,1);8;0;
757    LSYM   0      0      00000000 876    _Decimal128:t(0,24)=r(0,1);16;0;
758    LSYM   0      0      00000000 909    void:t(0,25)=(0,25)
759    EXCL   0      0      000060d4 941    ./inc/types.h
760    EXCL   0      0      00000000 2874   ./inc/stdio.h
761    EXCL   0      0      00000650 2888   ./inc/stdarg.h
762    BINCL  0      0      00001a2c 4962   ./inc/error.h
763    LSYM   0      0      00000000 4976    :T(4,1)=eE_UNSPECIFIED:1,E_BAD_ENV:2,E_INVAL:3,E_NO_MEM:4,E_NO_FREE_ENV:5,E_FAULT:6,MAXERROR:7,;
764    EINCL  0      0      00000000 0
765    LSYM   0      0      00000000 5074   sprintbuf:T(0,26)=s12buf:(3,2),0,32;ebuf:(3,2),32,32;cnt:(0,1),64,32;;
766    FUN    0      0      f0100de9 5145   printnum:f(0,25)
767    RSYM   0      0      00000007 5162   putch:P(0,27)=*(0,28)=f(0,25)
768    RSYM   0      0      00000006 5192   putdat:P(0,29)=*(0,25)
769    PSYM   0      0      00000008 5215   num:p(0,9)
770    PSYM   0      0      00000010 5226   base:p(0,4)
771    PSYM   0      0      00000014 5238   width:p(0,1)
772    PSYM   0      0      00000018 5251   padc:p(0,1)
773    SLINE  0      38     00000000 0
774    SLINE  0      40     00000027 0
775    SLINE  0      41     00000042 0
776    SLINE  0      45     0000007c 0
777    SLINE  0      44     00000088 0
778    SLINE  0      49     0000008f 0
779    SLINE  0      50     000000ba 0
780    FUN    0      0      f0100eb3 5263   sprintputch:f(0,25)
781    PSYM   0      0      00000008 4435   ch:p(0,1)
782    PSYM   0      0      0000000c 5283   b:p(0,30)=*(0,26)
783    SLINE  0      267    00000000 0
784    SLINE  0      268    00000006 0
785    SLINE  0      269    0000000a 0
786    SLINE  0      270    00000011 0
787    SLINE  0      271    0000001b 0
788    RSYM   0      0      00000000 5301   ch:r(0,1)
789    RSYM   0      0      00000000 5311   b:r(0,30)
790    FUN    0      0      f0100ed0 5321   printfmt:F(0,25)
791    PSYM   0      0      00000008 5338   putch:p(0,27)
792    PSYM   0      0      0000000c 5352   putdat:p(0,29)
793    PSYM   0      0      00000010 5367   fmt:p(0,31)=*(0,2)
794    SLINE  0      251    00000000 0
795    SLINE  0      254    00000006 0
796    SLINE  0      255    00000009 0
797    SLINE  0      257    00000018 0
798    FUN    0      0      f0100eed 5386   vprintfmt:F(0,25)
799    PSYM   0      0      00000008 5338   putch:p(0,27)
800    PSYM   0      0      0000000c 5352   putdat:p(0,29)
801    PSYM   0      0      00000010 5404   fmt:p(0,31)
802    PSYM   0      0      00000014 4499   ap:p(3,1)
803    SLINE  0      84     00000000 0
804    SLINE  0      99     0000001f 0
805    SLINE  0      103    00000023 0
806    SLINE  0      101    0000002a 0
807    SLINE  0      100    00000031 0
808    SLINE  0      102    00000038 0
809    SLINE  0      105    00000040 0
810    SLINE  0      109    00000065 0
811    SLINE  0      105    0000006b 0
812    SLINE  0      114    0000006e 0
813    SLINE  0      105    00000074 0
814    SLINE  0      127    0000007a 0
815    SLINE  0      128    0000007f 0
816    SLINE  0      129    00000086 0
817    SLINE  0      130    00000089 0
818    SLINE  0      127    00000091 0
819    SLINE  0      128    00000094 0
820    SLINE  0      136    00000096 0
821    SLINE  0      105    000000a7 0
822    SLINE  0      149    000000aa 0
823    SLINE  0      150    000000b0 0
824    SLINE  0      105    000000cf 0
825    SLINE  0      145    000000da 0
826    SLINE  0      146    000000e1 0
827    SLINE  0      155    000000eb 0
828    SLINE  0      105    000000ef 0
829    SLINE  0      156    000000f2 0
830    SLINE  0      160    000000f7 0
831    SLINE  0      161    00000106 0
832    SLINE  0      160    00000109 0
833    SLINE  0      161    0000010c 0
834    SLINE  0      165    00000111 0
835    SLINE  0      168    0000011e 0
836    SLINE  0      168    00000123 0
837    SLINE  0      171    0000012e 0
838    SLINE  0      165    00000142 0
839    SLINE  0      169    0000014a 0
840    SLINE  0      165    0000015e 0
841    SLINE  0      169    00000161 0
842    SLINE  0      176    00000166 0
843    SLINE  0      177    00000174 0
844    SLINE  0      178    0000017f 0
845    SLINE  0      179    00000197 0
846    SLINE  0      180    000001ae 0
847    SLINE  0      179    000001ba 0
848    SLINE  0      180    000001bc 0
849    SLINE  0      179    000001c6 0
850    SLINE  0      179    000001cc 0
851    SLINE  0      182    000001ed 0
852    SLINE  0      185    000001f3 0
853    SLINE  0      181    00000200 0
854    SLINE  0      181    00000204 0
855    SLINE  0      181    00000212 0
856    SLINE  0      181    00000216 0
857    SLINE  0      182    00000223 0
858    SLINE  0      183    0000022e 0
859    SLINE  0      187    00000246 0
860    SLINE  0      186    0000024f 0
861    SLINE  0      186    00000255 0
862    SLINE  0      176    00000259 0
863    SLINE  0      70     0000026f 0
864    SLINE  0      71     00000274 0
865    SLINE  0      193    0000028b 0
866    SLINE  0      194    00000291 0
867    SLINE  0      195    0000029a 0
868    SLINE  0      197    000002b0 0
869    SLINE  0      72     000002ba 0
870    SLINE  0      75     000002be 0
871    SLINE  0      73     000002d5 0
872    SLINE  0      197    000002ec 0
873    SLINE  0      57     000002f9 0
874    SLINE  0      58     000002fe 0
875    SLINE  0      203    00000315 0
876    SLINE  0      59     0000031f 0
877    SLINE  0      62     00000323 0
878    SLINE  0      203    0000033c 0
879    SLINE  0      60     00000346 0
880    SLINE  0      203    0000035f 0
881    SLINE  0      57     0000036c 0
882    SLINE  0      58     00000371 0
883    SLINE  0      214    00000388 0
884    SLINE  0      210    0000038d 0
885    SLINE  0      211    00000397 0
886    SLINE  0      212    000003a0 0
887    SLINE  0      214    000003ad 0
888    SLINE  0      59     000003b4 0
889    SLINE  0      62     000003b8 0
890    SLINE  0      60     000003d3 0
891    SLINE  0      219    000003ee 0
892    SLINE  0      220    000003f7 0
893    SLINE  0      221    00000400 0
894    SLINE  0      224    00000410 0
895    SLINE  0      222    00000413 0
896    SLINE  0      223    0000041c 0
897    SLINE  0      231    00000421 0
898    SLINE  0      232    0000043d 0
899    SLINE  0      165    00000440 0
900    SLINE  0      92     00000443 0
901    SLINE  0      93     00000453 0
902    SLINE  0      95     0000045b 0
903    SLINE  0      57     0000046b 0
904    SLINE  0      58     00000470 0
905    SLINE  0      229    00000487 0
906    SLINE  0      59     0000048e 0
907    SLINE  0      62     00000492 0
908    SLINE  0      229    000004ab 0
909    SLINE  0      60     000004b5 0
910    SLINE  0      229    000004ce 0
911    SLINE  0      236    000004d8 0
912    SLINE  0      237    000004e1 0
913    SLINE  0      241    000004e9 0
914    SLINE  0      242    000004f2 0
915    SLINE  0      242    000004f9 0
916    SLINE  0      242    000004fc 0
917    SLINE  0      247    0000050a 0
918    RSYM   0      0      00000002 5416   base:r(0,1)
919    RSYM   0      0      00000001 5428   lflag:r(0,1)
920    RSYM   0      0      00000006 5441   putdat:r(0,29)
921    RSYM   0      0      00000007 5456   fmt:r(0,31)
922    LBRAC  0      0      00000000 0
923    RBRAC  0      0      00000512 0
924    FUN    0      0      f01013ff 5468   vsnprintf:F(0,1)
925    PSYM   0      0      00000008 5485   buf:p(3,2)
926    PSYM   0      0      0000000c 5496   n:p(0,1)
927    PSYM   0      0      00000010 5404   fmt:p(0,31)
928    PSYM   0      0      00000014 4499   ap:p(3,1)
929    SLINE  0      275    00000000 0
930    SLINE  0      276    00000018 0
931    SLINE  0      278    00000029 0
932    SLINE  0      282    00000031 0
933    SLINE  0      285    00000047 0
934    SLINE  0      287    0000004d 0
935    SLINE  0      288    00000053 0
936    SLINE  0      279    00000058 0
937    LSYM   0      0      ffffffec 5505   b:(0,26)
938    RSYM   0      0      00000000 5514   buf:r(3,2)
939    RSYM   0      0      00000002 5525   n:r(0,1)
940    LBRAC  0      0      00000000 0
941    RBRAC  0      0      0000005f 0
942    FUN    0      0      f010145e 5534   snprintf:F(0,1)
943    PSYM   0      0      00000008 5485   buf:p(3,2)
944    PSYM   0      0      0000000c 5496   n:p(0,1)
945    PSYM   0      0      00000010 5404   fmt:p(0,31)
946    SLINE  0      292    00000000 0
947    SLINE  0      296    00000006 0
948    SLINE  0      297    00000009 0
949    SLINE  0      301    00000018 0
950    RSYM   0      0      00000000 5550   rc:r(0,1)
951    LBRAC  0      0      00000000 0
952    RBRAC  0      0      0000001a 0
953    STSYM  0      0      f0113028 5560   error_string:S(0,32)=ar(0,33)=r(0,33);0;4294967295;;0;6;(0,31)
954    SO     0      0      f0101478 0
955    SO     0      2      f0101478 5623   lib/readline.c
956    OPT    0      0      00000000 49     gcc2_compiled.
957    LSYM   0      0      00000000 64     int:t(0,1)=r(0,1);-2147483648;2147483647;
958    LSYM   0      0      00000000 106    char:t(0,2)=r(0,2);0;127;
959    LSYM   0      0      00000000 132    long int:t(0,3)=r(0,3);-2147483648;2147483647;
960    LSYM   0      0      00000000 179    unsigned int:t(0,4)=r(0,4);0;4294967295;
961    LSYM   0      0      00000000 220    long unsigned int:t(0,5)=r(0,5);0;4294967295;
962    LSYM   0      0      00000000 266    __int128:t(0,6)=r(0,6);0;-1;
963    LSYM   0      0      00000000 295    __int128 unsigned:t(0,7)=r(0,7);0;-1;
964    LSYM   0      0      00000000 333    long long int:t(0,8)=r(0,8);-0;4294967295;
965    LSYM   0      0      00000000 376    long long unsigned int:t(0,9)=r(0,9);0;-1;
966    LSYM   0      0      00000000 419    short int:t(0,10)=r(0,10);-32768;32767;
967    LSYM   0      0      00000000 459    short unsigned int:t(0,11)=r(0,11);0;65535;
968    LSYM   0      0      00000000 503    signed char:t(0,12)=r(0,12);-128;127;
969    LSYM   0      0      00000000 541    unsigned char:t(0,13)=r(0,13);0;255;
970    LSYM   0      0      00000000 578    float:t(0,14)=r(0,1);4;0;
971    LSYM   0      0      00000000 604    double:t(0,15)=r(0,1);8;0;
972    LSYM   0      0      00000000 631    long double:t(0,16)=r(0,1);12;0;
973    LSYM   0      0      00000000 664    _Float32:t(0,17)=r(0,1);4;0;
974    LSYM   0      0      00000000 693    _Float64:t(0,18)=r(0,1);8;0;
975    LSYM   0      0      00000000 722    _Float128:t(0,19)=r(0,1);16;0;
976    LSYM   0      0      00000000 753    _Float32x:t(0,20)=r(0,1);8;0;
977    LSYM   0      0      00000000 783    _Float64x:t(0,21)=r(0,1);12;0;
978    LSYM   0      0      00000000 814    _Decimal32:t(0,22)=r(0,1);4;0;
979    LSYM   0      0      00000000 845    _Decimal64:t(0,23)=r(0,1);8;0;
980    LSYM   0      0      00000000 876    _Decimal128:t(0,24)=r(0,1);16;0;
981    LSYM   0      0      00000000 909    void:t(0,25)=(0,25)
982    EXCL   0      0      00000000 2874   ./inc/stdio.h
983    EXCL   0      0      00000650 2888   ./inc/stdarg.h
984    EXCL   0      0      00001a2c 4962   ./inc/error.h
985    FUN    0      0      f0101478 5638   readline:F(2,2)
986    PSYM   0      0      00000008 5654   prompt:p(0,26)=*(0,2)
987    SLINE  0      9      00000000 0
988    SLINE  0      12     00000017 0
989    SLINE  0      13     0000001b 0
990    SLINE  0      16     0000002e 0
991    SLINE  0      15     0000003e 0
992    SLINE  0      20     00000045 0
993    SLINE  0      21     00000055 0
994    SLINE  0      37     0000005d 0
995    SLINE  0      23     00000065 0
996    SLINE  0      25     0000006b 0
997    SLINE  0      24     00000070 0
998    SLINE  0      29     0000007f 0
999    SLINE  0      18     0000008b 0
1000   SLINE  0      19     00000092 0
1001   SLINE  0      22     00000096 0
1002   SLINE  0      26     000000aa 0
1003   SLINE  0      27     000000b7 0
1004   SLINE  0      28     000000bd 0
1005   SLINE  0      30     000000cb 0
1006   SLINE  0      31     000000d5 0
1007   SLINE  0      33     000000db 0
1008   SLINE  0      34     000000e3 0
1009   SLINE  0      32     000000ee 0
1010   RSYM   0      0      00000006 3232   c:r(0,1)
1011   RSYM   0      0      00000000 5676   prompt:r(0,26)
1012   LBRAC  0      0      00000000 0
1013   RBRAC  0      0      000000fd 0
1014   LCSYM  0      0      f01132a0 5691   buf:S(0,27)=ar(0,28)=r(0,28);0;4294967295;;0;1023;(0,2)
1015   SO     0      0      f0101575 0
1016   SO     0      2      f0101575 5747   lib/string.c
1017   OPT    0      0      00000000 49     gcc2_compiled.
1018   LSYM   0      0      00000000 64     int:t(0,1)=r(0,1);-2147483648;2147483647;
1019   LSYM   0      0      00000000 106    char:t(0,2)=r(0,2);0;127;
1020   LSYM   0      0      00000000 132    long int:t(0,3)=r(0,3);-2147483648;2147483647;
1021   LSYM   0      0      00000000 179    unsigned int:t(0,4)=r(0,4);0;4294967295;
1022   LSYM   0      0      00000000 220    long unsigned int:t(0,5)=r(0,5);0;4294967295;
1023   LSYM   0      0      00000000 266    __int128:t(0,6)=r(0,6);0;-1;
1024   LSYM   0      0      00000000 295    __int128 unsigned:t(0,7)=r(0,7);0;-1;
1025   LSYM   0      0      00000000 333    long long int:t(0,8)=r(0,8);-0;4294967295;
1026   LSYM   0      0      00000000 376    long long unsigned int:t(0,9)=r(0,9);0;-1;
1027   LSYM   0      0      00000000 419    short int:t(0,10)=r(0,10);-32768;32767;
1028   LSYM   0      0      00000000 459    short unsigned int:t(0,11)=r(0,11);0;65535;
1029   LSYM   0      0      00000000 503    signed char:t(0,12)=r(0,12);-128;127;
1030   LSYM   0      0      00000000 541    unsigned char:t(0,13)=r(0,13);0;255;
1031   LSYM   0      0      00000000 578    float:t(0,14)=r(0,1);4;0;
1032   LSYM   0      0      00000000 604    double:t(0,15)=r(0,1);8;0;
1033   LSYM   0      0      00000000 631    long double:t(0,16)=r(0,1);12;0;
1034   LSYM   0      0      00000000 664    _Float32:t(0,17)=r(0,1);4;0;
1035   LSYM   0      0      00000000 693    _Float64:t(0,18)=r(0,1);8;0;
1036   LSYM   0      0      00000000 722    _Float128:t(0,19)=r(0,1);16;0;
1037   LSYM   0      0      00000000 753    _Float32x:t(0,20)=r(0,1);8;0;
1038   LSYM   0      0      00000000 783    _Float64x:t(0,21)=r(0,1);12;0;
1039   LSYM   0      0      00000000 814    _Decimal32:t(0,22)=r(0,1);4;0;
1040   LSYM   0      0      00000000 845    _Decimal64:t(0,23)=r(0,1);8;0;
1041   LSYM   0      0      00000000 876    _Decimal128:t(0,24)=r(0,1);16;0;
1042   LSYM   0      0      00000000 909    void:t(0,25)=(0,25)
1043   EXCL   0      0      00000000 2931   ./inc/string.h
1044   EXCL   0      0      000060d4 941    ./inc/types.h
1045   FUN    0      0      f0101575 5760   strlen:F(0,1)
1046   PSYM   0      0      00000008 5774   s:p(0,26)=*(0,2)
1047   SLINE  0      13     00000000 0
1048   SLINE  0      16     00000006 0
1049   SLINE  0      17     0000000d 0
1050   SLINE  0      16     00000010 0
1051   SLINE  0      19     00000016 0
1052   RSYM   0      0      00000000 5525   n:r(0,1)
1053   RSYM   0      0      00000002 5791   s:r(0,26)
1054   LBRAC  0      0      00000000 0
1055   RBRAC  0      0      00000018 0
1056   FUN    0      0      f010158d 5801   strnlen:F(0,1)
1057   PSYM   0      0      00000008 5816   s:p(0,26)
1058   PSYM   0      0      0000000c 5826   size:p(2,16)
1059   SLINE  0      23     00000000 0
1060   SLINE  0      26     00000009 0
1061   SLINE  0      27     00000010 0
1062   SLINE  0      26     00000013 0
1063   SLINE  0      26     00000017 0
1064   SLINE  0      29     0000001d 0
1065   RSYM   0      0      00000000 5525   n:r(0,1)
1066   RSYM   0      0      00000001 5791   s:r(0,26)
1067   LBRAC  0      0      00000000 0
1068   RBRAC  0      0      0000001f 0
1069   FUN    0      0      f01015ac 5839   strcpy:F(0,27)=*(0,2)
1070   PSYM   0      0      00000008 5861   dst:p(0,27)
1071   PSYM   0      0      0000000c 5873   src:p(0,26)
1072   SLINE  0      33     00000000 0
1073   SLINE  0      37     0000000a 0
1074   SLINE  0      37     0000000c 0
1075   SLINE  0      40     0000001d 0
1076   RSYM   0      0      00000000 5885   dst:r(0,27)
1077   RSYM   0      0      00000001 5897   src:r(0,26)
1078   FUN    0      0      f01015cc 5909   strcat:F(0,27)
1079   PSYM   0      0      00000008 5861   dst:p(0,27)
1080   PSYM   0      0      0000000c 5873   src:p(0,26)
1081   SLINE  0      44     00000000 0
1082   SLINE  0      45     00000007 0
1083   SLINE  0      46     00000010 0
1084   SLINE  0      48     0000001b 0
1085   RSYM   0      0      00000000 5924   len:r(0,1)
1086   RSYM   0      0      00000003 5885   dst:r(0,27)
1087   LBRAC  0      0      00000000 0
1088   RBRAC  0      0      00000022 0
1089   FUN    0      0      f01015ee 5935   strncpy:F(0,27)
1090   PSYM   0      0      00000008 5861   dst:p(0,27)
1091   PSYM   0      0      0000000c 5873   src:p(0,26)
1092   PSYM   0      0      00000010 5826   size:p(2,16)
1093   SLINE  0      51     00000000 0
1094   SLINE  0      56     00000010 0
1095   SLINE  0      57     00000014 0
1096   SLINE  0      60     0000001d 0
1097   SLINE  0      56     00000023 0
1098   SLINE  0      63     00000027 0
1099   RSYM   0      0      00000006 5885   dst:r(0,27)
1100   RSYM   0      0      00000001 5897   src:r(0,26)
1101   FUN    0      0      f010161b 5951   strlcpy:F(2,16)
1102   PSYM   0      0      00000008 5861   dst:p(0,27)
1103   PSYM   0      0      0000000c 5873   src:p(0,26)
1104   PSYM   0      0      00000010 5826   size:p(2,16)
1105   SLINE  0      67     00000000 0
1106   SLINE  0      71     00000014 0
1107   SLINE  0      73     0000001a 0
1108   SLINE  0      72     00000023 0
1109   SLINE  0      72     00000027 0
1110   SLINE  0      74     0000002e 0
1111   SLINE  0      76     00000031 0
1112   SLINE  0      77     00000033 0
1113   RSYM   0      0      00000006 5885   dst:r(0,27)
1114   RSYM   0      0      00000002 5897   src:r(0,26)
1115   RSYM   0      0      00000001 5967   size:r(2,16)
1116   FUN    0      0      f0101652 5980   strcmp:F(0,1)
1117   PSYM   0      0      00000008 5994   p:p(0,26)
1118   PSYM   0      0      0000000c 6004   q:p(0,26)
1119   SLINE  0      81     00000000 0
1120   SLINE  0      82     00000009 0
1121   SLINE  0      83     0000000b 0
1122   SLINE  0      82     00000011 0
1123   SLINE  0      82     00000018 0
1124   SLINE  0      84     0000001c 0
1125   SLINE  0      85     00000024 0
1126   RSYM   0      0      00000001 6014   p:r(0,26)
1127   RSYM   0      0      00000002 6024   q:r(0,26)
1128   FUN    0      0      f0101678 6034   strncmp:F(0,1)
1129   PSYM   0      0      00000008 5994   p:p(0,26)
1130   PSYM   0      0      0000000c 6004   q:p(0,26)
1131   PSYM   0      0      00000010 6049   n:p(2,16)
1132   SLINE  0      89     00000000 0
1133   SLINE  0      90     0000000f 0
1134   SLINE  0      91     00000011 0
1135   SLINE  0      90     00000017 0
1136   SLINE  0      90     0000001b 0
1137   SLINE  0      90     00000022 0
1138   SLINE  0      95     00000026 0
1139   SLINE  0      96     0000002e 0
1140   SLINE  0      93     00000031 0
1141   RSYM   0      0      00000000 6014   p:r(0,26)
1142   RSYM   0      0      00000002 6024   q:r(0,26)
1143   FUN    0      0      f01016b0 6059   strchr:F(0,27)
1144   PSYM   0      0      00000008 5816   s:p(0,26)
1145   PSYM   0      0      0000000c 3423   c:p(0,1)
1146   SLINE  0      102    00000000 0
1147   SLINE  0      103    0000000a 0
1148   SLINE  0      104    00000011 0
1149   SLINE  0      103    00000015 0
1150   SLINE  0      106    0000001a 0
1151   SLINE  0      107    0000001f 0
1152   RSYM   0      0      00000000 5791   s:r(0,26)
1153   RSYM   0      0      00000001 6074   c:r(0,2)
1154   FUN    0      0      f01016d1 6083   strfind:F(0,27)
1155   PSYM   0      0      00000008 5816   s:p(0,26)
1156   PSYM   0      0      0000000c 3423   c:p(0,1)
1157   SLINE  0      113    00000000 0
1158   SLINE  0      114    0000000a 0
1159   SLINE  0      114    0000000f 0
1160   SLINE  0      115    00000012 0
1161   SLINE  0      118    0000001a 0
1162   RSYM   0      0      00000000 5791   s:r(0,26)
1163   RSYM   0      0      00000001 6074   c:r(0,2)
1164   FUN    0      0      f01016ed 6099   memset:F(0,28)=*(0,25)
1165   PSYM   0      0      00000008 6122   v:p(0,28)
1166   PSYM   0      0      0000000c 3423   c:p(0,1)
1167   PSYM   0      0      00000010 6049   n:p(2,16)
1168   SLINE  0      123    00000000 0
1169   SLINE  0      126    0000000c 0
1170   SLINE  0      128    00000010 0
1171   SLINE  0      128    00000018 0
1172   SLINE  0      135    0000001d 0
1173   SLINE  0      139    00000023 0
1174   SLINE  0      129    0000002a 0
1175   SLINE  0      130    0000002e 0
1176   SLINE  0      132    00000043 0
1177   SLINE  0      131    00000046 0
1178   RSYM   0      0      00000007 6132   v:r(0,28)
1179   RSYM   0      0      00000001 6142   n:r(2,16)
1180   FUN    0      0      f010173a 6152   memmove:F(0,28)
1181   PSYM   0      0      00000008 6168   dst:p(0,28)
1182   PSYM   0      0      0000000c 6180   src:p(0,29)=*(0,25)
1183   PSYM   0      0      00000010 6049   n:p(2,16)
1184   SLINE  0      143    00000000 0
1185   SLINE  0      149    0000000e 0
1186   SLINE  0      149    00000012 0
1187   SLINE  0      151    00000019 0
1188   SLINE  0      152    0000001c 0
1189   SLINE  0      157    00000028 0
1190   SLINE  0      156    0000002e 0
1191   SLINE  0      159    00000031 0
1192   SLINE  0      152    00000034 0
1193   SLINE  0      154    00000039 0
1194   SLINE  0      153    00000042 0
1195   SLINE  0      161    00000047 0
1196   SLINE  0      165    00000050 0
1197   SLINE  0      169    00000055 0
1198   SLINE  0      161    00000059 0
1199   SLINE  0      163    0000005e 0
1200   SLINE  0      162    00000061 0
1201   RSYM   0      0      00000007 6200   d:r(0,27)
1202   RSYM   0      0      00000000 6210   dst:r(0,28)
1203   RSYM   0      0      00000006 6222   src:r(0,29)
1204   RSYM   0      0      00000001 6142   n:r(2,16)
1205   LBRAC  0      0      00000000 0
1206   RBRAC  0      0      00000068 0
1207   FUN    0      0      f01017a2 6234   memcpy:F(0,28)
1208   PSYM   0      0      00000008 6168   dst:p(0,28)
1209   PSYM   0      0      0000000c 6249   src:p(0,29)
1210   PSYM   0      0      00000010 6049   n:p(2,16)
1211   SLINE  0      210    00000000 0
1212   SLINE  0      211    00000003 0
1213   SLINE  0      212    00000011 0
1214   FUN    0      0      f01017b5 6261   memcmp:F(0,1)
1215   PSYM   0      0      00000008 6275   v1:p(0,29)
1216   PSYM   0      0      0000000c 6286   v2:p(0,29)
1217   PSYM   0      0      00000010 6049   n:p(2,16)
1218   SLINE  0      216    00000000 0
1219   SLINE  0      220    00000010 0
1220   SLINE  0      221    00000014 0
1221   SLINE  0      223    0000001e 0
1222   SLINE  0      222    00000026 0
1223   SLINE  0      226    00000030 0
1224   SLINE  0      227    00000035 0
1225   RSYM   0      0      00000000 6297   s1:r(0,30)=*(2,5)
1226   RSYM   0      0      00000002 6315   s2:r(0,30)
1227   RSYM   0      0      00000000 6326   v1:r(0,29)
1228   RSYM   0      0      00000002 6337   v2:r(0,29)
1229   LBRAC  0      0      00000000 0
1230   RBRAC  0      0      00000039 0
1231   FUN    0      0      f01017ee 6348   memfind:F(0,28)
1232   PSYM   0      0      00000008 6364   s:p(0,29)
1233   PSYM   0      0      0000000c 3423   c:p(0,1)
1234   PSYM   0      0      00000010 6049   n:p(2,16)
1235   SLINE  0      231    00000000 0
1236   SLINE  0      232    00000009 0
1237   SLINE  0      233    0000000e 0
1238   SLINE  0      234    00000012 0
1239   SLINE  0      233    00000016 0
1240   SLINE  0      237    0000001b 0
1241   RSYM   0      0      00000002 6374   ends:r(0,29)
1242   RSYM   0      0      00000000 6387   s:r(0,29)
1243   RSYM   0      0      00000001 3232   c:r(0,1)
1244   LBRAC  0      0      00000000 0
1245   RBRAC  0      0      0000001d 0
1246   FUN    0      0      f010180b 6397   strtol:F(0,3)
1247   PSYM   0      0      00000008 5816   s:p(0,26)
1248   PSYM   0      0      0000000c 6411   endptr:p(0,31)=*(0,27)
1249   PSYM   0      0      00000010 6434   base:p(0,1)
1250   SLINE  0      241    00000000 0
1251   SLINE  0      246    0000000c 0
1252   SLINE  0      247    0000000e 0
1253   SLINE  0      246    00000011 0
1254   SLINE  0      250    0000001c 0
1255   SLINE  0      242    00000020 0
1256   SLINE  0      252    00000025 0
1257   SLINE  0      256    00000029 0
1258   SLINE  0      256    00000031 0
1259   SLINE  0      258    00000036 0
1260   SLINE  0      261    0000003a 0
1261   SLINE  0      258    0000003f 0
1262   SLINE  0      261    00000044 0
1263   SLINE  0      251    0000004e 0
1264   SLINE  0      242    00000051 0
1265   SLINE  0      253    00000058 0
1266   SLINE  0      256    00000062 0
1267   SLINE  0      258    00000068 0
1268   SLINE  0      259    0000006c 0
1269   SLINE  0      257    00000076 0
1270   SLINE  0      269    00000080 0
1271   SLINE  0      270    0000008a 0
1272   SLINE  0      275    00000090 0
1273   SLINE  0      277    00000095 0
1274   SLINE  0      267    0000009e 0
1275   SLINE  0      268    000000ab 0
1276   SLINE  0      271    000000b3 0
1277   SLINE  0      272    000000bd 0
1278   SLINE  0      281    000000c5 0
1279   SLINE  0      282    000000cb 0
1280   SLINE  0      283    000000d0 0
1281   SLINE  0      284    000000d9 0
1282   RSYM   0      0      00000007 6446   neg:r(0,1)
1283   RSYM   0      0      00000000 6457   val:r(0,3)
1284   RSYM   0      0      00000001 5791   s:r(0,26)
1285   RSYM   0      0      00000003 5416   base:r(0,1)
1286   LBRAC  0      0      00000000 0
1287   RSYM   0      0      00000002 6468   dig:r(0,1)
1288   LBRAC  0      0      00000080 0
1289   RBRAC  0      0      000000c5 0
1290   RBRAC  0      0      000000de 0
1291   SO     0      0      f01018e9 0

S4

run gcc -pipe -nostdinc -O2 -fno-builtin -I. -MD -Wall -Wno-format -DJOS_KERNEL -gstabs -c -S kern/init.c, and look at init.s.

init.s 内容如下

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
  .file	"init.c"
  .stabs	"kern/init.c",100,0,2,.Ltext0
  .text
.Ltext0:
  .stabs	"gcc2_compiled.",60,0,0,0
  .stabs	"int:t(0,1)=r(0,1);-2147483648;2147483647;",128,0,0,0
  .stabs	"char:t(0,2)=r(0,2);0;127;",128,0,0,0
  .stabs	"long int:t(0,3)=r(0,3);-0;4294967295;",128,0,0,0
  .stabs	"unsigned int:t(0,4)=r(0,4);0;4294967295;",128,0,0,0
  .stabs	"long unsigned int:t(0,5)=r(0,5);0;-1;",128,0,0,0
  .stabs	"__int128:t(0,6)=r(0,6);0;-1;",128,0,0,0
  .stabs	"__int128 unsigned:t(0,7)=r(0,7);0;-1;",128,0,0,0
  .stabs	"long long int:t(0,8)=r(0,8);-0;4294967295;",128,0,0,0
  .stabs	"long long unsigned int:t(0,9)=r(0,9);0;-1;",128,0,0,0
  .stabs	"short int:t(0,10)=r(0,10);-32768;32767;",128,0,0,0
  .stabs	"short unsigned int:t(0,11)=r(0,11);0;65535;",128,0,0,0
  .stabs	"signed char:t(0,12)=r(0,12);-128;127;",128,0,0,0
  .stabs	"unsigned char:t(0,13)=r(0,13);0;255;",128,0,0,0
  .stabs	"float:t(0,14)=r(0,1);4;0;",128,0,0,0
  .stabs	"double:t(0,15)=r(0,1);8;0;",128,0,0,0
  .stabs	"long double:t(0,16)=r(0,1);16;0;",128,0,0,0
  .stabs	"_Float32:t(0,17)=r(0,1);4;0;",128,0,0,0
  .stabs	"_Float64:t(0,18)=r(0,1);8;0;",128,0,0,0
  .stabs	"_Float128:t(0,19)=r(0,1);16;0;",128,0,0,0
  .stabs	"_Float32x:t(0,20)=r(0,1);8;0;",128,0,0,0
  .stabs	"_Float64x:t(0,21)=r(0,1);16;0;",128,0,0,0
  .stabs	"_Decimal32:t(0,22)=r(0,1);4;0;",128,0,0,0
  .stabs	"_Decimal64:t(0,23)=r(0,1);8;0;",128,0,0,0
  .stabs	"_Decimal128:t(0,24)=r(0,1);16;0;",128,0,0,0
  .stabs	"void:t(0,25)=(0,25)",128,0,0,0
  .stabs	"./inc/stdio.h",130,0,0,0
  .stabs	"./inc/stdarg.h",130,0,0,0
  .stabs	"va_list:t(2,1)=(2,2)=(2,3)=ar(2,4)=r(2,4);0;-1;;0;0;(2,5)=xs__va_list_tag:",128,0,0,0
  .stabn	162,0,0,0
  .stabn	162,0,0,0
  .stabs	"./inc/string.h",130,0,0,0
  .stabs	"./inc/types.h",130,0,0,0
  .stabs	"bool:t(4,1)=(4,2)=eFalse:0,True:1,;",128,0,0,0
  .stabs	" :T(4,3)=efalse:0,true:1,;",128,0,0,0
  .stabs	"int8_t:t(4,4)=(0,12)",128,0,0,0
  .stabs	"uint8_t:t(4,5)=(0,13)",128,0,0,0
  .stabs	"int16_t:t(4,6)=(0,10)",128,0,0,0
  .stabs	"uint16_t:t(4,7)=(0,11)",128,0,0,0
  .stabs	"int32_t:t(4,8)=(0,1)",128,0,0,0
  .stabs	"uint32_t:t(4,9)=(0,4)",128,0,0,0
  .stabs	"int64_t:t(4,10)=(0,8)",128,0,0,0
  .stabs	"uint64_t:t(4,11)=(0,9)",128,0,0,0
  .stabs	"intptr_t:t(4,12)=(4,8)",128,0,0,0
  .stabs	"uintptr_t:t(4,13)=(4,9)",128,0,0,0
  .stabs	"physaddr_t:t(4,14)=(4,9)",128,0,0,0
  .stabs	"ppn_t:t(4,15)=(4,9)",128,0,0,0
  .stabs	"size_t:t(4,16)=(4,9)",128,0,0,0
  .stabs	"ssize_t:t(4,17)=(4,8)",128,0,0,0
  .stabs	"off_t:t(4,18)=(4,8)",128,0,0,0
  .stabn	162,0,0,0
  .stabn	162,0,0,0
  .section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
  .string	"entering test_backtrace %d\n"
.LC1:
  .string	"leaving test_backtrace %d\n"
  .text
  .p2align 4,,15
  .stabs	"test_backtrace:F(0,25)",36,0,0,test_backtrace
  .stabs	"x:P(0,1)",64,0,0,3
  .globl	test_backtrace
  .type	test_backtrace, @function
test_backtrace:
  .stabn	68,0,13,.LM0-.LFBB1
.LM0:
.LFBB1:
.LFB0:
  .cfi_startproc
  pushq	%rbx
  .cfi_def_cfa_offset 16
  .cfi_offset 3, -16
  .stabn	68,0,14,.LM1-.LFBB1
.LM1:
  movl	%edi, %esi
  .stabn	68,0,13,.LM2-.LFBB1
.LM2:
  movl	%edi, %ebx
  .stabn	68,0,14,.LM3-.LFBB1
.LM3:
  leaq	.LC0(%rip), %rdi
  xorl	%eax, %eax
  call	[email protected]
  .stabn	68,0,15,.LM4-.LFBB1
.LM4:
  testl	%ebx, %ebx
  jg	.L6
  .stabn	68,0,18,.LM5-.LFBB1
.LM5:
  xorl	%edx, %edx
  xorl	%esi, %esi
  xorl	%edi, %edi
  call	[email protected]
.L3:
  .stabn	68,0,19,.LM6-.LFBB1
.LM6:
  movl	%ebx, %esi
  leaq	.LC1(%rip), %rdi
  xorl	%eax, %eax
  .stabn	68,0,20,.LM7-.LFBB1
.LM7:
  popq	%rbx
  .cfi_remember_state
  .cfi_def_cfa_offset 8
  .stabn	68,0,19,.LM8-.LFBB1
.LM8:
  jmp	[email protected]
  .p2align 4,,10
  .p2align 3
.L6:
  .cfi_restore_state
  .stabn	68,0,16,.LM9-.LFBB1
.LM9:
  leal	-1(%rbx), %edi
  call	test_backtrace
  jmp	.L3
  .cfi_endproc
.LFE0:
  .size	test_backtrace, .-test_backtrace
.Lscope1:
  .section	.rodata.str1.1
.LC2:
  .string	"6828 decimal is %o octal!\n"
  .text
  .p2align 4,,15
  .stabs	"i386_init:F(0,25)",36,0,0,i386_init
  .globl	i386_init
  .type	i386_init, @function
i386_init:
  .stabn	68,0,24,.LM10-.LFBB2
.LM10:
.LFBB2:
.LFB1:
  .cfi_startproc
  .stabn	68,0,30,.LM11-.LFBB2
.LM11:
  leaq	edata(%rip), %rdi
  leaq	end(%rip), %rdx
  .stabn	68,0,24,.LM12-.LFBB2
.LM12:
  subq	$8, %rsp
  .cfi_def_cfa_offset 16
  .stabn	68,0,30,.LM13-.LFBB2
.LM13:
  xorl	%esi, %esi
  subq	%rdi, %rdx
  call	[email protected]
  .stabn	68,0,34,.LM14-.LFBB2
.LM14:
  call	[email protected]
  .stabn	68,0,36,.LM15-.LFBB2
.LM15:
  leaq	.LC2(%rip), %rdi
  movl	$6828, %esi
  xorl	%eax, %eax
  call	[email protected]
  .stabn	68,0,39,.LM16-.LFBB2
.LM16:
  movl	$5, %edi
  call	test_backtrace
  .p2align 4,,10
  .p2align 3
.L8:
  .stabn	68,0,43,.LM17-.LFBB2
.LM17:
  xorl	%edi, %edi
  call	[email protected]
  jmp	.L8
  .cfi_endproc
.LFE1:
  .size	i386_init, .-i386_init
.Lscope2:
  .section	.rodata.str1.1
.LC3:
  .string	"kernel panic at %s:%d: "
.LC4:
  .string	"\n"
  .text
  .p2align 4,,15
  .stabs	"_panic:F(0,25)",36,0,0,_panic
  .stabs	"file:P(0,26)=*(0,2)",64,0,0,5
  .stabs	"line:P(0,1)",64,0,0,4
  .stabs	"fmt:P(0,26)",64,0,0,3
  .globl	_panic
  .type	_panic, @function
_panic:
  .stabn	68,0,59,.LM18-.LFBB3
.LM18:
.LFBB3:
.LFB2:
  .cfi_startproc
  pushq	%rbx
  .cfi_def_cfa_offset 16
  .cfi_offset 3, -16
  movq	%rdx, %rbx
  subq	$208, %rsp
  .cfi_def_cfa_offset 224
  testb	%al, %al
  movq	%rcx, 56(%rsp)
  movq	%r8, 64(%rsp)
  movq	%r9, 72(%rsp)
  je	.L11
  movaps	%xmm0, 80(%rsp)
  movaps	%xmm1, 96(%rsp)
  movaps	%xmm2, 112(%rsp)
  movaps	%xmm3, 128(%rsp)
  movaps	%xmm4, 144(%rsp)
  movaps	%xmm5, 160(%rsp)
  movaps	%xmm6, 176(%rsp)
  movaps	%xmm7, 192(%rsp)
.L11:
  .stabn	68,0,59,.LM19-.LFBB3
.LM19:
  movq	%fs:40, %rax
  movq	%rax, 24(%rsp)
  xorl	%eax, %eax
  .stabn	68,0,62,.LM20-.LFBB3
.LM20:
  cmpq	$0, panicstr(%rip)
  je	.L16
  .p2align 4,,10
  .p2align 3
.L13:
  .stabn	68,0,78,.LM21-.LFBB3
.LM21:
  xorl	%edi, %edi
  call	[email protected]
  jmp	.L13
.L16:
  .stabn	68,0,64,.LM22-.LFBB3
.LM22:
  movq	%rbx, panicstr(%rip)
  .stabn	68,0,67,.LM23-.LFBB3
.LM23:
#APP
# 67 "kern/init.c" 1
  cli; cld
# 0 "" 2
  .stabn	68,0,69,.LM24-.LFBB3
.LM24:
#NO_APP
  leaq	224(%rsp), %rax
  .stabn	68,0,70,.LM25-.LFBB3
.LM25:
  movl	%esi, %edx
  movq	%rdi, %rsi
  leaq	.LC3(%rip), %rdi
  .stabn	68,0,69,.LM26-.LFBB3
.LM26:
  movl	$24, (%rsp)
  movl	$48, 4(%rsp)
  movq	%rax, 8(%rsp)
  leaq	32(%rsp), %rax
  movq	%rax, 16(%rsp)
  .stabn	68,0,70,.LM27-.LFBB3
.LM27:
  xorl	%eax, %eax
  call	[email protected]
  .stabn	68,0,71,.LM28-.LFBB3
.LM28:
  movq	%rbx, %rdi
  movq	%rsp, %rsi
  call	[email protected]
  .stabn	68,0,72,.LM29-.LFBB3
.LM29:
  leaq	.LC4(%rip), %rdi
  xorl	%eax, %eax
  call	[email protected]
  jmp	.L13
  .cfi_endproc
.LFE2:
  .size	_panic, .-_panic
  .stabs	"ap:(2,1)",128,0,0,0
  .stabn	192,0,0,.LFBB3-.LFBB3
  .stabn	224,0,0,.Lscope3-.LFBB3
.Lscope3:
  .section	.rodata.str1.1
.LC5:
  .string	"kernel warning at %s:%d: "
  .text
  .p2align 4,,15
  .stabs	"_warn:F(0,25)",36,0,0,_warn
  .stabs	"file:P(0,26)",64,0,0,5
  .stabs	"line:P(0,1)",64,0,0,4
  .stabs	"fmt:P(0,26)",64,0,0,3
  .globl	_warn
  .type	_warn, @function
_warn:
  .stabn	68,0,84,.LM30-.LFBB4
.LM30:
.LFBB4:
.LFB3:
  .cfi_startproc
  pushq	%rbx
  .cfi_def_cfa_offset 16
  .cfi_offset 3, -16
  movq	%rdx, %rbx
  subq	$208, %rsp
  .cfi_def_cfa_offset 224
  testb	%al, %al
  movq	%rcx, 56(%rsp)
  movq	%r8, 64(%rsp)
  movq	%r9, 72(%rsp)
  je	.L18
  movaps	%xmm0, 80(%rsp)
  movaps	%xmm1, 96(%rsp)
  movaps	%xmm2, 112(%rsp)
  movaps	%xmm3, 128(%rsp)
  movaps	%xmm4, 144(%rsp)
  movaps	%xmm5, 160(%rsp)
  movaps	%xmm6, 176(%rsp)
  movaps	%xmm7, 192(%rsp)
.L18:
  .stabn	68,0,84,.LM31-.LFBB4
.LM31:
  movq	%fs:40, %rax
  movq	%rax, 24(%rsp)
  xorl	%eax, %eax
  .stabn	68,0,87,.LM32-.LFBB4
.LM32:
  leaq	224(%rsp), %rax
  .stabn	68,0,88,.LM33-.LFBB4
.LM33:
  movl	%esi, %edx
  movq	%rdi, %rsi
  leaq	.LC5(%rip), %rdi
  .stabn	68,0,87,.LM34-.LFBB4
.LM34:
  movq	%rax, 8(%rsp)
  leaq	32(%rsp), %rax
  movl	$24, (%rsp)
  movl	$48, 4(%rsp)
  movq	%rax, 16(%rsp)
  .stabn	68,0,88,.LM35-.LFBB4
.LM35:
  xorl	%eax, %eax
  call	[email protected]
  .stabn	68,0,89,.LM36-.LFBB4
.LM36:
  movq	%rsp, %rsi
  movq	%rbx, %rdi
  call	[email protected]
  .stabn	68,0,90,.LM37-.LFBB4
.LM37:
  leaq	.LC4(%rip), %rdi
  xorl	%eax, %eax
  call	[email protected]
  .stabn	68,0,92,.LM38-.LFBB4
.LM38:
  movq	24(%rsp), %rax
  xorq	%fs:40, %rax
  jne	.L21
  addq	$208, %rsp
  .cfi_remember_state
  .cfi_def_cfa_offset 16
  popq	%rbx
  .cfi_def_cfa_offset 8
  ret
.L21:
  .cfi_restore_state
  call	[email protected]
  .cfi_endproc
.LFE3:
  .size	_warn, .-_warn
  .stabs	"ap:(2,1)",128,0,0,0
  .stabn	192,0,0,.LFBB4-.LFBB4
  .stabn	224,0,0,.Lscope4-.LFBB4
.Lscope4:
  .comm	panicstr,8,8
  .stabs	"panicstr:G(0,26)",32,0,0,0
  .stabs	"",100,0,0,.Letext0
.Letext0:
  .ident	"GCC: (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0"
  .section	.note.GNU-stack,"",@progbits

S5

see if the bootloader loads the symbol table in memory as part of loading the kernel binary

S2 中得到 .stabstr 起始地址为 0xf0105ed1

打印前 8 个字符串信息可见加载内核时符号表也一起加载

1
2
3
4
5
6
7
8
9
(gdb) x/8s 0xf0105ed1
0xf0105ed1:     ""
0xf0105ed2:     "{standard input}"
0xf0105ee3:     "kern/entry.S"
0xf0105ef0:     "kern/entrypgdir.c"
0xf0105f02:     "gcc2_compiled."
0xf0105f11:     "int:t(0,1)=r(0,1);-2147483648;2147483647;"
0xf0105f3b:     "char:t(0,2)=r(0,2);0;127;"
0xf0105f55:     "long int:t(0,3)=r(0,3);-2147483648;2147483647;"

Q2

Complete the implementation of debuginfo_eip by inserting the call to stab_binsearch to find the line number for an address.

S3 中得到片段:

1
2
3
4
5
6
7
118    FUN    0      0      f01000a6 2987   i386_init:F(0,25)
119    SLINE  0      24     00000000 0
120    SLINE  0      30     00000012 0
121    SLINE  0      34     00000029 0
122    SLINE  0      36     0000002e 0
123    SLINE  0      39     00000042 0
124    SLINE  0      43     00000051 0

整理下

Symnum n_type n_othr n_desc n_value nstrx String
118 FUN 0 0 f01000a6 2987 i386_init:F(0,25)
119 SLINE 0 24 00000000 0
120 SLINE 0 30 00000012 0
121 SLINE 0 34 00000029 0
122 SLINE 0 36 0000002e 0
123 SLINE 0 39 00000042 0
124 SLINE 0 43 00000051 0
Symnum
符号索引(把整个符号表看成一个数组,Symnum 是数组下标)
n_type
符号类型, FUN 函数名; SLINE 指 text 段中行号
n_othr
未知
n_desc
文件中行数
n_value
地址, FUN 中为绝对地址, SLINE 为偏移量,需要加上绝对地址

结合 debuginfo_eip 注释分析,得

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
// Search within [lline, rline] for the line number stab.
// If found, set info->eip_line to the right line number.
// If not found, return -1.
//
// Hint:
//	There's a particular stabs type used for line numbers.
//	Look at the STABS documentation and <inc/stab.h> to find
//	which one.
// Your code here.
stab_binsearch(stabs, &lline, &rline, N_SLINE, addr);

if (lline <= rline) {
  info->eip_line = stabs[lline].n_desc;
} else {
  return -1;
}

Q3

S1

Add a backtrace command to the kernel monitor

kern/monitor.c 中加入

1
2
3
4
5
static struct Command commands[] = {
    {"help", "Display this list of commands", mon_help},
    {"kerninfo", "Display information about the kernel", mon_kerninfo},
    {"backtrace", "Display a backtrace of the function stack", mon_kerninfo},
};

S2

extend your implementation of mon_backtrace to call debuginfo_eip and print a line for each stack frame of the form:

K> backtrace Stack backtrace: ebp f010ff78 eip f01008ae args 00000001 f010ff8c 00000000 f0110580 00000000 kern/monitor.c:143: monitor+106 ebp f010ffd8 eip f0100193 args 00000000 00001aac 00000660 00000000 00000000 kern/init.c:49: i386_init+59 ebp f010fff8 eip f010003d args 00000000 00000000 0000ffff 10cf9a00 0000ffff kern/entry.S:70: +0 K>

Each line gives the file name and line within that file of the stack frame’s eip, followed by the name of the function and the offset of the eip from the first instruction of the function (e.g., monitor+106 means the return eip is 106 bytes past the beginning of monitor).

Be sure to print the file and function names on a separate line, to avoid confusing the grading script.

Tip: printf format strings provide an easy, albeit obscure, way to print non-null-terminated strings like those in STABS tables. printf(“%.*s”, length, string) prints at most length characters of string. Take a look at the printf man page to find out why this works.

You may find that some functions are missing from the backtrace. For example, you will probably see a call to monitor() but not to runcmd(). This is because the compiler in-lines some function calls. Other optimizations may cause you to see unexpected line numbers. If you get rid of the -O2 from GNUMakefile, the backtraces may make more sense (but your kernel will run more slowly).

如同 test_backtrace:F(0,25) 需要将 F(0,25) 去除,可通过下面代码实现

1
printf("%.*s", length, string);

最终代码

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
int
mon_backtrace(int argc, char **argv, struct Trapframe *tf)
{
  // Your code here.
  cprintf("Stack backtrace:\n");
  int i = 0;
  uint32_t *ebp = (uint32_t *)read_ebp();

  struct Eipdebuginfo info;

  while (ebp) {
    uint32_t eip = *((uint32_t *)ebp + 1);
    uint32_t *args = (uint32_t *)ebp + 2;
    cprintf("  ebp %08x  eip %08x  args", ebp, eip);
    for (i = 0; i < 5; ++i) {
      cprintf(" %08x", args[i]);
    }
    cprintf("\n");

    memset(&info, 0, sizeof(struct Eipdebuginfo));

    if (debuginfo_eip(eip, &info)) {
      cprintf("failed to get debuginfo for eip %08x.\n");
    } else {
      cprintf("         %s:%d: %.*s+%u\n",
              info.eip_file,
              info.eip_line,
              info.eip_fn_namelen,
              info.eip_fn_name,
              eip - info.eip_fn_addr);
    }

    ebp = (uint32_t *)*ebp;
  }
  return 0;
}