Created
December 8, 2012 12:40
-
-
Save hpcx82/4240126 to your computer and use it in GitHub Desktop.
Revisions
-
hpcx82 revised this gist
Dec 8, 2012 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -29,13 +29,13 @@ class VTableTest int main() { cout << ".data: " << &rwdata << endl; cout << ".rodata: " << reinterpret_cast<const void*>(rodata) << endl; cout << ".bss: " << &bssdata << endl; cout << ".text-normal-function: " << reinterpret_cast<void*>(text_code) << endl; VTableTest* pV = new VTableTest(); long* pVlong = reinterpret_cast<long*>(pV); void* vptr = reinterpret_cast<void*>(*pVlong); cout << ".rodata-vtable: " << vptr << endl; } -
hpcx82 created this gist
Dec 8, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,41 @@ #include <iostream> using namespace std; // .data - read-write data int rwdata = 100; // .rodata - read-only data const char* rodata = "hello, world"; // .bss - non-initialized data int bssdata; // .text void text_code() { cout << "text_code" << endl; } class VTableTest { public: virtual void virtualfunc() { cout << "virtualfunc" << endl; } }; int main() { cout << ".data: " << &rwdata << endl; cout << ".rodata: " << &rodata << endl; cout << ".bss: " << &bssdata << endl; cout << ".text-normal-function: " << reinterpret_cast<void*>(text_code) << endl; VTableTest* pV = new VTableTest(); long* pVlong = reinterpret_cast<long*>(pV); void* vptr = reinterpret_cast<void*>(*pVlong); cout << ".text-vtable: " << vptr << endl; }