1,what is abi and api, give some example
API=application programing interface. ABI=?
2, what happens when exception is thrown?
In current function, if there is a try-catch, will go to catch part; If
there is try-finally, will go to finally; Otherwise, will go out of the
function and return to previous call.
3, what if exception is not caught anywhere?
The process will end with a certain error and signal.
4, what must be initialized in the initialization list?
For my style, every field must be initialized. For stl, it's not a must
requirement.If it's a c-style list, it depends on the structure.As I always
init everything, there is no problem.
5, what is reference vs. pointer?
Almost the same. Both represents the address of variable. Pointer can be
casted to any other types of pointers.
6, how do you debug a box which has no debugger installed? i.e. you suspect
a process is hanging, but no debugger, how to tell what goes wrong?
The key point is collecting the threads's stack info. Remote debugging and
core dump analysis are both okay. The exact steps might be as below:
First, we should talk to the box using tools such like ssh, telnet, serial
port usb and etc.
Second, after the connection is established, we should indentify whether it'
s a dead lock or endless loop by checking the CPU usage. And then, we should
identify whether the hang is in user-space or kernel-space. If it's in
kernel space, the process can not be killed, so we can try to kill the
process. But before kill it, we must ensure the killing would not impact the
business and most importantly, we must get the core file(on linux, we can
use gcore; on windows, we can use tool like windbg...). After user-mode core
file are collected, we can try to kill the process. If it's cannot be
killed, the problem must be in kernel. At this stage, we need remote
debugging or collect the kernel core dump: on linux, we can use 'echo *'(I
forget the exact command) to mannual trigger; on windows, we can use a
customized kernel module to trigger it.
Third, if we have a core file(no matter where it is), list all the threads'
stack.
1) for endless loop, check the running time and start time and stack infor.
2) for dead lock, check every thread where it is stuck.