Tag: 跟踪

这种mlockall的用法是否正确?

下面的程序XORs 2文件使用一次填充加密创建输出文件。 我试图使用mlockall ,以避免从外部内存源获取密钥文件时硬盘上留下任何密钥文件的痕迹。 从mlockall手册页: mlock() and mlockall() respectively lock part or all of the calling process’s virtual address space into RAM, preventing that memory from being paged to the swap area. 我如何检查它是否正常工作并且我正确使用了mlockall ? #include #include #include #include int main(int argc, char **argv) { struct stat statbuf; struct stat keybuf; char buffer [20]; int key; […]

getpeername总是给出错误的文件描述符

我有以下代码,我试图用来获取套接字另一端的地址,但getpeername()总是失败, bad file descriptor错误。 我究竟做错了什么? #include #include #include #include #include #include #include #include #include #include #include #include #include /* For SYS_write etc */ #include #define ORIG_RAX 15 #define SYSCALL_MAXARGS 6 #define RDI 14 int main() { //**********declarations and memory allocations**********// ssize_t size; long sys_call_number, temp_long; int status, temp, i, j, k, flag; struct sockaddr_in ip_addr_struct; […]

是否可以直接从本机代码记录Android systrace事件,而不使用JNI?

Android systrace日志记录系统非常棒,但它只能在代码的Java部分工作,通过Trace.beginSection()和Trace.endSection() 。 在代码的C / C ++ NDK(本机)部分中,它只能通过JNI使用,JNI在没有Java环境的线程中很慢或不可用… 是否有任何方法可以将事件添加到主systrace跟踪缓冲区,甚至从本机C代码生成单独的日志? 这个较老的问题提到atrace / ftrace是Android的systrace使用的内部系统。 这可以(轻松)进入吗? BONUS TWIST:由于跟踪调用通常位于性能关键部分,理想情况下应该可以在实际事件时间之后运行调用。 即我一个人宁愿能够指定记录的时间,而不是自己轮询的呼叫。 但那只会锦上添花。

如何在C中跟踪函数调用?

在不修改源代码的情况下,如何调用调用哪些函数以及使用什么参数调用某些函数(例如下例中的func100)。 我想输出如下: enter func100(p1001=xxx,p1002=xxx) enter func110(p1101=xxx,p1102=xxx) exit func110(p1101=xxx,p1102=xxx) enter func120(p1201=xxx,p1202=xxx,p1203=xxx) enter func121(p1211=xxx) exit func121(p1211=xxx) exit func120(p1201=xxx,p1202=xxx,p1203=xxx) exit func100(p1001=xxx,p1002=xxx) 这可行吗? 或者最少修改源代码的解决方案是什么?