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 :把缓存中的历史命令写入历 ...
随机推荐
- UESTC_吴队长征婚 2015 UESTC Training for Search Algorithm & String<Problem E>
E - 吴队长征婚 Time Limit: 10000/4000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others) Submi ...
- Binary Tree Paths 解答
Question Given a binary tree, return all root-to-leaf paths. For example, given the following binary ...
- devStack
1,devstack shell 脚本开源官网 http://devstack.org/ 脚本功能快速搭建 OpenStack 的运行和开发环境 [Note tips by Ruiy devstack ...
- SVN强制填写日志
在F:\Repositories\版本库名\hooks下新建pre-commit.bat 内容如下: @echo off setlocal set SVN_BINDIR="C:\Progra ...
- NSNotificationCenter 传对象
[[NSNotificationCenter defaultCenter] postNotificationName:@"postCity" object:pro]; [[NSNo ...
- IOS 计算密码强度
+ (BOOL) judgeRange:(NSArray*)conditionArr Password:(NSString*)password { NSRange range; BOOL result ...
- HDU 4508 湫湫系列故事——减肥记I(全然背包)
HDU 4508 湫湫系列故事--减肥记I(全然背包) http://acm.hdu.edu.cn/showproblem.php?pid=4508 题意: 有n种食物, 每种食物吃了能获得val[i ...
- Cocos2d-x游戏开发CCBAnimationManager控制动画
CocosBuilder能方便的编辑各种动画.大部分动画都是以独立片段的形式存在的. 须要由程序来控制何时播放. 管理ccbi文件的动画播放有个专门的类:CCBAnimationManager 大致的 ...
- 计算机与ARM板通过路由器相连
首先,使用两根网线分别将计算机和ARM板与路由器的LAN口连接. 要想使计算机和ARM板通信,必须使二者在同一网段. 在计算机的终端输入:ifconfig 获取计算机的ip地址,查看eth0,我的ip ...
- pt-online-schema-change解读
[用途]在线改表 [注意风险]因为涉及到修改表的数据和结构,所以在使用前要小心测试并做好备份,工具默认不会改表,除非你添加了--execute参数 [工具简介] pt-osc模仿MySQL内部的改表方 ...