linux中的strings命令简介
摘自:http://blog.csdn.net/stpeace/article/details/46641069
linux中的strings命令简介
在linux下搞软件开发的朋友, 几乎没有不知道strings命令的。我们先用man strings来看看:
#include <stdio.h> int add(int x, int y)
{
return x + y;
} int main()
{
int a = ;
int b = ;
int c = add(a, b);
printf("oh, my dear, c is %d\n", c); return ;
}
我们来看看strings test.c的结果:
[taoge@localhost learn_c]$ strings test.c
#include <stdio.h>
int add(int x, int y)
return x + y;
int main()
int a = ;
int b = ;
int c = add(a, b);
printf("oh, my dear, c is %d\n", c);
return ;
[taoge@localhost learn_c]$
[taoge@localhost learn_c]$ gcc test.c
[taoge@localhost learn_c]$ strings a.out
/lib/ld-linux.so.
=$TsU
__gmon_start__
libc.so.
_IO_stdin_used
printf
__libc_start_main
GLIBC_2.
PTRh
[^_]
oh, my dear, c is %d
[taoge@localhost learn_c]$
void print();
#include <stdio.h>
#include "xxx.h" void print()
{
printf("rainy days\n");
}
然后, 我们来看看怎么制作静态、动态库吧(在后续博文中会继续详细介绍):
[taoge@localhost learn_strings]$ ls
xxx.c xxx.h
[taoge@localhost learn_strings]$ gcc -c xxx.c
[taoge@localhost learn_strings]$ ar rcs libxxx.a xxx.o
[taoge@localhost learn_strings]$ gcc -shared -fPIC -o libxxx.so xxx.o
[taoge@localhost learn_strings]$ ls
libxxx.a libxxx.so xxx.c xxx.h xxx.o
[taoge@localhost learn_strings]$ strings xxx.o
rainy days
[taoge@localhost learn_strings]$ strings libxxx.a
!<arch>
/ `
Rprint
xxx.o/ `
rainy days
GCC: (GNU) 4.4. (Red Hat 4.4.-)
.symtab
.strtab
.shstrtab
.rel.text
.data
.bss
.rodata
.comment
.note.GNU-stack
xxx.c
puts
[taoge@localhost learn_strings]$
[taoge@localhost learn_strings]$
[taoge@localhost learn_strings]$ strings libxxx.so
__gmon_start__
_init
_fini
__cxa_finalize
_Jv_RegisterClasses
puts
libc.so.
_edata
__bss_start
_end
GLIBC_2.1.3
GLIBC_2.
rainy days
[taoge@localhost learn_strings]$
[taoge@localhost learn_c]$ strings -f * | grep "my dear"
a.out: oh, my dear, c is %d
test.c: printf("oh, my dear, c is %d\n", c);
[taoge@localhost learn_c]$
linux中的strings命令简介的更多相关文章
- linux中的strings命令简介2
摘自:http://blog.csdn.net/stpeace/article/details/46641069 linux中的strings命令简介 之前我们聊过linux strings的用法和用 ...
- linux中的ldd命令简介
转载自:http://blog.csdn.net/stpeace/article/details/47069215 在linux中, 有些命令是大家通用的, 比如ls, rm, mv, cp等等, 这 ...
- linux中的nm命令简介
转:http://blog.csdn.net/stpeace/article/details/47089585 一般来说, 搞linux开发的人, 才会用到nm命令, 非开发的人, 应该用不到. 虽然 ...
- linux中的strings命令
strings - print the strings of printable characters in files. 意思是, 打印文件中可打印的字符. 我来补充一下吧 ...
- linux中的strip命令简介------给文件脱衣服
1.去掉-g,等于程序做了--strip-debug2.strip程序,等于程序做了--strip-debug和--strip-symbol 作为一名Linux开发人员, 如果没有听说过strip命令 ...
- linux中的strip命令简介------给文件脱衣服【转】
转自:http://blog.csdn.net/stpeace/article/details/47090255 版权声明:本文为博主原创文章,转载时请务必注明本文地址, 禁止用于任何商业用途, 否则 ...
- linux中的strip命令简介
转载:https://blog.csdn.net/qq_37858386/article/details/78559490 strip:去除,剥去 一.下面是man strip获得到的信息,简 ...
- Python学习之旅:使用Python实现Linux中的ls命令
一.写在前面 前几天在微信上看到这样一篇文章,链接为:https://mp.weixin.qq.com/s/rl6Sgv3uk_IpoFAx6cWa8w,在这篇文章中,有这样一段话,吸引了我的注意: ...
- Linux中的历史命令
Linux中的历史命令一般保存在用户 /root/.bash_history history 选项 历史命令保存文件夹 选项 -c:清空历史命令 -w :把缓存中的历史命令写入历 ...
随机推荐
- bzoj1684 [Usaco2005 Oct]Close Encounter
Description Lacking even a fifth grade education, the cows are having trouble with a fraction proble ...
- UESTC_王之迷宫 2015 UESTC Training for Search Algorithm & String<Problem A>
A - 王之迷宫 Time Limit: 3000/1000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others) Submit ...
- UESTC_秋实大哥下棋 2015 UESTC Training for Data Structures<Problem I>
I - 秋实大哥下棋 Time Limit: 3000/1000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others) Submi ...
- 电子科大POJ "3*3矩阵的乘法"
3阶矩阵的乘法 Time Limit: 3000/1000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others) c-source ...
- 【CF 675D Tree Construction】BST
题目链接:http://codeforces.com/problemset/problem/675/D 题意:给一个由n个互异整数组成的序列a[],模拟BST的插入过程,依次输出每插入一个元素a[i] ...
- vue.js的devtools安装
安装 1.github下载地址:https://github.com/vuejs/vue-devtools 2.下载好后进入vue-devtools-master工程 执行npm install - ...
- powershell 将文本转换成表格的还有一种方式
$text=" 1 梦幻西游 216406 2014-01-21 资料片 2 炉石传说 15905 2014-01-24 公測 3 新大话西游 214465 2002-08-01 公測 4 ...
- 提交App,请求Apple加急审核
转载自:http://blog.csdn.net/showhilllee/article/details/19541493 提交完毕后进入加急审核页面. 链接:https://developer.ap ...
- ASP.NET 开发框架汇总
先简单记录一下,以后慢慢添加 1.ASP.NET Aries 2.ASP.NET DevExpress
- UMl概述(转)
1. UML的组成 UML由视图(View).图(Diagram).模型元素(Model Element)和通用机制(General Mechanism)等几个部分组成. a) 视图(View): 是 ...