ICode9

精准搜索请尝试: 精确搜索
首页 > 编程语言> 文章详细

C++ 函数没写返回语句导致 munmap_chunk(): invalid pointer

2020-12-31 12:32:18  阅读:314  来源: 互联网

标签:case git vi chunk vlog C++ test suite pointer


vi@vi-Inspiron-7472:~/git/fip/src/build/bin$ ./test_vbase -t suite_vlog/case_info

C()

~C()

D()

~D()

Running 1 test case...

munmap_chunk(): invalid pointer

unknown location(0): fatal error: in "suite_vlog/case_info": signal: SIGABRT (application abort requested)

/home/vi/git/fip/src/test/test_vbase/suite_vlog.cpp(29): last checkpoint: "case_info" test entry

 

*** 1 failure is detected in the test module "test balance_mgr protocol_:wbuffer"

~D()

~C()

vi@vi-Inspiron-7472:~/git/fip/src/build/bin$ gdb ./test_vbase 

GNU gdb (Ubuntu 8.1-0ubuntu3) 8.1.0.20180409-git

Copyright (C) 2018 Free Software Foundation, Inc.

License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law.  Type "show copying"

and "show warranty" for details.

This GDB was configured as "x86_64-linux-gnu".

Type "show configuration" for configuration details.

For bug reporting instructions, please see:

<http://www.gnu.org/software/gdb/bugs/>.

Find the GDB manual and other documentation resources online at:

<http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".

Type "apropos word" to search for commands related to "word"...

Reading symbols from ./test_vbase...done.

(gdb) r  -t suite_vlog/case_info

Starting program: /home/vi/git/fip/src/build/bin/test_vbase -t suite_vlog/case_info

[Thread debugging using libthread_db enabled]

Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

C()

~C()

D()

~D()

Running 1 test case...

munmap_chunk(): invalid pointer

 

Program received signal SIGABRT, Aborted.

__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51

51 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.

(gdb) bt

#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51

#1  0x00007ffff6ab48b1 in __GI_abort () at abort.c:79

#2  0x00007ffff6afd907 in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7ffff6c2adfa "%s\n") at ../sysdeps/posix/libc_fatal.c:181

#3  0x00007ffff6b0497a in malloc_printerr (str=str@entry=0x7ffff6c2ca08 "munmap_chunk(): invalid pointer") at malloc.c:5350

#4  0x00007ffff6b0bf3c in munmap_chunk (p=0x7fffffffcda0) at malloc.c:2846

#5  __GI___libc_free (mem=0x7fffffffcdb0) at malloc.c:3117

#6  0x000055555574c651 in suite_vlog::case_info::test_method (this=0x7fffffffccfe) at /home/vi/git/fip/src/test/test_vbase/suite_vlog.cpp:32

 

 

 

 

我们来看一下源代码是什么原因导致的:


std::string vlog::information()
{
bool is_multiple_th = true;
#if _VLOG_SUPPORT_THREAD_
is_multiple_th=true;
#else //#if _VLOG_SUPPORT_THREAD_
is_multiple_th=false;
#endif //end of #if _VLOG_SUPPORT_THREAD_

//std::cout<<get_level_str(_user_want_level);
//std::cout<<_map_tid_logstr.size();
//_oss.clear(); _oss.str("");
//std::cout<<"user setting log_level:"<<get_level_str(_user_want_level)<<","
// <<"multiple thread mode:"<<is_multiple_th<<","
// <<"map_logstr size:"<<_map_tid_logstr.size()<<std::endl;

}

本以为是多线程的问题,看了半天发现是函数没写返回语句。

 

标签:case,git,vi,chunk,vlog,C++,test,suite,pointer
来源: https://www.cnblogs.com/colin-vio/p/14215878.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有