glibc - Linux

By Mason
at 2012-04-05T21:41
at 2012-04-05T21:41
Table of Contents
我自己寫的包含自訂class的c++程式,test_file
執行到new該class時,會發生memory error
Error msg如下:
*** glibc detected *** ~/test_dir/test_file: malloc(): memory corruption:
0x08657678 ***
======= Backtrace: =========
[0x80f75ae]
[0x80f98d3]
[0x80faf62]
[0x80c5847]
[0x8048a8a]
[0x80dcad8]
[0x8048151]
======= Memory map: ========
08048000-0817f000 r-xp 00000000 00:15 23693231 ~/test_dir/test_file
0817f000-08181000 rw-p 00137000 00:15 23693231 ~/test_dir/test_file
08181000-08674000 rw-p 08181000 00:00 0 [heap]
b7d00000-b7d24000 rw-p b7d00000 00:00 0
b7d24000-b7e00000 ---p b7d24000 00:00 0
b7e96000-b7f97000 rw-p b7e96000 00:00 0
bfd90000-bfda5000 rw-p bffeb000 00:00 0 [stack]
ffffe000-fffff000 r-xp 00000000 00:00 0 [vdso]
已經終止
-------
我的情況是
class myclass{
myclass(char *filename){ initialize(filename); }
void initialize(char *filename){
cerr << "error!" << endl; // 這行也出不來
...
}
};
...
int main(){
myclass *a;
a = new myclass(fn); => 顯然是在這行就出錯了
}
非常詭異的是,同樣的檔案,改成不同檔名就能吃
WHY?
--
執行到new該class時,會發生memory error
Error msg如下:
*** glibc detected *** ~/test_dir/test_file: malloc(): memory corruption:
0x08657678 ***
======= Backtrace: =========
[0x80f75ae]
[0x80f98d3]
[0x80faf62]
[0x80c5847]
[0x8048a8a]
[0x80dcad8]
[0x8048151]
======= Memory map: ========
08048000-0817f000 r-xp 00000000 00:15 23693231 ~/test_dir/test_file
0817f000-08181000 rw-p 00137000 00:15 23693231 ~/test_dir/test_file
08181000-08674000 rw-p 08181000 00:00 0 [heap]
b7d00000-b7d24000 rw-p b7d00000 00:00 0
b7d24000-b7e00000 ---p b7d24000 00:00 0
b7e96000-b7f97000 rw-p b7e96000 00:00 0
bfd90000-bfda5000 rw-p bffeb000 00:00 0 [stack]
ffffe000-fffff000 r-xp 00000000 00:00 0 [vdso]
已經終止
-------
我的情況是
class myclass{
myclass(char *filename){ initialize(filename); }
void initialize(char *filename){
cerr << "error!" << endl; // 這行也出不來
...
}
};
...
int main(){
myclass *a;
a = new myclass(fn); => 顯然是在這行就出錯了
}
非常詭異的是,同樣的檔案,改成不同檔名就能吃
WHY?
--
Tags:
Linux
All Comments

By Todd Johnson
at 2012-04-08T05:14
at 2012-04-08T05:14

By Andy
at 2012-04-12T10:30
at 2012-04-12T10:30

By Emma
at 2012-04-12T13:38
at 2012-04-12T13:38

By Edward Lewis
at 2012-04-14T02:38
at 2012-04-14T02:38

By Edward Lewis
at 2012-04-15T17:30
at 2012-04-15T17:30
Related Posts
關於光碟中的autorun.sh

By Bethany
at 2012-04-05T18:12
at 2012-04-05T18:12
UBUNTU 11.10安裝到一半停住

By Bennie
at 2012-04-05T15:08
at 2012-04-05T15:08
Ubuntu 12.04 無法自動掛載磁區與光碟

By Yedda
at 2012-04-05T14:05
at 2012-04-05T14:05
基於Kubuntu的Distro

By Carol
at 2012-04-04T20:41
at 2012-04-04T20:41
將輸出的聲音直接讓麥克風接收

By Emma
at 2012-04-03T01:41
at 2012-04-03T01:41