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 :把缓存中的历史命令写入历 ...
随机推荐
- java提高篇(二二)-----LinkedList
摘自http://blog.csdn.net/chenssy/article/details/18099417 java提高篇(二二)-----LinkedList 一.概述 LinkedList与 ...
- 对Linux 新手非常有用的20 个命令
你打算从Windows换到Linux上来,还是你刚好换到Linux上来?哎哟!!!我说什么呢,是什么原因你就出现在我的世界里了.从我以往的经验来说,当我刚使用Linux,命令,终端啊什么的,吓了我一跳 ...
- Android日语输入法Simeji使用示例
MainActivity如下: package cn.testsimeji; import android.os.Bundle; import android.view.View; import an ...
- Javascript进阶篇——(流程控制语句)笔记整理
做判断(if语句)if语句是基于条件成立才执行相应代码时使用的语句.语法: if(条件){ 条件成立时执行代码 } 例子:假设你应聘web前端技术开发岗位,如果你会HTML技术,你面试成功,欢迎加入公 ...
- JS知识点概况
1.什么是JavaScript a) JavaScript 被设计用来向 HTML 页面添加交互行为. b) JavaScript 是一种脚本语言(脚本语言是一种轻量级的编程语言). c) ...
- EF查询数据库框架的搭建
一个简单的EF查询框架除了运行项目外,大概需要5个类库项目,当然这个不是一定要这样做,这可以根据自己的需要设置有多少个项目.这里介绍的方法步骤只适合EF零基础的人看看就是了. 在开始之前,先建立一个运 ...
- <audio>使用2
1.属性测试 <!--显示控件--> <audio src="../images/wind.mp3" id="audioOne" contro ...
- C#操作AD的例子
一下连接中包含了使用c#对AD操作的各种列子 http://www.codeproject.com/Articles/18102/Howto-Almost-Everything-In-Active-D ...
- Candy Bags
读懂了题就会发现这是个超级大水题 Description Gerald has n younger brothers and their number happens to be even. One ...
- Gallery过时替代方案HorizontalScrollView
布局: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:androi ...