我使用的是Linux平台(3.12.13& 2.6.35.3),& imx5x系列处理器。 在我的程序中,我使用两个串行端口进行读写操作/ dev / ttymxc2& / dev / ttymxc1。经过一段时间后,/ dev / tty打开系统调用执行,这不是我程序的一部分&错误打开(" / dev / tty",...)writev(7,[{" * glibc检测到* ",23}。
请建议一些解决方案,我在代码中未使用的端口仍然执行系统调用以打开/ dev / tty /。
这些是一些strace日志。
open("/dev/ttymxc2", O_RDWR|O_NOCTTY|O_NONBLOCK) = 4
nanosleep({0, 200000000}, NULL) = 0
ioctl(4, TCFLSH, 0x2) = 0
ioctl(4, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B9600 opost -isig -icanon -echo ...}) = 0
ioctl(4, SNDCTL_TMR_START or SNDRV_TIMER_IOCTL_TREAD or TCSETS, {B9600 opost -isig -icanon -echo ...}) = 0
open("/dev/ttymxc0", O_RDWR|O_NONBLOCK) = 5
ioctl(5, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B115200 opost -isig -icanon -echo ...}) = 0
ioctl(5, SNDCTL_TMR_START or SNDRV_TIMER_IOCTL_TREAD or TCSETS, {B115200 opost -isig -icanon -echo ...}) = 0
open("/dev/ttymxc1", O_RDWR|O_NOCTTY|O_NONBLOCK) = 6
nanosleep({0, 200000000}, NULL) = 0
ioctl(6, TCFLSH, 0x2) = 0
ioctl(6, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B9600 opost -isig -icanon -echo ...}) = 0
ioctl(6, SNDCTL_TMR_START or SNDRV_TIMER_IOCTL_TREAD or TCSETS, {B9600 opost -isig -icanon -echo ...}) = 0
fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x76f2d000
write(1, "in main \n", 9) = 9
write(1, " Leaving process fun \n", 22) = 22
sigreturn() (mask []) = 71
write(1, "bab0 bab0\n", 11) = 11
open("/dev/tty", O_RDWR|O_NOCTTY|O_NONBLOCK) = 7
writev(7, [{"*** glibc detected *** ", 23}, {"./test11_2", 10}, {": ", 2}, {"double free or corruption (!prev"..., 33}, {": 0x", 4}, {"00bfa0c0", 8}, {" ***\n", 5}], 7) = 85
mmap2(NULL, 2097152, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x76d2d000
munmap(0x76d2d000, 864256) = 0
munmap(0x76f00000, 184320) = 0
mprotect(0x76e00000, 135168, PROT_READ|PROT_WRITE) = 0
rt_sigprocmask(SIG_UNBLOCK, [ABRT], NULL, 8) = 0
write(1, "final out", 9) = 9
gettid() = 8796
tgkill(8796, 8796, SIGABRT) = 0
--- SIGABRT {si_signo=SIGABRT, si_code=SI_TKILL, si_pid=8796, si_uid=0} ---
+++ killed by SIGABRT +++
答案 0 :(得分:0)
请提出一些解决方案
您需要修复glibc为您发现的堆损坏错误。
这样做的一种方法是在Valgrind下运行您的程序,但我不相信它可用于imx5x
。
另一种方法是使用export MALLOC_CHECK_=2
运行程序。请参阅documentation。
另一种方法是使用AddressSanitizer(如果你的工具链支持它)。