ketor / baiduhook Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/baiduhook
Automatically exported from code.google.com/p/baiduhook
$ valgrind --leak-check=full ./test_class
[/home/google/bhook-1.0.0/test/unittest/class][16:47:01]
==17210== Memcheck, a memory error detector
==17210== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==17210== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==17210== Command: ./test_class
==17210==
[==========] Running 2 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 2 tests from Person
[ RUN ] Person.PublicSay
[=HOOK=] this is no PublicSay!
test_class.cpp:53: Failure
Value of: ret
Actual: -1
Expected: 0
[ FAILED ] Person.PublicSay (66 ms)
[ RUN ] Person.PrivateSay
[=HOOK=] this is no PrivateSay!
test_class.cpp:67: Failure
Value of: ret
Actual: -2
Expected: 0
[ FAILED ] Person.PrivateSay (15 ms)
[----------] 2 tests from Person (93 ms total)
[----------] Global test environment tear-down
[==========] 2 tests from 1 test case ran. (137 ms total)
[ PASSED ] 0 tests.
[ FAILED ] 2 tests, listed below:
[ FAILED ] Person.PublicSay
[ FAILED ] Person.PrivateSay
2 FAILED TESTS
end test.....
==17210== Invalid read of size 8
==17210== at 0x588B758: std::vector<testing::internal::String,
std::allocator<testing::internal::String> >::~vector() (stl_construct.h:103)
==17210== by 0x6537E3E: __cxa_finalize (cxa_finalize.c:55)
==17210== by 0x5ABA752: ??? (in /usr/lib/libgtestmain.so.0.0.0)
==17210== by 0x400EFEE: _dl_fini (dl-fini.c:253)
==17210== by 0x6537AA0: __run_exit_handlers (exit.c:77)
==17210== by 0x6537B24: exit (exit.c:99)
==17210== by 0x651F99B: (below main) (libc-start.c:294)
==17210== Address 0x7799b80 is 0 bytes inside a block of size 16 free'd
==17210== at 0x4C2A64C: operator delete(void*) (vg_replace_malloc.c:480)
==17210== by 0x6537E3E: __cxa_finalize (cxa_finalize.c:55)
==17210== by 0x5876612: ??? (in /usr/lib/libgtest.so.0.0.0)
==17210== by 0x400EFEE: _dl_fini (dl-fini.c:253)
==17210== by 0x6537AA0: __run_exit_handlers (exit.c:77)
==17210== by 0x6537B24: exit (exit.c:99)
==17210== by 0x651F99B: (below main) (libc-start.c:294)
==17210==
==17210== Invalid free() / delete / delete[] / realloc()
==17210== at 0x4C2A0CC: operator delete[](void*) (vg_replace_malloc.c:515)
==17210== by 0x588B764: std::vector<testing::internal::String,
std::allocator<testing::internal::String> >::~vector() (gtest-string.h:218)
==17210== by 0x6537E3E: __cxa_finalize (cxa_finalize.c:55)
==17210== by 0x5ABA752: ??? (in /usr/lib/libgtestmain.so.0.0.0)
==17210== by 0x400EFEE: _dl_fini (dl-fini.c:253)
==17210== by 0x6537AA0: __run_exit_handlers (exit.c:77)
==17210== by 0x6537B24: exit (exit.c:99)
==17210== by 0x651F99B: (below main) (libc-start.c:294)
==17210== Address 0x7799bd0 is 0 bytes inside a block of size 13 free'd
==17210== at 0x4C2A0CC: operator delete[](void*) (vg_replace_malloc.c:515)
==17210== by 0x588B764: std::vector<testing::internal::String,
std::allocator<testing::internal::String> >::~vector() (gtest-string.h:218)
==17210== by 0x6537E3E: __cxa_finalize (cxa_finalize.c:55)
==17210== by 0x5876612: ??? (in /usr/lib/libgtest.so.0.0.0)
==17210== by 0x400EFEE: _dl_fini (dl-fini.c:253)
==17210== by 0x6537AA0: __run_exit_handlers (exit.c:77)
==17210== by 0x6537B24: exit (exit.c:99)
==17210== by 0x651F99B: (below main) (libc-start.c:294)
==17210==
==17210== Invalid free() / delete / delete[] / realloc()
==17210== at 0x4C29C64: calloc (vg_replace_malloc.c:593)
==17210== by 0x4010F29: allocate_dtv (dl-tls.c:296)
==17210== by 0x401163D: _dl_allocate_tls (dl-tls.c:460)
==17210== by 0x564B5B8: pthread_create@@GLIBC_2.2.5 (allocatestack.c:579)
==17210== by 0x4094A8: Message::Init(int (*)(FaultUnit const&, char*, int))
(Message.cpp:43)
==17210== by 0x4047A3: Core::Init() (Core.cpp:34)
==17210== by 0x404889: Core::getInstance() (Core.cpp:81)
==17210== by 0x403FE0: attach_func_lib(char*, void*) (bhook.cpp:74)
==17210== by 0x40306C: main (test_class.cpp:77)
==17210==
==17210== 2,857 bytes in 1 blocks are definitely lost in loss record 189 of 190
==17210== at 0x4C2BE2B: malloc (vg_replace_malloc.c:270)
==17210== by 0x409A83: ELFManager::elf_canonicalize_symbol(elf_symbol**,
unsigned int) (ELFManager.cpp:59)
==17210== by 0x406623: BinaryFile::InitRelsym(std::map<std::string,
BinaryFile::RelSym, std::less<std::string>,
std::allocator<std::pair<std::string const, BinaryFile::RelSym> > >&)
(BinaryFile.cpp:242)
==17210== by 0x406E3D: BinaryFile::Init(char*) (BinaryFile.cpp:61)
==17210== by 0x404105: HookManager::Init() (HookManager.cpp:48)
==17210== by 0x404779: Core::Init() (Core.cpp:27)
==17210== by 0x404889: Core::getInstance() (Core.cpp:81)
==17210== by 0x403FE0: attach_func_lib(char*, void*) (bhook.cpp:74)
==17210== by 0x40306C: main (test_class.cpp:77)
==17210==
==17210== 14,549 bytes in 1 blocks are definitely lost in loss record 190 of 190
==17210== at 0x4C2BE2B: malloc (vg_replace_malloc.c:270)
==17210== by 0x409A83: ELFManager::elf_canonicalize_symbol(elf_symbol**,
unsigned int) (ELFManager.cpp:59)
==17210== by 0x405B20: BinaryFile::InitSymbols(std::map<std::string,
BinaryFile::Symbol, std::less<std::string>,
std::allocator<std::pair<std::string const, BinaryFile::Symbol> > >&, int)
(BinaryFile.cpp:146)
==17210== by 0x406E2D: BinaryFile::Init(char*) (BinaryFile.cpp:56)
==17210== by 0x404105: HookManager::Init() (HookManager.cpp:48)
==17210== by 0x404779: Core::Init() (Core.cpp:27)
==17210== by 0x404889: Core::getInstance() (Core.cpp:81)
==17210== by 0x403FE0: attach_func_lib(char*, void*) (bhook.cpp:74)
==17210== by 0x40306C: main (test_class.cpp:77)
==17210==
==17210== LEAK SUMMARY:
==17210== definitely lost: 17,509 bytes in 10 blocks
==17210== indirectly lost: 0 bytes in 0 blocks
==17210== possibly lost: 437 bytes in 4 blocks
==17210== still reachable: 6,888 bytes in 176 blocks
==17210== suppressed: 0 bytes in 0 blocks
==17210== Reachable blocks (those to which a pointer was found) are not shown.
==17210== To see them, rerun with: --leak-check=full --show-reachable=yes
==17210==
==17210== For counts of detected and suppressed errors, rerun with: -v
==17210== ERROR SUMMARY: 24 errors from 18 contexts (suppressed: 2 from 2)
Original issue reported on code.google.com by [email protected]
on 23 Jul 2013 at 9:06
基于 gcc4.8, gtest1.6测试会产生core
$ ./test_attach
[/home/google/bhook-1.0.0/test/unittest/simple]
[==========] Running 2 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 2 tests from MyLib
[ RUN ] MyLib.case1
test_attach.cpp:26: Failure
Value of: ret
Actual: -1
Expected: 1
[ FAILED ] MyLib.case1 (10 ms)
[ RUN ] MyLib.case2
[mylib.cpp][16] str:cmd2
[ OK ] MyLib.case2 (0 ms)
[----------] 2 tests from MyLib (10 ms total)
[----------] Global test environment tear-down
[==========] 2 tests from 1 test case ran. (10 ms total)
[ PASSED ] 1 test.
[ FAILED ] 1 test, listed below:
[ FAILED ] MyLib.case1
1 FAILED TEST
[1] 16010 segmentation fault (core dumped) ./test_attach
Original issue reported on code.google.com by [email protected]
on 23 Jul 2013 at 7:53
attach_func ret:-1
# ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for g++... g++
checking for C++ compiler default output file name... a.out
checking whether the C++ compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of g++... gcc3
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking dependency style of gcc... gcc3
checking for ranlib... ranlib
checking for pthread_create in -lpthread... yes
checking for bfd_demangle in -lbfd... no
checking how to run the C preprocessor... gcc -E
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking malloc.h usability... yes
checking malloc.h presence... yes
checking for malloc.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for unistd.h... (cached) yes
checking dis-asm.h usability... no
checking dis-asm.h presence... no
checking for dis-asm.h... no
configure: error: missing dis-asm.h
See `config.log' for more details.
Hi 不好意思打扰,
我想问下configure时报这个错误是啥原因?。。这个dis-asm.h可��
�从哪里获得?。。
非常感谢!
Original issue reported on code.google.com by [email protected]
on 20 Sep 2012 at 9:18
int HookImpl::AttachFuncLib(const BinaryFile::Symbol &symbol, void *hook_func,
void **pold_func)
Line 42malloc的内存,如果在Line 48 56
61条件判断失败跳转的话,都可能产生内存泄漏
Original issue reported on code.google.com by [email protected]
on 29 Sep 2013 at 6:26
I make on gcc 4.8.5 :
there is errors:
if g++ -DHAVE_CONFIG_H -I. -I. -I./build-aux -I./include -fPIC -MT AsmHelper.o -MD -MP -MF ".deps/AsmHelper.Tpo" -c -o AsmHelper.o test -f 'src/AsmHelper.cpp' || echo './'
src/AsmHelper.cpp;
then mv -f ".deps/AsmHelper.Tpo" ".deps/AsmHelper.Po"; else rm -f ".deps/AsmHelper.Tpo"; exit 1; fi
In file included from ./include/AsmHelper.h:15:0,
from src/AsmHelper.cpp:8:
/usr/local/include/bfd.h:35:2: error: #error config.h must be included before this header
#error config.h must be included before this header
^
make[1]: *** [AsmHelper.o] Error 1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.