strings command (rpm)

I use the command strings before frequency is not high, the more you use the more easily now, and already is inseparable from the command strings. While the strings command said before, but still want to say today. Are the two main purposes, to illustrate the following:

 

        A. Confirmation code compile if translated to the library to go?

        In the large-scale development, we often modify a line or two, and sometimes make changes to the code is not compiled into the library to go (there may be code does not compile synchronized to linux, there may be compile errors lead to build the library fails, there is also willing to be the make clean the place did not make clean rm or library, there may be other reasons assorted), this will often mislead their own judgment, tossing most of the day.

        There are, for example, you submit the code, and the results of your co-workers update (svn up) code (that is, get your code), but the compile time for various reasons did not compile your code into it, and then he submitted the library, then, naturally out of the question, find your boss's head. At this point, you can use the strings command to quickly determine whether to include the library submitted your own code. I used many times, time-tested. Having said that, let's look at combat:

  1.   [taoge@localhost test]$ ls
  2.   test.c
  3.   [taoge@localhost test]$ cat test.c
  4.   #include <stdio.h>
  5.  
     
  6.   int main ()
  7.   {
  8.   int a = 1;
  9.   int b = 2;
  10.   int c = a + b;
  11.   printf("xxx, %d, %d, %d\n", a, b, c);
  12.  
  13.  
  14.   return 0;
  15.   }
  16.   [taoge@localhost test]$ gcc test.c
  17.   [taoge@localhost test]$ ls
  18.   a.out test.c
  19.   [taoge@localhost test]$ strings a.out | grep xxx
  20.   xxx, %d, %d, %d
  21.   [taoge@localhost test]$

As above, generally write their own code, add the log (string), equivalent RBI Tag, and then judgment command strings. If you do not need to add a log, how to do it? I often prior to the log file in a string of brief changes, such as adding xxx, in fact, the equivalent tag to lay their mark.

 

 

        II. For starters, we need to know newly generated code which entered the library, and then we go looking for the library ah!

        This demand is also very reasonable, we can not say what code is compiled into a library to go, you do not know. With strings command it, as follows:

  1.   [taoge@localhost test]$ find -name "*" | xargs strings -f | grep xxx
  2.   ./test.c: printf("xxx, %d, %d, %d\n", a, b, c);
  3.   ./a.out: xxx, %d, %d, %d
  4.   [taoge@localhost test]$

OK, at a glance, I know xxx compiled gone. To add, find the command in double quotation marks and no less, otherwise:

  1.   [taoge@localhost test]$ find -name *
  2.   find: paths must precede expression: test.c
  3.   Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]
  4.   [taoge@localhost test]$

 

Guess you like

Origin www.cnblogs.com/spruce/p/12071779.html