免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12
最近访问板块 发新帖
楼主: jd808
打印 上一主题 下一主题

[C++] gdb获取到的错误,帮忙看下 [复制链接]

论坛徽章:
7
天秤座
日期:2014-08-07 13:56:30丑牛
日期:2014-08-27 20:34:21双鱼座
日期:2014-08-27 22:02:21天秤座
日期:2014-08-30 10:39:11双鱼座
日期:2014-09-21 20:07:532015年亚洲杯之日本
日期:2015-02-06 14:00:282015亚冠之大阪钢巴
日期:2015-11-02 14:50:19
11 [报告]
发表于 2016-04-22 13:43 |只看该作者
看调用栈
0x00007ffd84d48b5c in malloc_printerr (ptr=0x1102530, str=0x7ffd84e4607e "malloc(): memory corruption", action=<optimized out>)
是不是有malloc(): memory corruption这个错误。
我也用libevent没出现过这个异常,用valgrind跑下看看是不是哪里分配有问题了。

论坛徽章:
1
2015年辞旧岁徽章
日期:2015-03-03 16:54:15
12 [报告]
发表于 2016-04-22 14:30 |只看该作者
本帖最后由 jd808 于 2016-04-22 14:31 编辑

回复 11# MeRcy_PM
  1. valgrind --tool=memcheck --leak-check=yes --show-reachable=yes ./Xgateway
  2. ==16111== Memcheck, a memory error detector
  3. ==16111== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
  4. ==16111== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
  5. ==16111== Command: ./Xgateway
  6. ==16111==
  7. --16111-- WARNING: Serious error when reading debug info
  8. --16111-- When reading debug info from /lib/x86_64-linux-gnu/ld-2.22.so:
  9. --16111-- Ignoring non-Dwarf2/3/4 block in .debug_info
  10. --16111-- WARNING: Serious error when reading debug info
  11. --16111-- When reading debug info from /lib/x86_64-linux-gnu/ld-2.22.so:
  12. --16111-- Last block truncated in .debug_info; ignoring
  13. --16111-- WARNING: Serious error when reading debug info
  14. --16111-- When reading debug info from /lib/x86_64-linux-gnu/ld-2.22.so:
  15. --16111-- parse_CU_Header: is neither DWARF2 nor DWARF3 nor DWARF4
  16. --16111-- WARNING: Serious error when reading debug info
  17. --16111-- When reading debug info from /lib/x86_64-linux-gnu/libm-2.22.so:
  18. --16111-- Ignoring non-Dwarf2/3/4 block in .debug_info
  19. --16111-- WARNING: Serious error when reading debug info
  20. --16111-- When reading debug info from /lib/x86_64-linux-gnu/libm-2.22.so:
  21. --16111-- Last block truncated in .debug_info; ignoring
  22. --16111-- WARNING: Serious error when reading debug info
  23. --16111-- When reading debug info from /lib/x86_64-linux-gnu/libm-2.22.so:
  24. --16111-- parse_CU_Header: is neither DWARF2 nor DWARF3 nor DWARF4
  25. --16111-- WARNING: Serious error when reading debug info
  26. --16111-- When reading debug info from /lib/x86_64-linux-gnu/libc-2.22.so:
  27. --16111-- Ignoring non-Dwarf2/3/4 block in .debug_info
  28. --16111-- WARNING: Serious error when reading debug info
  29. --16111-- When reading debug info from /lib/x86_64-linux-gnu/libc-2.22.so:
  30. --16111-- Ignoring non-Dwarf2/3/4 block in .debug_info
  31. --16111-- WARNING: Serious error when reading debug info
  32. --16111-- When reading debug info from /lib/x86_64-linux-gnu/libc-2.22.so:
  33. --16111-- Ignoring non-Dwarf2/3/4 block in .debug_info
  34. --16111-- WARNING: Serious error when reading debug info
  35. --16111-- When reading debug info from /lib/x86_64-linux-gnu/libc-2.22.so:
  36. --16111-- Last block truncated in .debug_info; ignoring
  37. --16111-- WARNING: Serious error when reading debug info
  38. --16111-- When reading debug info from /lib/x86_64-linux-gnu/libc-2.22.so:
  39. --16111-- parse_CU_Header: is neither DWARF2 nor DWARF3 nor DWARF4
  40. ==16111== Syscall param write(buf) points to uninitialised byte(s)
  41. ==16111==    at 0x4E43F1D: ??? (syscall-template.S:84)
  42. ==16111==    by 0x41751C: TServer::ReadEvent(Conn*) (TServer.cpp:104)
  43. ==16111==    by 0x52B3DDD: bufferevent_trigger_nolock_ (bufferevent-internal.h:366)
  44. ==16111==    by 0x52B3DDD: bufferevent_readcb (bufferevent_sock.c:187)
  45. ==16111==    by 0x52B9419: event_persist_closure (event.c:1531)
  46. ==16111==    by 0x52B9419: event_process_active_single_queue (event.c:1590)
  47. ==16111==    by 0x52B9E8E: event_process_active (event.c:1689)
  48. ==16111==    by 0x52B9E8E: event_base_loop (event.c:1912)
  49. ==16111==    by 0x416880: MultiServer::StartRun() (MultiServer.cpp:366)
  50. ==16111==    by 0x420BD0: TControl::Run() (TControl.cpp:21)
  51. ==16111==    by 0x406EDF: main (node_gateway.cpp:64)
  52. ==16111==  Address 0xffeffe990 is on thread 1's stack
  53. ==16111==  in frame #1, created by TServer::ReadEvent(Conn*) (TServer.cpp:87)
  54. ==16111==
  55. ==16111== Thread 5:
  56. ==16111== Mismatched free() / delete / delete []
  57. ==16111==    at 0x4C2A104: operator delete(void*) (vg_replace_malloc.c:575)
  58. ==16111==    by 0x417C04: TServer::ThreadProcess(void*) (TServer.cpp:181)
  59. ==16111==    by 0x415BBB: MultiServer::WorkerLibevent(void*) (MultiServer.cpp:398)
  60. ==16111==    by 0x4E3B453: start_thread (pthread_create.c:334)
  61. ==16111==    by 0x627FEDC: clone (in /lib/x86_64-linux-gnu/libc-2.22.so)
  62. ==16111==  Address 0x6836820 is 0 bytes inside a block of size 104 alloc'd
  63. ==16111==    at 0x4C2977D: operator new[](unsigned long) (vg_replace_malloc.c:422)
  64. ==16111==    by 0x4174CD: TServer::ReadEvent(Conn*) (TServer.cpp:100)
  65. ==16111==    by 0x52B3DDD: bufferevent_trigger_nolock_ (bufferevent-internal.h:366)
  66. ==16111==    by 0x52B3DDD: bufferevent_readcb (bufferevent_sock.c:187)
  67. ==16111==    by 0x52B9419: event_persist_closure (event.c:1531)
  68. ==16111==    by 0x52B9419: event_process_active_single_queue (event.c:1590)
  69. ==16111==    by 0x52B9E8E: event_process_active (event.c:1689)
  70. ==16111==    by 0x52B9E8E: event_base_loop (event.c:1912)
  71. ==16111==    by 0x416880: MultiServer::StartRun() (MultiServer.cpp:366)
  72. ==16111==    by 0x420BD0: TControl::Run() (TControl.cpp:21)
  73. ==16111==    by 0x406EDF: main (node_gateway.cpp:64)
  74. ==16111==
复制代码
一堆警告,这个现在还看不出问题,要运行很久才能指定结果....

论坛徽章:
7
天秤座
日期:2014-08-07 13:56:30丑牛
日期:2014-08-27 20:34:21双鱼座
日期:2014-08-27 22:02:21天秤座
日期:2014-08-30 10:39:11双鱼座
日期:2014-09-21 20:07:532015年亚洲杯之日本
日期:2015-02-06 14:00:282015亚冠之大阪钢巴
日期:2015-11-02 14:50:19
13 [报告]
发表于 2016-04-22 15:55 |只看该作者
回复 12# jd808

Mismatched free() / delete / delete []
看看这里有问题没。。
   

论坛徽章:
1
2015年辞旧岁徽章
日期:2015-03-03 16:54:15
14 [报告]
发表于 2016-04-22 16:19 |只看该作者
本帖最后由 jd808 于 2016-04-22 17:35 编辑

回复 13# MeRcy_PM
是指的
==16111==    by 0x417C04: TServer::ThreadProcess(void*) (TServer.cpp:181)这行吗?
  1. //删除掉主线程的缓存
  2.                 if(s_info->data_buf!=NULL){
  3.                         delete s_info->data_buf;
  4.                         s_info->data_buf=NULL;
  5.                         s_info->data_buf_len=0;
  6.                 }
复制代码
这行delete s_info->data_buf;改成delete[] s_info->data_buf;就没报这个错误了。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP