?Process Scheduling. Linux scheduler allocates CPU time slices to processes. The scheduler manages the time slices using timer
interrupts and selects the next best task at each scheduling. This means that when stepping through the code in Trace32,
you may see the program counter jumping to scheduler or another process. As a result, especially for userspace debugging,
one has to be aware of which process you are debugging.
基于时间片调度的操作系统;
?Virtual memory. 1G/3G virtual memory split is the most common memory split found in Linux systems.
This means that top 1G virtual memory is reserved for Linux kernel and the remaining 3G is available
for userspace processes. So while debugging, at any point the code from 0xC0000000 to 0xFFFFFFFF is kernel code,
while 0x00 to 0xBFFFFFFF is userspace. The userspace code is process specific, so one cannot assume that you
will hit the same code at a given address, as this will depend on the userspace process that is running.
内核空间: 0xC0000000 to 0xFFFFFFFF ---顶部的1G空间
系统空间: 0x00 to 0xBFFFFFFF ---底部的3G空间
?Dynamic libraries. Shared libraries may be loaded dynamically at runtime. If you are debugging one of these libraries
that is loaded at runtime, you will have to know the address at which the library loaded, and map the library symbols
accordingly. Android prelinks commonly used libraries at predefined addresses in the virtual address space of the process.
You can check out build/core/prelink-linux-arm.map in the Android build tree for this information. On target,
you can also 'cat /proc/<pid>/maps' to get information on libraries and their addresses that are loaded in a process's
context
----开源的动态库问题:动态库的含义就是时候加载; cat /proc/<pid>/maps 或者 build/core/prelink-linux-arm.map
?Loading symbols. Since the top 1G virtual memory is always used by Linux kernel, one can load Linux kernel symbols from
vmlinux and the symbols in top 1G will always be valid. However when loading userspace symbols, one has to load them
in process context. This can be specified as part of the data.load command.
--- trace32的符号加载的问题,data.load
首先讲讲硬件连接,必须保证你的trace32是连接到arm11的JTAG口上,其他连接不细说了。
打开trace32的命令窗口,并对cpu设置,如下图所示
处理其类型以及RTCK
(1)内核加载
然后依次输入命令“cd Z:/out/target/product/msm7627_surf/obj/KERNEL_OBJ”, "d.load.elf vmlinux /nocode",如下图所示:
之后打开符号表,查找你要debug的函数,如下图所示:
设置好断点之后,运行;
当程序运行到断点处并且停止下来后;
通过加载符号表的路径,以便调试器能显示符号
可以看到,已经进入断点,但是一堆的汇编,怎么显示对应的c code呢?用“symbol.sourcepath.setrecursedir z:/kernel”添加路径, 如图: