strace

infuriating heisenbug in Java/WAS 8.5 liberty profile on socket binding

余生长醉 提交于 2019-12-24 04:53:11
问题 I get socket bind error on Java 6/Websphere 8.5 (Liberty profile, a cut down, usable version of Websphere). When killing and starting app server immediately again I get: [ERROR ] CWWKO0221E: TCP Channel defaultHttpEndpoint initialization did not succeed. The socket bind did not succeed for host * and port 9988. The port might already be in use. This is because either Java or WAS have not released IPv6 sockets properly. But, here's the snag: when I run WLP via strace (with -f option to track

How to debug with strace -i when everytime address is different

可紊 提交于 2019-12-24 03:16:14
问题 [b77d0424] open("etc/shadow",0_RDONLY) = -1 EACCESS (Permission denied) every time i run [b77d0424] changed to another address i can not use gdb b *0xb77d0424 and then c to find lib64/libc.so.6 it seems not the same mentioned in a linux programming book after running ubuntu 13.04 in virtual box 回答1: every time i run [b77d0424] changed to another address This is happening because of address space layout randomization, which you can disable with setarch -R command. GDB also disables address

Android strace in Real device

半世苍凉 提交于 2019-12-24 01:07:55
问题 I have the following situation, I want to monitor the system calls on Android phones so I made an script to do that. With Android Emulator works perfectly (writes the traces of the application in a specific file on my Ubuntu). The problem is when I attach a real phone to analyze it, it says the following in the result file: ptrace attach failed: Operation not permitted I'm using this code to get it, but I don't understand why it works on the emulator and not in the rooted real device. This is

Extracting system call name and arguments using ptrace

眉间皱痕 提交于 2019-12-24 00:10:03
问题 I am working on an assignment in which i have to implement strace like functionality using ptrace . So far, I have found out how to extract system call number and return value like this: //In parent process struct user_regs_struct regs; ptrace( PTRACE_GETREGS, child_pid, 0, &regs ); //child_pid is the pid of child process executing the required program //or system call passed as command line arguments syscall_num = regs.orig_rax; syscall_retval = regs.rax; But I haven't been able to find how

Linux系统函数学习

旧城冷巷雨未停 提交于 2019-12-23 00:40:49
背景 为什么突然想要学习linux系统函数呢,日常工作有没用到,那当时是准备晋升高工和跳槽了,正所谓 面试造火箭,工作拧螺丝。工作中螺丝拧久了,就忘了怎么去提升了,毕竟每天就用那点东西,其他都不会想去了解。这里自己整理了一下使用strace命令查到的系统函数的使用,下次再写一篇关于strace命令使用方法 函数使用 void* mmap(void* start,size_t length,int prot,int flags,int fd,off_t offset); 一种内存映射的方法 如果使用 strace ls -lh /www/index.php 这条命令,实际是去追踪ls如何去计算一个文件的大小和获取它的其他信息,这里会看到很多调用 mmap()这个系统函数 本质是 mmap会把 需要打开处理的文件地址映射到进程的地址空间里,也就是内存中,这样进程在处理这个文件的时候,可以直接在内存中处理,然后系统会把内存中的这些处理再写入硬盘中的原始的文件里,也就是 脏页 的回写,这样会快很多。这里有几点注意 1、mmap映射的是一个物理页(物理页是指真实存在的物理磁盘的大小,虽然我们是整个文件保存在计算机中,但实际上计算机在磁盘也会给这个文件数据进行分页,也就是类似这个文件是一本书,虽然书的内容被整个记录了,但是还是会被分页,32位系统一个物理页是4k,64位是8k)

strace简单介绍

南楼画角 提交于 2019-12-22 05:22:39
1、strace是什么 strace是一个非常简单的工具,它可以跟踪系统调用的执行。最简单的方式,它可以从头到尾跟踪binary的执行,然后以一行文本输出系统调用的名字,参数和返回值。可用于诊断、调试和教学的Linux用户空间跟踪器。我们用它来监控用户空间进程和内核的交互,比如系统调用、信号传递、进程状态变更等。strace底层使用内核的ptrace特性来实现其功能。 2、怎么用 1)strace最简单的用法是执行一个指定的命令(过程中,starce会记录和解析命令进程的所有系统调用及这个进程的所有的信号值),在指定命令结束后立即退出 [root@VM_0_11_centos grub2]# strace cat /boot/grub2/grub.cfg execve("/usr/bin/cat", ["cat", "/boot/grub2/grub.cfg"], [/* 23 vars */]) = 0 brk(NULL) = 0x1741000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9eb4042000 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) open

How do you debug a LONG RUNNING php script?

大城市里の小女人 提交于 2019-12-20 05:43:31
问题 The problem is that the script hangs up after some long time. strace returns something like this and nothing else: Process 7286 attached - interrupt to quit restart_syscall(<... resuming interrupted call ...>) = 0 poll([{fd=13, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 0) = 0 (Timeout) clock_gettime(CLOCK_MONOTONIC, {1817569, 74651533}) = 0 clock_gettime(CLOCK_MONOTONIC, {1817569, 74734744}) = 0 clock_gettime(CLOCK_MONOTONIC, {1817569, 74812047}) = 0 poll([{fd=13, events=POLLIN

strace和ltrace的简单使用

ぃ、小莉子 提交于 2019-12-20 04:05:59
目录 前言 1,strace命令 2,ltrace命令 3,总结 4,参考 前言 strace用来跟踪进程的系统调用或信号产生的情况; ltrace 用来跟踪进程调用库函数的情况。 1,strace命令 root@ubuntu:/opt/files/release/strace/x86_64/bin # ./strace uname execve ( "/bin/uname" , [ "uname" ] , 0x7ffc0cd82290 /* 20 vars */ ) = 0 brk ( NULL ) = 0x1ed4000 access ( "/etc/ld.so.nohwcap" , F_OK ) = -1 ENOENT ( No such file or directory ) access ( "/etc/ld.so.preload" , R_OK ) = 0 open ( "/etc/ld.so.preload" , O_RDONLY | O_CLOEXEC ) = 3 fstat ( 3, { st_mode = S_IFREG | 0644, st_size = 1, .. . } ) = 0 mmap ( NULL, 1, PROT_READ | PROT_WRITE, MAP_PRIVATE, 3, 0 ) = 0x7f4fcdb37000 close ( 3 )

ltrace equivalent for osx?

狂风中的少年 提交于 2019-12-18 11:45:30
问题 osx has the really powerful dtrace/ktrace/dtruss tools - however i'm not willing to invest the time necessary to learn dealing with them right now. what's the easiest way to get the equivalent functionality of linux ltrace (and possibly strace) on OSX? 回答1: No answer for ltrace (except perhaps "work out how to use dtrace" :-) ), but for system call tracing ala strace, dtruss is a pretty good front end to dtrace. e.g. dtruss df -h # run and examine the "df -h" command dtruss -p 1871 # examine

How can I get dtrace to run the traced command with non-root priviledges?

▼魔方 西西 提交于 2019-12-18 10:14:23
问题 OS X lacks linux's strace , but it has dtrace which is supposed to be so much better. However, I miss the ability to do simple tracing on individual commands. For example, on linux I can write strace -f gcc hello.c to caputre all system calls, which gives me the list of all the filenames needed by the compiler to compile my program (the excellent memoize script is built upon this trick) I want to port memoize on the mac, so I need some kind of strace . What I actually need is the list of