语法高亮,滚动条美化,设置页面调整

This commit is contained in:
fofolee
2019-04-19 02:41:09 +08:00
parent 1e8f76c000
commit 359d29ee0b
1590 changed files with 12328 additions and 11441 deletions

View File

@@ -27,7 +27,7 @@
<li>链接相关:节头表相关信息。 </li>
</ul>
<h3 id="选项">选项</h3>
<pre><code>-a
<pre><code class="language-bash">-a
--all 显示全部信息,等价于 -h -l -S -s -r -d -V -A -I.
-h
@@ -98,7 +98,7 @@
<p>先给出如下例子:</p>
<p><strong>1.对于可执行文件形式的elf格式文件</strong></p>
<p>1)查看可执行程序的源代码如下: </p>
<pre><code>root@localhost [test]$ cat main.cpp
<pre><code class="language-bash">root@localhost [test]$ cat main.cpp
#include &lt;iostream&gt;
using std::cout;
using std::endl;
@@ -116,10 +116,10 @@ void my_print()
cout&lt;&lt;&quot;print!&quot;&lt;&lt;endl;
} </code></pre>
<p>2)编译如下: </p>
<pre><code>[root@localhost test]$ g++ main.cpp -o main
<pre><code class="language-bash">[root@localhost test]$ g++ main.cpp -o main
[root@localhost test]$ g++ -g main.cpp -o main.debug </code></pre>
<p>3)编译之后,查看生成的文件: </p>
<pre><code>[root@localhost test]$ ls -l
<pre><code class="language-bash">[root@localhost test]$ ls -l
总计 64
-rwxr-xr-x 1 quietheart quietheart 6700 07-07 18:04 main
-rw-r--r-- 1 quietheart quietheart 201 07-07 18:02 main.cpp
@@ -127,7 +127,7 @@ void my_print()
<p>这里main.debug是带有调试信息的可执行文件main是一般的可执行文件。 </p>
<p><strong>2.对于库文件形式的elf格式文件</strong></p>
<p>1)查看库的源代码如下: </p>
<pre><code>//myfile.h
<pre><code class="language-bash">//myfile.h
#ifndef __MYFILE_H
#define __MYFILE_H
void printInfo();
@@ -143,14 +143,14 @@ void printInfo()
cout&lt;&lt;&quot;hello&quot;&lt;&lt;endl;
} </code></pre>
<p>2)编译如下: </p>
<pre><code>[root@localhost test]$ g++ -c myfile.cpp
<pre><code class="language-bash">[root@localhost test]$ g++ -c myfile.cpp
[root@localhost test]$ g++ -shared -fPCI -o libmy.so myfile.o
[root@localhost test]$ ar -r libmy.a myfile.o
ar: creating libmy.a </code></pre>
<p>3)编译之后,查看生成的文件: </p>
<p>[root@localhost test]$ ls -l </p>
<p>总计 44 </p>
<pre><code>-rw-r--r-- 1 quietheart quietheart 2154 07-08 16:14 libmy.a
<pre><code class="language-bash">-rw-r--r-- 1 quietheart quietheart 2154 07-08 16:14 libmy.a
-rwxr-xr-x 1 quietheart quietheart 5707 07-08 16:08 libmy.so
-rwxr-xr-x 1 quietheart quietheart 117 07-08 16:06 myfile.cpp
-rwxr-xr-x 1 quietheart quietheart 63 07-08 16:08 myfile.h
@@ -159,7 +159,7 @@ libmy.a libmy.so myfile.cpp myfile.h myfile.o </code></pre>
<p>这里分别生成目标文件myfile.o共享库文件libmy.so和静态库文件libmy.a。 </p>
<p>基于以上可执行文件和库,这里给出一些常用的命令。 </p>
<p><strong>读取可执行文件形式的elf文件头信息</strong></p>
<pre><code>[root@localhost test]$ readelf -h main
<pre><code class="language-bash">[root@localhost test]$ readelf -h main
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
@@ -182,7 +182,7 @@ ELF Header:
Section header string table index: 26 </code></pre>
<p>这里可见可执行文件的elf文件其类型为EXEC(可执行文件)。另外含调试信息的“main.debug”和不含调试信息的“main”除了一些大小信息之外其内容是一样的。并且由此可见文件的体系结构为Intel 80386。 </p>
<p><strong>读取目标文件形式的elf文件头信息</strong></p>
<pre><code>[root@localhost test]$ readelf -h myfile.o
<pre><code class="language-bash">[root@localhost test]$ readelf -h myfile.o
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
@@ -205,7 +205,7 @@ ELF Header:
Section header string table index: 12 </code></pre>
<p>这里可见目标文件的elf文件其类型为REL(可重定位文件)。 </p>
<p><strong>读取静态库文件形式的elf文件头信息</strong></p>
<pre><code>[root@localhost test]$ readelf -h libmy.a
<pre><code class="language-bash">[root@localhost test]$ readelf -h libmy.a
File: libmy.a(myfile.o)
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
@@ -229,7 +229,7 @@ ELF Header:
Section header string table index: 12 </code></pre>
<p>这里可见静态库文件的elf文件其类型为REL(可重定位文件)。 </p>
<p><strong>读取动态库文件形式的elf文件头信息</strong></p>
<pre><code>[root@localhost test]$ readelf -h libmy.so
<pre><code class="language-bash">[root@localhost test]$ readelf -h libmy.so
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
@@ -252,7 +252,7 @@ ELF Header:
Section header string table index: 24 </code></pre>
<p>这里可见动态库文件的elf文件其类型为DYN(共享目标文件)。 </p>
<p><strong>查看可执行的elf文件程序头表信息</strong></p>
<pre><code>[root@localhost test]$ readelf -l main
<pre><code class="language-bash">[root@localhost test]$ readelf -l main
Elf file type is EXEC (Executable file)
Entry point 0x8048580
There are 8 program headers, starting at offset 52
@@ -281,16 +281,16 @@ Section to Segment mapping:
07 </code></pre>
<p>这里含调试信息的“main.debug”和不含调试信息的“main”其内容是一样的。 </p>
<p><strong>查看目标文件的elf文件程序头表信息 </strong></p>
<pre><code>[root@localhost test]$ readelf -l myfile.o
<pre><code class="language-bash">[root@localhost test]$ readelf -l myfile.o
There are no program headers in this file. </code></pre>
<p>这里可知,可重定位的目标文件,它没程序头表。 </p>
<p><strong>查看静态库文件的elf文件程序头表信息</strong></p>
<pre><code>[root@localhost test]$ readelf -l libmy.a
<pre><code class="language-bash">[root@localhost test]$ readelf -l libmy.a
File: libmy.a(myfile.o)
There are no program headers in this file. </code></pre>
<p>这里可知,可重定位的静态库文件,它没程序头表。 </p>
<p><strong>查看动态库文件的elf文件程序头表信息</strong></p>
<pre><code>[root@localhost test]$ readelf -l libmy.so
<pre><code class="language-bash">[root@localhost test]$ readelf -l libmy.so
Elf file type is DYN (Shared object file)
Entry point 0x550
There are 5 program headers, starting at offset 52
@@ -312,7 +312,7 @@ Section to Segment mapping:
04 </code></pre>
<p>这里可知,做为共享目标文件的动态库,它程序头表。 </p>
<p><strong>查看一个可执行的elf文件的节信息</strong></p>
<pre><code>[root@localhost test]$ readelf -S main
<pre><code class="language-bash">[root@localhost test]$ readelf -S main
There are 29 section headers, starting at offset 0xca0:
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
@@ -351,7 +351,7 @@ Key to Flags:
O (extra OS processing required) o (OS specific), p (processor specific) </code></pre>
<p>这里main是可执行文件不含调试信息。 </p>
<p><strong>查看一个包含调试信息的可执行的elf文件的节信息</strong></p>
<pre><code>[root@localhost test]$ readelf -S main.debug
<pre><code class="language-bash">[root@localhost test]$ readelf -S main.debug
There are 37 section headers, starting at offset 0x88c8:
Section Headers:
@@ -399,7 +399,7 @@ Key to Flags:
O (extra OS processing required) o (OS specific), p (processor specific) </code></pre>
<p>可见,相对非调试版本的可执行文件,多了&quot;.debug*&quot;段的信息。 </p>
<p><strong>查看一个目标文件的elf文件的节信息</strong></p>
<pre><code>[root@localhost test]$ readelf -S myfile.o
<pre><code class="language-bash">[root@localhost test]$ readelf -S myfile.o
There are 15 section headers, starting at offset 0x204:
Section Headers:
@@ -426,7 +426,7 @@ Key to Flags:
</code></pre>
<p><strong>查看一个静态库文件的elf文件的节信息</strong></p>
<pre><code>[root@localhost test]$ readelf -S libmy.a
<pre><code class="language-bash">[root@localhost test]$ readelf -S libmy.a
File: libmy.a(myfile.o)
There are 15 section headers, starting at offset 0x204:
@@ -452,7 +452,7 @@ Key to Flags:
I (info), L (link order), G (group), x (unknown)
O (extra OS processing required) o (OS specific), p (processor specific) </code></pre>
<p><strong>查看一个动态库文件的elf文件的节信息</strong></p>
<pre><code>[root@localhost test]$ readelf -S libmy.so
<pre><code class="language-bash">[root@localhost test]$ readelf -S libmy.so
There are 27 section headers, starting at offset 0xad0:
Section Headers: