<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>Advogato blog for marcioandreyoliveira</title>
    <link>http://www.advogato.org/person/marcioandreyoliveira/</link>
    <description>Advogato blog for marcioandreyoliveira</description>
    <language>en-us</language>
    <generator>mod_virgule</generator>
    <pubDate>Mon, 6 Oct 2008 23:50:49 GMT</pubDate>
    <item>
      <pubDate>Mon, 17 Mar 2008 15:13:43 GMT</pubDate>
      <title>How to load debug symbols with GDB - Another Approach</title>
      <link>http://www.advogato.org/person/marcioandreyoliveira/diary.html?start=28</link>
      <guid>http://feeds.feedburner.com/~r/MarcioAndreyOliveira/~3/253032780/how-to-load-debug-symbols-with-gdb.html</guid>
      <description>I wrote in the post  &lt;a href="http://marcioandreyoliveira.blogspot.com/2008/03/how-to-debug-striped-programs-with-gdb.html" &gt;How to load debug symbols with GDB&lt;/a&gt; one way do debug a stripped version of an application with full access to debug symbols.&lt;br /&gt;&lt;br /&gt;In this post I will explain another way you can do it.&lt;br /&gt;&lt;br /&gt;We are going to load debuging information from a file that was generated by our executable just before it was stripped off..&lt;br /&gt;&lt;br /&gt;I am going to use the same source and environment settings that I used in my earlier &lt;a href="http://marcioandreyoliveira.blogspot.com/2008/03/how-to-debug-striped-programs-with-gdb.html" &gt;post&lt;/a&gt;:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;released.c: source code of the program we wish to debug (listing 1).&lt;/li&gt;&lt;li&gt;~/estudo/: Source code of our program will be put here.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;~/local/bin: The stripped off version of binary program will stay here.&lt;/li&gt;&lt;li&gt;~/local/symbols: In this place are all files that contain debuging information.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;center&gt;&lt;table bgcolor="#FFFFFF" style="color: rgb(255, 255, 255);" border="1"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;br /&gt;&lt;pre&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&lt;strong&gt;#include &lt;span style="color: rgb(0, 128, 0);"&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&lt;strong&gt;#include &lt;span style="color: rgb(0, 128, 0);"&gt;&amp;lt;stdlib.h&amp;gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;int&lt;/strong&gt; &lt;span style="color: rgb(32, 64, 160);"&gt;division&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;(&lt;/span&gt;&lt;strong&gt;int&lt;/strong&gt; &lt;span style="color: rgb(32, 64, 160);"&gt;a&lt;/span&gt;, &lt;strong&gt;int&lt;/strong&gt; &lt;span style="color: rgb(32, 64, 160);"&gt;b&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;)&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;int&lt;/strong&gt; &lt;span style="color: rgb(32, 64, 160);"&gt;m&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;int&lt;/strong&gt; &lt;span style="color: rgb(32, 64, 160);"&gt;main&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;(&lt;/span&gt;&lt;strong&gt;void&lt;/strong&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;int&lt;/strong&gt; &lt;span style="color: rgb(32, 64, 160);"&gt;i&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;int&lt;/strong&gt; &lt;span style="color: rgb(32, 64, 160);"&gt;j&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(32, 64, 160);"&gt;printf&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;"vou setar i&lt;span style="color: rgb(119, 221, 119);"&gt;\n&lt;/span&gt;"&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;)&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(32, 64, 160);"&gt;i&lt;/span&gt; &lt;span style="color: rgb(68, 68, 255);"&gt;=&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;10&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(32, 64, 160);"&gt;printf&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;"vou setar j&lt;span style="color: rgb(119, 221, 119);"&gt;\n&lt;/span&gt;"&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;)&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(32, 64, 160);"&gt;j&lt;/span&gt; &lt;span style="color: rgb(68, 68, 255);"&gt;=&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;1&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(32, 64, 160);"&gt;printf&lt;/span&gt; &lt;span style="color: rgb(68, 68, 255);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;"i = %d, j = %d&lt;span style="color: rgb(119, 221, 119);"&gt;\n&lt;/span&gt;"&lt;/span&gt;, &lt;span style="color: rgb(32, 64, 160);"&gt;i&lt;/span&gt;, &lt;span style="color: rgb(32, 64, 160);"&gt;j&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;)&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(32, 64, 160);"&gt;m&lt;/span&gt; &lt;span style="color: rgb(68, 68, 255);"&gt;=&lt;/span&gt; &lt;span style="color: rgb(32, 64, 160);"&gt;division&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(32, 64, 160);"&gt;i&lt;/span&gt;, &lt;span style="color: rgb(32, 64, 160);"&gt;j&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;)&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(32, 64, 160);"&gt;printf&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;"m = %d / %d = %d&lt;span style="color: rgb(119, 221, 119);"&gt;\n&lt;/span&gt;"&lt;/span&gt;, &lt;span style="color: rgb(32, 64, 160);"&gt;i&lt;/span&gt;, &lt;span style="color: rgb(32, 64, 160);"&gt;j&lt;/span&gt;, &lt;span style="color: rgb(32, 64, 160);"&gt;m&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;)&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;return&lt;/strong&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;0&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;int&lt;/strong&gt; &lt;span style="color: rgb(32, 64, 160);"&gt;division&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;(&lt;/span&gt;&lt;strong&gt;int&lt;/strong&gt; &lt;span style="color: rgb(32, 64, 160);"&gt;a&lt;/span&gt;, &lt;strong&gt;int&lt;/strong&gt; &lt;span style="color: rgb(32, 64, 160);"&gt;b&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;return&lt;/strong&gt; &lt;span style="color: rgb(32, 64, 160);"&gt;a&lt;/span&gt; / &lt;span style="color: rgb(32, 64, 160);"&gt;b&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/center&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-size:85%;"&gt;Listing 1 - sample program source code&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Let's start:&lt;br /&gt;&lt;br /&gt;1 - Create your program with debug information. In our sample:&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic;font-family:courier new;" &gt;gcc -g -o &lt;/span&gt;&lt;span style="font-style: italic;font-family:courier new;" &gt;release &lt;/span&gt;&lt;span style="font-style: italic;font-family:courier new;" &gt;release.c &amp;lt;ENTER&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;2 - Now we will generate a file that will contain only debug informations. You generate this file by issuing this command:&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic;font-family:courier new;" &gt;objcopy --only-keep-debug &lt;executable_file&gt; &lt;symbol_file&gt; &lt;object_file&gt; &lt;symbol_file&gt; &amp;lt;ENTER&amp;gt;&lt;/symbol_file&gt;&lt;/object_file&gt;&lt;/symbol_file&gt;&lt;/executable_file&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;In our sample:&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic;font-family:courier new;" &gt;objcopy --only-keep-debug &lt;/span&gt;&lt;span style="font-style: italic;font-family:courier new;" &gt;release release.sym &amp;lt;ENTER&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-style: italic;font-family:courier new;" &gt;&lt;br /&gt;&lt;/span&gt;The  choice of  &lt;span style="font-style: italic;"&gt;.sym&lt;/span&gt; as an extension for the debug info file is totally arbitrary. You can use whatever you wish to.&lt;br /&gt;&lt;br /&gt;3 - You remove debugging information:&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic;font-family:courier new;" &gt;strip -s release &amp;lt;ENTER&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;4 - Move file &lt;span style="font-style: italic;"&gt;release&lt;/span&gt; to ~/local/bin/:&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic;font-family:courier new;" &gt;mv release ~/local/bin &amp;lt;ENTER&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;5 - Move file &lt;span style="font-style: italic;"&gt;released.sym&lt;/span&gt; to ~/local/symbols/&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic;font-family:courier new;" &gt;mv release.sym ~/local/symbols &amp;lt;ENTER&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;6 - Go to directory ~/local/bin&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic;font-family:courier new;" &gt;cd ~/local/bin &amp;lt;ENTER&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;7 - Run GDB:&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic;font-family:courier new;" &gt;gdb ./release &amp;lt;ENTER&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;8 - Try &lt;span style="font-style: italic;"&gt;list&lt;/span&gt; command to see that &lt;span style="font-style: italic;"&gt;release&lt;/span&gt; executable file &lt;span style="font-weight: bold;"&gt;doesn't&lt;/span&gt; have symbols in it.&lt;br /&gt;&lt;br /&gt;Figure 1 shows us what I said.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_f3tH_0i5uB0/R9lrbhmRJkI/AAAAAAAAC6o/pOVOks2fMH0/s1600-h/nosym_metodo2_fig1.png" &gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp2.blogger.com/_f3tH_0i5uB0/R9lrbhmRJkI/AAAAAAAAC6o/pOVOks2fMH0/s400/nosym_metodo2_fig1.png" alt="" id="BLOGGER_PHOTO_ID_5177287367258613314" border="0" /&gt;&lt;/a&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic;"&gt;Figure 1 - &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;executable file named release is loaded by GDB.&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;9 - Let GDB to load symbols from symbols file named &lt;span style="font-style: italic;"&gt;release.sym&lt;/span&gt;. This file has all symbols that we need to debug. You achieve this by issuing the following command:&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic;font-family:courier new;" &gt;add-symbol-file ~/local/symbols/release.sym &lt;/span&gt;&lt;span style="font-style: italic;font-family:courier new;" &gt;&amp;lt;ENTER&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;From now on you can debug your program as usual.&lt;br /&gt;&lt;br /&gt;Figure 2 shows us that debuging symbols where imported successfully and that now the &lt;span style="font-style: italic;"&gt;list&lt;/span&gt; command  shows us the program source code.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_f3tH_0i5uB0/R9lz3hmRJlI/AAAAAAAAC6w/7n49IqBbVfA/s1600-h/nosym_metodo2_fig2.png" &gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp2.blogger.com/_f3tH_0i5uB0/R9lz3hmRJlI/AAAAAAAAC6w/7n49IqBbVfA/s400/nosym_metodo2_fig2.png" alt="" id="BLOGGER_PHOTO_ID_5177296644387972690" border="0" /&gt;&lt;/a&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic;"&gt;Figure 2 - now our GDB session has debuging symbols&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;As you can see in figure 3, I set a break point at line 17 and I ran the program that stopped there. Then I printed &lt;span style="font-style: italic;"&gt;i&lt;/span&gt; variable. It is possible just because symbols were loaded.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_f3tH_0i5uB0/R9l3vxmRJmI/AAAAAAAAC64/iV3xx-0AN4Q/s1600-h/nosym_metodo2_fig3.png" &gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp3.blogger.com/_f3tH_0i5uB0/R9l3vxmRJmI/AAAAAAAAC64/iV3xx-0AN4Q/s400/nosym_metodo2_fig3.png" alt="" id="BLOGGER_PHOTO_ID_5177300909290497634" border="0" /&gt;&lt;/a&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic;"&gt;Figure 3 - debugging session.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;You can see that this method to load debug symbols is easier than the previous one presented in the post &lt;a href="http://marcioandreyoliveira.blogspot.com/2008/03/how-to-debug-striped-programs-with-gdb.html" &gt;How to load debug symbols with GDB&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;My friend &lt;a href="http://jumpi.wordpress.com/" &gt;Jumpi&lt;/a&gt; complained that it is not the &lt;span style="font-style: italic;"&gt;unix way&lt;/span&gt; to debug applications that just don't have debug information by loading a separated file. We have core files to help us to debug the application in our host.&lt;br /&gt;&lt;br /&gt;I agree with him that it is unusual to debug this way, but it may be useful.&lt;br /&gt;&lt;br /&gt;The idea behind this method (and behind the previous one) is similar to that used by MS with .pdb files.&lt;br /&gt;&lt;br /&gt;It will allow you to save disk space on your host because you can keep only stripped versions of your applications and libraries in it. It is especially important to embedded systems.&lt;br /&gt;&lt;br /&gt;At the same time it let you have a colection of symbol files stored at some place (say, a DVD disc or another server). When (and if) you need to do a debug session&lt;br /&gt;&lt;br /&gt;I hope this post will make your life easier.&lt;img src="http://feeds.feedburner.com/~r/MarcioAndreyOliveira/~4/253032780" height="1" width="1"/&gt;</description>
    </item>
    <item>
      <pubDate>Sun, 16 Mar 2008 03:12:03 GMT</pubDate>
      <title>Precision Resistors</title>
      <link>http://www.advogato.org/person/marcioandreyoliveira/diary.html?start=27</link>
      <guid>http://feeds.feedburner.com/~r/MarcioAndreyOliveira/~3/252236279/precision-resistors.html</guid>
      <description>A lot of hobbyists want to make their own circuits but they face a problem: precision resistors.&lt;br /&gt;&lt;br /&gt;But what is the difference between a precision resistor and an ordinary resistor? Answer: &lt;span style="font-weight: bold;"&gt;none&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;By the way, the term &lt;span style="font-style: italic;"&gt;precision&lt;/span&gt; is unappropriated because the tolerance of the component &lt;span style="font-style: italic;"&gt;doesn't&lt;/span&gt; show us the precision of the resistor but how much its real value can differ from the nominal value.&lt;br /&gt;&lt;br /&gt;- What you mean by none?&lt;br /&gt;&lt;br /&gt;I will explain. By no means the manufacturer can assure that during a manufacturing process of resistors all of them will have the same value.&lt;br /&gt;&lt;br /&gt;So, the manufacturer measures the resistance of each component and then it groups them by ranges of values. Each group has the same tolerance or (in)precision.&lt;br /&gt;&lt;br /&gt;But what does tolerance means? It means that manufacturer assures that the real value of the resistor will not be either greater nor lower than nominal value plus or minus a percentage that is indicated by the tolerance band.&lt;br /&gt;&lt;br /&gt;Let's see a sample.&lt;br /&gt;&lt;br /&gt;Say a manufacturer is producing resistors with resistances of 100 ohms (nominal value) and that he sells them with 1%, 2%, 5%, 10% and 20% of tolerance.&lt;br /&gt;&lt;br /&gt;Manufacturer will measure each resistance of 100 ohms and he will group them as follows:&lt;br /&gt;&lt;br /&gt;All resistors with resistance varying between 99 and 101 ohms will be put together in the group of components with 1% of tolerance.&lt;br /&gt;&lt;br /&gt;All resistors with resistance varying between 98 and 99 ohms or between 101 and 102 ohms  will be put together in the group of components with 2% of tolerance (you should remember that all components with resistances varying between 99 and 101 ohms are in the group of resistors with 1% of tolerance).&lt;br /&gt;&lt;br /&gt;All resistors with resistance varying between 95 and 98 ohms or between 102 and 105 ohms will be put together in the group of components with 5% of tolerance (you should remember that all components with resistances greater than 98 and less than 102 ohms were put in the groups of resistors with 1% and 2 % of tolerance).&lt;br /&gt;&lt;br /&gt;This process continues until all components are classified in their tolerance band.&lt;br /&gt;&lt;br /&gt;So I say again: There is no difference between a &lt;span style="font-style: italic;"&gt;precision resistor&lt;/span&gt; and an &lt;span style="font-style: italic;"&gt;ordinary resistor&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;There are many projects where the ratio between resistances is more important than the actual values. In these case we can do the same thing as the manufacturer. We can measure our resistors to select the most appropriated.&lt;br /&gt;&lt;br /&gt;Let me show an example. Suppose we have an inverter amplifier as shown in figure 1.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_f3tH_0i5uB0/RpZZp5FrsRI/AAAAAAAAABY/_4ovzGWT-Mc/s1600-h/inversor.PNG" &gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp2.blogger.com/_f3tH_0i5uB0/RpZZp5FrsRI/AAAAAAAAABY/_4ovzGWT-Mc/s320/inversor.PNG" alt="" id="BLOGGER_PHOTO_ID_5086351405395718418" border="0" /&gt;&lt;/a&gt;&lt;span style="font-size:85%;"&gt;Figure 1 - Inverter Amplifier&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Gain is determined by equation&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_f3tH_0i5uB0/RpbfqpFrsUI/AAAAAAAAAB4/PO_ueCJbDsc/s1600-h/ganhoDoInversor.png" &gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp1.blogger.com/_f3tH_0i5uB0/RpbfqpFrsUI/AAAAAAAAAB4/PO_ueCJbDsc/s320/ganhoDoInversor.png" alt="" id="BLOGGER_PHOTO_ID_5086498752838742338" border="0" /&gt;&lt;/a&gt;We can see that &lt;span style="color: rgb(255, 0, 0); font-weight: bold;"&gt;the circuit's gain is determined by the ratio between R&lt;span style="font-size:85%;"&gt;f&lt;/span&gt; and Ri&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Suppose we want a gain of X.&lt;br /&gt;&lt;br /&gt;If R&lt;span style="font-size:85%;"&gt;f&lt;/span&gt; = 10,000 ohms and R&lt;span style="font-size:85%;"&gt;i&lt;/span&gt; = 5,000 ohms the gain is -2.&lt;br /&gt;&lt;br /&gt;If R&lt;span style="font-size:85%;"&gt;f&lt;/span&gt; = 20,000 ohms and R&lt;span style="font-size:85%;"&gt;i&lt;/span&gt; = 10,000 ohms the gain is -2 too.&lt;br /&gt;&lt;br /&gt;If we use resistors with tolerance (precision) of 5% the gain could vary between -1.81and -2.21 depending on real values of resistors R&lt;span style="font-size:85%;"&gt;f&lt;/span&gt; and R&lt;span style="font-size:85%;"&gt;i&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;If we use resistors with tolerance (precision) of 2% the gain could vary between  -1.92 e -2.08 what is much better.&lt;br /&gt;&lt;br /&gt;What if we don't have precision resistors? What can we do?&lt;br /&gt;&lt;br /&gt;We can use our ordinary resistors (tolerance of 5%). Take a bunch of them and measure each one until you find two resistors with a resistance ratio as near as possible of the value we wish (It is 2 in our sample).&lt;br /&gt;&lt;br /&gt;Let me illustrate with an example. Say we take a bunch of resistors of 20K and 10K ohms (nominal values) to measure.&lt;br /&gt;&lt;br /&gt;Suppose we found some resistors of 20,900 and 10,400 ohms. So we could do R&lt;span style="font-size:85%;"&gt;f&lt;/span&gt; = 20,900 ohms and R&lt;span style="font-size:85%;"&gt;i&lt;/span&gt; = 10,400. With these values, the gain would be -2.01 that is a better result than estimated with 2% tolerance resistors.&lt;br /&gt;&lt;br /&gt;If we found R&lt;span style="font-size:85%;"&gt;f&lt;/span&gt; = 21,000 and R&lt;span style="font-size:85%;"&gt;i&lt;/span&gt; = 10,500 than the gain would be exactly 2.&lt;br /&gt;&lt;br /&gt;The method, presented in this post, to use ordinary resistors instead of precision resistors is suitable only in prototype development. In commercial scale it is not feasible and the use of precision resistors is mandatory.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;img src="http://feeds.feedburner.com/~r/MarcioAndreyOliveira/~4/252236279" height="1" width="1"/&gt;</description>
    </item>
    <item>
      <pubDate>Sun, 9 Mar 2008 04:12:16 GMT</pubDate>
      <title>How to load debug symbols with GDB</title>
      <link>http://www.advogato.org/person/marcioandreyoliveira/diary.html?start=26</link>
      <guid>http://feeds.feedburner.com/~r/MarcioAndreyOliveira/~3/248141735/how-to-debug-striped-programs-with-gdb.html</guid>
      <description>My friend &lt;a href="http://www.caloni.com.br/blog" &gt;Wanderley&lt;/a&gt; asked me if it is possible to tell GBD to load debuging symbols from some file and use it to help debuging a program that doesn't have them.&lt;br /&gt;&lt;br /&gt;Yes. It is.&lt;br /&gt;&lt;br /&gt;There are two solutions to this question.&lt;br /&gt;&lt;br /&gt;I going to explain the first solution in this post. The other solution I will explain in the next post.&lt;br /&gt;&lt;br /&gt;You can load debuging information from an debug enabled version of executable file.&lt;br /&gt;&lt;br /&gt;In order to better explain the first solution, I will setup my sample enviroment as follows:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;released.c: source code of the program we wish to debug (listing 1).&lt;/li&gt;&lt;li&gt;~/estudo/: Source code of our program will be put here.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;~/local/bin: The stripped off version of binary program will stay here.&lt;/li&gt;&lt;li&gt;~/local/symbols: In this place are all files that contain debuging information.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;center&gt;&lt;table bgcolor="#ffffff" border="1" style="color:black;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;br /&gt;&lt;pre&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&lt;strong&gt;#include &lt;span style="color: rgb(0, 128, 0);"&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&lt;strong&gt;#include &lt;span style="color: rgb(0, 128, 0);"&gt;&amp;lt;stdlib.h&amp;gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;int&lt;/strong&gt; &lt;span style="color: rgb(32, 64, 160);"&gt;division&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;(&lt;/span&gt;&lt;strong&gt;int&lt;/strong&gt; &lt;span style="color: rgb(32, 64, 160);"&gt;a&lt;/span&gt;, &lt;strong&gt;int&lt;/strong&gt; &lt;span style="color: rgb(32, 64, 160);"&gt;b&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;)&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;int&lt;/strong&gt; &lt;span style="color: rgb(32, 64, 160);"&gt;m&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;int&lt;/strong&gt; &lt;span style="color: rgb(32, 64, 160);"&gt;main&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;(&lt;/span&gt;&lt;strong&gt;void&lt;/strong&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;int&lt;/strong&gt; &lt;span style="color: rgb(32, 64, 160);"&gt;i&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;int&lt;/strong&gt; &lt;span style="color: rgb(32, 64, 160);"&gt;j&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(32, 64, 160);"&gt;printf&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;"vou setar i&lt;span style="color: rgb(119, 221, 119);"&gt;\n&lt;/span&gt;"&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;)&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(32, 64, 160);"&gt;i&lt;/span&gt; &lt;span style="color: rgb(68, 68, 255);"&gt;=&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;10&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(32, 64, 160);"&gt;printf&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;"vou setar j&lt;span style="color: rgb(119, 221, 119);"&gt;\n&lt;/span&gt;"&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;)&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(32, 64, 160);"&gt;j&lt;/span&gt; &lt;span style="color: rgb(68, 68, 255);"&gt;=&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;1&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(32, 64, 160);"&gt;printf&lt;/span&gt; &lt;span style="color: rgb(68, 68, 255);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;"i = %d, j = %d&lt;span style="color: rgb(119, 221, 119);"&gt;\n&lt;/span&gt;"&lt;/span&gt;, &lt;span style="color: rgb(32, 64, 160);"&gt;i&lt;/span&gt;, &lt;span style="color: rgb(32, 64, 160);"&gt;j&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;)&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(32, 64, 160);"&gt;m&lt;/span&gt; &lt;span style="color: rgb(68, 68, 255);"&gt;=&lt;/span&gt; &lt;span style="color: rgb(32, 64, 160);"&gt;division&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(32, 64, 160);"&gt;i&lt;/span&gt;, &lt;span style="color: rgb(32, 64, 160);"&gt;j&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;)&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(32, 64, 160);"&gt;printf&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;"m = %d / %d = %d&lt;span style="color: rgb(119, 221, 119);"&gt;\n&lt;/span&gt;"&lt;/span&gt;, &lt;span style="color: rgb(32, 64, 160);"&gt;i&lt;/span&gt;, &lt;span style="color: rgb(32, 64, 160);"&gt;j&lt;/span&gt;, &lt;span style="color: rgb(32, 64, 160);"&gt;m&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;)&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;return&lt;/strong&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;0&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;int&lt;/strong&gt; &lt;span style="color: rgb(32, 64, 160);"&gt;division&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;(&lt;/span&gt;&lt;strong&gt;int&lt;/strong&gt; &lt;span style="color: rgb(32, 64, 160);"&gt;a&lt;/span&gt;, &lt;strong&gt;int&lt;/strong&gt; &lt;span style="color: rgb(32, 64, 160);"&gt;b&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;return&lt;/strong&gt; &lt;span style="color: rgb(32, 64, 160);"&gt;a&lt;/span&gt; / &lt;span style="color: rgb(32, 64, 160);"&gt;b&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/center&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-size:85%;"&gt;Listing 1 - sample program source code&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;I have two versions of the program: with and without debuging information.&lt;br /&gt;&lt;br /&gt;1 - You compile your program with debug information. In our sample:&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic;font-family:courier new;" &gt;gcc -Wall -g -release release.c &amp;lt;ENTER&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;2 - You make a copy of your program. In our sample:&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic;"&gt;cp  release release.full &amp;lt;ENTER&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;3 - You strip off debuging information:&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic;font-family:courier new;" &gt;strip -s release &amp;lt;ENTER&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;As you can see on Figure 1, we have two programs. &lt;span style="font-style: italic;"&gt;released.full&lt;/span&gt; has debuging symbols but &lt;span style="font-style: italic;"&gt;release&lt;/span&gt; doesn't have them.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_f3tH_0i5uB0/R9MS6BmRJZI/AAAAAAAAC5M/mKqsw8e96dg/s1600-h/nosym_metodo1_fig1.png" &gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp2.blogger.com/_f3tH_0i5uB0/R9MS6BmRJZI/AAAAAAAAC5M/mKqsw8e96dg/s400/nosym_metodo1_fig1.png" alt="" id="BLOGGER_PHOTO_ID_5175501184849487250" border="0" /&gt;&lt;/a&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic;"&gt;Figure 1&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;4 - Move file &lt;span style="font-style: italic;"&gt;release&lt;/span&gt; to ~/local/bin/:&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic;font-family:courier new;" &gt;mv release ~/local/bin &amp;lt;ENTER&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;5 - Move file &lt;span style="font-style: italic;"&gt;released.full&lt;/span&gt; to ~/local/symbols/&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic;font-family:courier new;" &gt;mv release.full ~/local/symbols &amp;lt;ENTER&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;6 - Go to directory ~/local/bin&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic;font-family:courier new;" &gt;cd ~/local/bin &amp;lt;ENTER&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;7 - Run GDB:&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic;font-family:courier new;" &gt;gdb ./release &amp;lt;ENTER&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;8 - Try &lt;span style="font-style: italic;"&gt;list&lt;/span&gt; command to see that &lt;span style="font-style: italic;"&gt;release&lt;/span&gt; executable file &lt;span style="font-weight: bold;"&gt;doesn't&lt;/span&gt; have symbols in it.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Note&lt;/span&gt;: if the program was already running you could get its PID then attach GDB to it.&lt;br /&gt;&lt;br /&gt;Figure 2 shows us two windows. The first one shows that our executable file has no debug information. In the other window we can see that &lt;span style="font-style: italic;"&gt;release&lt;/span&gt; is not yet loaded.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_f3tH_0i5uB0/R9MwaBmRJaI/AAAAAAAAC5U/1kXxa6_TnuA/s1600-h/nosym_metodo1_fig2.png" &gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp2.blogger.com/_f3tH_0i5uB0/R9MwaBmRJaI/AAAAAAAAC5U/1kXxa6_TnuA/s400/nosym_metodo1_fig2.png" alt="" id="BLOGGER_PHOTO_ID_5175533620442506658" border="0" /&gt;&lt;/a&gt;&lt;span style="font-size:85%;"&gt;Figure 2 - executable file named release is loaded by GDB  but it is not yet running.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;9 - Let GDB to load symbols from executable file named &lt;span style="font-style: italic;"&gt;release.full&lt;/span&gt;. This binary version of our program has all symbols that we need to debug.&lt;br /&gt;&lt;br /&gt;Please notice that GDB will not replace the &lt;span style="font-style: italic;"&gt;release&lt;/span&gt; executable by &lt;span style="font-style: italic;"&gt;release.full&lt;/span&gt; version of our program. It will &lt;span style="font-style: italic;"&gt;just import&lt;/span&gt; symbols from &lt;span style="font-style: italic;"&gt;release.full&lt;/span&gt; into &lt;span style="font-style: italic;"&gt;release&lt;/span&gt; debugging session.&lt;br /&gt;&lt;br /&gt;But GDB needs to know in advance where it must put the symbols it will load. How can you determine the correct memory address?&lt;br /&gt;&lt;br /&gt;It is quite simple. You issue command &lt;span style="font-style: italic;"&gt;maint&lt;/span&gt; inside GDB:&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic;font-family:courier new;" &gt;maint info sections&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Then you look for &lt;span style="font-style: italic;"&gt;.text&lt;/span&gt; section. The address that is in the first column is what you want. In our sample, it is 0x08048320. See figure 3.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_f3tH_0i5uB0/R9M0dhmRJbI/AAAAAAAAC5c/LD_Olo9KDME/s1600-h/nosym_metodo1_fig3.png" &gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp0.blogger.com/_f3tH_0i5uB0/R9M0dhmRJbI/AAAAAAAAC5c/LD_Olo9KDME/s400/nosym_metodo1_fig3.png" alt="" id="BLOGGER_PHOTO_ID_5175538078618559922" border="0" /&gt;&lt;/a&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic;"&gt;Figure 3 - looking for .text section address&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;&lt;br /&gt;10 - The next step is to instruct GDB to load debug symbols into &lt;span style="font-style: italic;"&gt;.text section&lt;/span&gt;. To achieve it you do this:&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic;font-family:courier new;" &gt;add-symbol-file ~/local/symbols/release.full &amp;lt;.text section address&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;In our sample it means to type:&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic;font-family:courier new;" &gt;add-symbol-file ~/local/symbols/release.full 0x08048320&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;From now on you can debug your program as usual.&lt;br /&gt;&lt;br /&gt;Figure 4 shows us that debuging symbols where imported successfully and that now the &lt;span style="font-style: italic;"&gt;list&lt;/span&gt; command (abbreviated as &lt;span style="font-style: italic;"&gt;l&lt;/span&gt;) shows us the program source code.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_f3tH_0i5uB0/R9M7kBmRJcI/AAAAAAAAC5k/JipYvqM_ACw/s1600-h/nosym_metodo1_fig4.png" &gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp2.blogger.com/_f3tH_0i5uB0/R9M7kBmRJcI/AAAAAAAAC5k/JipYvqM_ACw/s400/nosym_metodo1_fig4.png" alt="" id="BLOGGER_PHOTO_ID_5175545886869104066" border="0" /&gt;&lt;/a&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic;"&gt;Figure 4 - now our GDB session has debuging symbols&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;As you can see in figure 5, I set a break point at line 17 and I ran the program that stopped there. Then I printed &lt;span style="font-style: italic;"&gt;i&lt;/span&gt; variable.&lt;br /&gt;&lt;br /&gt;In the other terminal I issued &lt;span style="font-style: italic;"&gt;ps&lt;/span&gt; command. It was done just to show you that the only program running &lt;span&gt;was &lt;/span&gt;&lt;span style="font-style: italic;"&gt;release&lt;/span&gt; executable. There is no instance of &lt;span style="font-style: italic;"&gt;release.full&lt;/span&gt; program.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_f3tH_0i5uB0/R9NBjhmRJdI/AAAAAAAAC5s/FW5cRUjPoe4/s1600-h/nosym_metodo1_fig5.png" &gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp0.blogger.com/_f3tH_0i5uB0/R9NBjhmRJdI/AAAAAAAAC5s/FW5cRUjPoe4/s400/nosym_metodo1_fig5.png" alt="" id="BLOGGER_PHOTO_ID_5175552475348936146" border="0" /&gt;&lt;/a&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic;"&gt;Figure 5 - debugging session.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;I hope this post will make your life easier. In the next time I will teach you another way to import debuging symbols.&lt;img src="http://feeds.feedburner.com/~r/MarcioAndreyOliveira/~4/248141735" height="1" width="1"/&gt;</description>
    </item>
    <item>
      <pubDate>Sun, 9 Mar 2008 04:12:16 GMT</pubDate>
      <title>Using Mutt with Gmail</title>
      <link>http://www.advogato.org/person/marcioandreyoliveira/diary.html?start=25</link>
      <guid>http://feeds.feedburner.com/~r/MarcioAndreyOliveira/~3/243468428/gmail-is-best-e-mail-service-and.html</guid>
      <description>&lt;blockquote&gt;&lt;/blockquote&gt;&lt;a href="http://www.gmail.com/" &gt;Gmail&lt;/a&gt; is the best e-mail service and &lt;a href="http://www.blogger.com/www.mozilla.com/firefox/" &gt;Firefox&lt;/a&gt; is the best browser. But if you keep Gmail's page open for a long time then Firefox will waste a lot of memory of your computer.&lt;br /&gt;&lt;br /&gt;If you have an old machine like me, you know that each byte is important. So, I decided to come back to my old mail client: &lt;a href="http://www.mutt.org/" &gt;Mutt&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Here I'm showing some steps you need to let mutt access Gmail with IMAP protocol.&lt;br /&gt;&lt;br /&gt;I'm using Ubuntu 7.04 with mutt 1.5.13, but it should work with other distros.&lt;br /&gt;&lt;br /&gt;You must replace &lt;span style="font-style: italic; font-weight: bold;"&gt;my_mail@gmail.com&lt;/span&gt; and &lt;span style="font-style: italic; font-weight: bold;"&gt;my_password&lt;/span&gt; occurrences with real values.&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;First of all you must enable IMAP access to your Gmail account. To enable IMAP in your Gmail account:&lt;br /&gt;1.1. Log in to your Gmail account.&lt;br /&gt;1.2. Click Settings at the top of any Gmail page.&lt;br /&gt;1.3. Click Forwarding and POP/IMAP.&lt;br /&gt;1.4. Select Enable IMAP.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Install mutt, msmtp and ssl. I won't show you how to do it because it is different for each distro.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Create msmtp configuration file (~/.msmtprc) as shown:&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;account default&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;host smtp.gmail.com&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;port 587&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;from &lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold;font-family:courier new;" &gt;my_mail@gmail.com&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;tls on&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;tls_starttls on&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;auth on&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;user &lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold;font-family:courier new;" &gt;my_mail@gmail.com&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;password &lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold;font-family:courier new;" &gt;my_password&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;logfile ~/.msmtp.log&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Create mutt configuration file (~/.muttrc) as shown:&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;set imap_user = "&lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold;font-family:courier new;" &gt;my_mail@gmail.com&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;set imap_pass = "&lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold;font-family:courier new;" &gt;my_password&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;set from = "&lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold;font-family:courier new;" &gt;my_mail@gmail.com&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;set realname = "Your Real Name"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;set folder = "imaps://imap.gmail.com:993"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;set spoolfile = imaps://imap.gmail.com:993/INBOX&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;set record=""&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;set postponed="imaps://imap.gmail.com/[Gmail]/Drafts"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;set header_cache="~/.mutt/cache/headers"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;set message_cachedir="~/.mutt/cache/bodies"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;set certificate_file=~/.mutt/certificates&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;set move = no&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;set imap_check_subscribed="yes"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;set imap_list_subscribed="yes"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;set mbox="imaps://imap.gmail.com/[Gmail]/All Mail"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;# this line instructs mutt to refresh my IMAP mailbox every 120 seconds&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;set mail_check=60&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;#I'm using &lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold;font-family:courier new;" &gt;^&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; character to instruct mutt to update e-mail list immediately&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;bind index "^" imap-fetch-mail&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;And that's all folks.&lt;img src="http://feeds.feedburner.com/~r/MarcioAndreyOliveira/~4/243468428" height="1" width="1"/&gt;</description>
    </item>
    <item>
      <pubDate>Sun, 9 Mar 2008 04:12:16 GMT</pubDate>
      <title>Looking for many words at once</title>
      <link>http://www.advogato.org/person/marcioandreyoliveira/diary.html?start=24</link>
      <guid>http://feeds.feedburner.com/~r/MarcioAndreyOliveira/~3/229674681/looking-for-many-words-at-once.html</guid>
      <description>I use Vim daily and my admiration for it &lt;span style="color: rgb(255, 0, 0);"&gt;always&lt;/span&gt; is renewed. It has so may features that I doubt any one can use 100% of its capacity.&lt;br /&gt;&lt;br /&gt;One of the Vim's features I like too much is its ability to search different words at once in text.&lt;br /&gt;&lt;br /&gt;When we want to find a word we enter in command mode and we type:&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic;"&gt;/word &amp;lt;ENTER&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;- But what if we want to find two or more words ? Do we need to do separate searches?&lt;br /&gt;&lt;br /&gt;No! We do just one search  in command mode with each word separated by &lt;span style="font-style: italic;"&gt;escaped pipe&lt;/span&gt;s (&lt;span style="font-style: italic;"&gt;\|&lt;/span&gt;) :&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic;"&gt;/word1\|word2\|word3 &amp;lt;ENTER&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Figure 1 shows a search for four words. Notice that spaces are considered as part of the word we are looking for.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_f3tH_0i5uB0/R5aNiIROTKI/AAAAAAAACgM/OS-0zjma2J4/s1600-h/procuraNpalavras.png" &gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp2.blogger.com/_f3tH_0i5uB0/R5aNiIROTKI/AAAAAAAACgM/OS-0zjma2J4/s400/procuraNpalavras.png" alt="" id="BLOGGER_PHOTO_ID_5158466040674274466" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;Figure 2 shows the result of the search.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_f3tH_0i5uB0/R5aN44ROTLI/AAAAAAAACgU/dIiFcs06hoI/s1600-h/resultadoBuscaNpalavras.png" &gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp1.blogger.com/_f3tH_0i5uB0/R5aN44ROTLI/AAAAAAAACgU/dIiFcs06hoI/s400/resultadoBuscaNpalavras.png" alt="" id="BLOGGER_PHOTO_ID_5158466431516298418" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;I hope this tip will be as useful for you as it is for me.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/MarcioAndreyOliveira/~4/229674681" height="1" width="1"/&gt;</description>
    </item>
    <item>
      <pubDate>Sun, 9 Mar 2008 04:12:16 GMT</pubDate>
      <title>Livros que eu j&#xE1; li</title>
      <link>http://www.advogato.org/person/marcioandreyoliveira/diary.html?start=23</link>
      <guid>http://feeds.feedburner.com/~r/MarcioAndreyOliveira/~3/222475683/livros-que-eu-j-li.html</guid>
      <description>Aqui est&#xE3;o alguns dos livros que eu j&#xE1; li (t&#xE9;cnicos ou n&#xE3;o).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div id="ShelfariWidget39201"&gt;&lt;a href="http://www.shelfari.com/" &gt;Shelfari: Book reviews on your book blog&lt;/a&gt;&lt;script src="http://www.shelfari.com/ws/39201/widget.js" language="javascript" type="text/javascript"&gt;&lt;/script&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/MarcioAndreyOliveira/~4/222475683" height="1" width="1"/&gt;</description>
    </item>
    <item>
      <pubDate>Sun, 9 Mar 2008 04:12:16 GMT</pubDate>
      <title>Procurando v&#xE1;rias palavras ao mesmo tempo</title>
      <link>http://www.advogato.org/person/marcioandreyoliveira/diary.html?start=22</link>
      <guid>http://feeds.feedburner.com/~r/MarcioAndreyOliveira/~3/221317380/procurando-vrias-palavras-ao-mesmo.html</guid>
      <description>Uso o Vim todos os dias e minha admira&#xE7;&#xE3;o por ele sempre se renova. Ele &#xE9; t&#xE3;o cheio de recursos que duvido que exista algu&#xE9;m que consiga utilizar 100% das suas capacidades.&lt;br /&gt;&lt;br /&gt;Um dos recursos que o Vim possui que mais me agrada &#xE9; a sua capacidade de procurar por v&#xE1;rias palavras diferentes ao mesmo tempo no texto.&lt;br /&gt;&lt;br /&gt;Normalmente, quando queremos procurar uma palavra, entramos no modo de comando e digitamos:&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic;"&gt;/palavra &amp;lt;ENTER&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;- Mas e quando queremos procurar duas ou mais palavras? Vamos ter que fazer as buscas separadamente?&lt;br /&gt;&lt;br /&gt;N&#xE3;o! N&#xF3;s efetuamos a busca, no modo de comando, com as palavras separadas pelo pipe &lt;span style="font-style: italic;"&gt;escapado&lt;/span&gt; (&lt;span style="font-style: italic;"&gt;\|&lt;/span&gt;) :&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic;"&gt;/palavra1\|palavra2\|palavra3 &amp;lt;ENTER&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;A figura 1 abaixo ilustra o comando de busca para quatro palavras. Observe que os espa&#xE7;os s&#xE3;o considerados como parte da palavra que se procura.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_f3tH_0i5uB0/R5aNiIROTKI/AAAAAAAACgM/OS-0zjma2J4/s1600-h/procuraNpalavras.png" &gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp2.blogger.com/_f3tH_0i5uB0/R5aNiIROTKI/AAAAAAAACgM/OS-0zjma2J4/s400/procuraNpalavras.png" alt="" id="BLOGGER_PHOTO_ID_5158466040674274466" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;A figura 2 mostra o resultado da busca.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_f3tH_0i5uB0/R5aN44ROTLI/AAAAAAAACgU/dIiFcs06hoI/s1600-h/resultadoBuscaNpalavras.png" &gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp1.blogger.com/_f3tH_0i5uB0/R5aN44ROTLI/AAAAAAAACgU/dIiFcs06hoI/s400/resultadoBuscaNpalavras.png" alt="" id="BLOGGER_PHOTO_ID_5158466431516298418" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Espero que esta dica seja t&#xE3;o &#xFA;til para ti quanto &#xE9; para mim.&lt;br /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/MarcioAndreyOliveira/~4/221317380" height="1" width="1"/&gt;</description>
    </item>
    <item>
      <pubDate>Sun, 9 Mar 2008 04:12:16 GMT</pubDate>
      <title>Entendendo o Mercurial (2)</title>
      <link>http://www.advogato.org/person/marcioandreyoliveira/diary.html?start=21</link>
      <guid>http://feeds.feedburner.com/~r/MarcioAndreyOliveira/~3/217099214/entendendo-o-mercurial-2.html</guid>
      <description>Fiz as corre&#xE7;&#xF5;es na tradu&#xE7;&#xE3;o do artigo Understanding Mercurial. A vers&#xE3;o traduzida encontra-se &lt;a href="http://www.selenic.com/mercurial/wiki/index.cgi/BrazilianPortugueseUnderstandingMercurial" &gt;aqui&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Aproveito para agradecer ao meu amigo &lt;a href="http://www.caloni.com.br/blog/" &gt;Wanderley&lt;/a&gt; pelas corre&#xE7;&#xF5;es e sugest&#xF5;es.&lt;img src="http://feeds.feedburner.com/~r/MarcioAndreyOliveira/~4/217099214" height="1" width="1"/&gt;</description>
    </item>
    <item>
      <pubDate>Sun, 9 Mar 2008 04:12:16 GMT</pubDate>
      <title>Entendendo o Mercurial</title>
      <link>http://www.advogato.org/person/marcioandreyoliveira/diary.html?start=20</link>
      <guid>http://feeds.feedburner.com/~r/MarcioAndreyOliveira/~3/216760686/entendendo-o-mercurial.html</guid>
      <description>Hoje eu praticamente terminei a tradu&#xE7;&#xE3;o do artigo &lt;a href="http://www.selenic.com/mercurial/wiki/index.cgi/UnderstandingMercurial" &gt;Understanding Mercurial&lt;/a&gt; para o portugu&#xEA;s. Falta eu fazer uma revis&#xE3;o e corrigir uns pequenos erros (que n&#xE3;o atrapalham em nada o entendimento do assunto).&lt;br /&gt;&lt;br /&gt;A tradu&#xE7;&#xE3;o est&#xE1; no wiki do Mercurial. Podes visit&#xE1;-la clicando &lt;a href="http://www.selenic.com/mercurial/wiki/index.cgi/Entendendo_o_Mercurial" &gt;aqui&lt;/a&gt;.&lt;img src="http://feeds.feedburner.com/~r/MarcioAndreyOliveira/~4/216760686" height="1" width="1"/&gt;</description>
    </item>
    <item>
      <pubDate>Sun, 9 Mar 2008 04:12:16 GMT</pubDate>
      <title>Controle de Vers&#xF5;es: T&#xE3;o importante quanto o compilador!</title>
      <link>http://www.advogato.org/person/marcioandreyoliveira/diary.html?start=19</link>
      <guid>http://feeds.feedburner.com/~r/MarcioAndreyOliveira/~3/215692332/controle-de-verses-to-importante-quanto.html</guid>
      <description>Se tu desenvolves software, independente de qual seja a linguagem, ent&#xE3;o deves fazer o controle das modifica&#xE7;&#xF5;es de algum modo.&lt;br /&gt;&lt;br /&gt;Quando estava iniciando na programa&#xE7;&#xE3;o, o controle que eu fazia era bem primitivo. Se eu tivesse apenas um arquivo, ap&#xF3;s finalizar as altera&#xE7;&#xF5;es, eu salvava uma c&#xF3;pia do mesmo com o seguinte formato: &lt;span style="font-style: italic;"&gt;&amp;lt;nome&amp;gt;.&amp;lt;extens&#xE3;o&amp;gt;&amp;lt;anom&#xEA;sdia_horaminuto&amp;gt;&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Por exemplo, se eu tivesse um arquivo chamado meu &lt;span style="font-style: italic;"&gt;arquivo.c&lt;/span&gt; e tivesse finalizado uma altera&#xE7;&#xE3;o do arquivo no dia 10/01/2008 &#xE0;s 18:30h, a c&#xF3;pia do mesmo teria o nome &lt;span style="font-style: italic;"&gt;arquivo.c_20081001_1830&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Se por acaso fossem v&#xE1;rios arquivos correlacionados, ao inv&#xE9;s de copiar os arquivos em si, eu aplicava este m&#xE9;todo &#xE0; pasta.&lt;br /&gt;&lt;br /&gt;Por exemplo, se eu tivesse uma pasta chamada &lt;span style="font-style: italic;"&gt;meuprograma&lt;/span&gt; e dentro desta pasta eu tivesse os arquivos &lt;span style="font-style: italic;"&gt;meu_fonte.c&lt;/span&gt;, &lt;span style="font-style: italic;"&gt;meu_fonte.h&lt;/span&gt; e &lt;span style="font-style: italic;"&gt;LEIAME.TXT&lt;/span&gt;, ap&#xF3;s concluir as altera&#xE7;&#xF5;es nestes arquivos,supondo que elas tivessem ocorrido no dia 11/01/2008 &#xE0;s 09:30h, seria gerada uma c&#xF3;pia da pasta chamada &lt;span style="font-style: italic;"&gt;meuprograma_20080111_0930&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Com o passar do tempo este tipo de controle torna-se ineficiente.&lt;br /&gt;&lt;br /&gt;- Por qu&#xEA;? Porque eu n&#xE3;o conseguia saber, por exemplo, que modifica&#xE7;&#xF5;es foram feitas em que vers&#xE3;o das c&#xF3;pias. Se eu tivesse um trabalho compartilhado com um ou mais colegas, tornava-se dif&#xED;cil dividir as tarefas e depois unir os trabalhos.&lt;br /&gt;&lt;br /&gt;Procurando uma solu&#xE7;&#xE3;o para estes problemas, encontrei o CVS. Durante anos ele foi uma ferramenta indispens&#xE1;vel no meu trabalho. O CVS n&#xE3;o evolui como deveria e, com o tempo, foi substitu&#xED;do com muitas vantagens pelo &lt;a href="http://subversion.tigris.org/" &gt;Subversion&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;O Subversion, bem como o CVS e outros programas de controle de vers&#xE3;o, possuem um reposit&#xF3;rio centralizado. Isto tem inumeras vantagens.&lt;br /&gt;&lt;br /&gt;Um dia desses, meu amigo &lt;a href="http://www.caloni.com.br/blog/" &gt;Wanderley&lt;/a&gt; me falou de um sistema de controle de vers&#xF5;es (SCM) com reposit&#xF3;rio distribu&#xED;do.&lt;br /&gt;&lt;br /&gt;- Reposit&#xF3;rio distribu&#xED;do? - Perguntei espantado. - Isso deve ser uma &lt;span style="font-style: italic;"&gt;m&lt;/span&gt;...&lt;br /&gt;&lt;br /&gt;Ap&#xF3;s ouvir atentamente (mesmo achando que seria perda de tempo), mudei de id&#xE9;ia e resolvi experimentar este programa. Afinal, o Wanderley &#xE9; um programador muito experiente e n&#xE3;o iria dar seu aval para uma solu&#xE7;&#xE3;o &lt;span style="font-style: italic;"&gt;meia-boca&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;O &lt;a href="http://www.selenic.com/mercurial/wiki/" &gt;Mercurial&lt;/a&gt; (este &#xE9; o seu nome) &#xE9; um sistema de controle de vers&#xF5;es muito leve e ocupa pouco espa&#xE7;o disco.&lt;br /&gt;&lt;br /&gt;Em SCMs com reposit&#xF3;rio centralizado, todos os arquivos ficam em um &#xFA;nico local (servidor), sendo que os desenvolvedores baixam uma c&#xF3;pia dos mesmos para o seu diret&#xF3;rio de trabalho. Certamente isto n&#xE3;o &#xE9; novidade para ti.&lt;br /&gt;&lt;br /&gt;O Mercurial, por usar reposit&#xF3;rio distribu&#xED;do, n&#xE3;o possui um servidor central. Cada desenvolvedor tem ao mesmo tempo o reposit&#xF3;rio e o diret&#xF3;rio de trabalho.&lt;br /&gt;&lt;br /&gt;- N&#xE3;o parece nem seguro, nem pr&#xE1;tico. E qual a vantagem disso?&lt;br /&gt;&lt;br /&gt;&#xC9; seguro. O projeto j&#xE1; est&#xE1; bem est&#xE1;vel e a cada release v&#xE1;rios bugs s&#xE3;o corrigidos .&lt;br /&gt;&lt;br /&gt;&#xC9; pr&#xE1;tico, pois por meio de comandos simples de exporta&#xE7;&#xE3;o e importa&#xE7;&#xE3;o podemos sincronizar nosso reposit&#xF3;rio com o reposit&#xF3;rio de outros desenvolvedores.&lt;br /&gt;&lt;br /&gt;Al&#xE9;m disso, o Mercurial possui v&#xE1;rias extens&#xF5;es / contribui&#xE7;&#xF5;es da comunidade que ampliam e facilitam seu uso. Por exemplo, sua integra&#xE7;&#xE3;o com o &lt;a href="http://www.bugzilla.org/" &gt;Bugzilla&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;A vantagem de se utilizar o reposit&#xF3;rio distribuido verifica-se quando tu tens arquivos ou projetos que desenvolves na tua casa, no trabalho, nos computadores da faculdade, etc e n&#xE3;o tens como instalar o Subversion, por exemplo, para controlar a vers&#xE3;o dos mesmos (ou n&#xE3;o tens acesso &#xE0; rede).&lt;br /&gt;&lt;br /&gt;Usando o Mercurial, podes manter o controle de vers&#xF5;es onde for necess&#xE1;rio, sem problemas. N&#xE3;o &#xE9; preciso nem do acesso &#xE0; rede. &#xC9; s&#xF3; executares uma exporta&#xE7;&#xE3;o / importa&#xE7;&#xE3;o das modifica&#xE7;&#xF5;es e pronto.&lt;br /&gt;&lt;br /&gt;Isso sem abrir m&#xE3;o de controle de vers&#xF5;es, habilidade de efetuar os &lt;span style="font-style: italic;"&gt;diff&lt;/span&gt;s, ver logs, uso de tags, entre outras coisas que j&#xE1; nos acostumamos com o Subversion.&lt;br /&gt;&lt;br /&gt;J&#xE1; estou utilizando o Mercurial em 3 projetos (faz menos de um m&#xEA;s que comecei a us&#xE1;-lo) e estou completamente satisfeito.&lt;br /&gt;&lt;br /&gt;Estou pensando em traduzir para o Portugu&#xEA;s os tutorias que se encontram no site oficial como uma forma de ajudar a ampliar o seu n&#xFA;mero de usu&#xE1;rios.&lt;br /&gt;&lt;br /&gt;Se tu usas o Subversion, o CVS ou outro sistema de vers&#xF5;es, experimente o Mercurial. Com toda a certeza vais gostar muito de trabalhar com ele.&lt;br /&gt;&lt;br /&gt;E se tu ainda n&#xE3;o usas nenhum sistema destes, j&#xE1; passou da hora de come&#xE7;ares. V&#xE1; no site do &lt;a href="http://www.selenic.com/mercurial/wiki/" &gt;Mercurial&lt;/a&gt; e comece a utiliz&#xE1;-lo. Com o tutorial fornecido, em menos de 20 minutos j&#xE1; estar&#xE1;s dominando o programa.&lt;br /&gt;&lt;br /&gt;Tu n&#xE3;o vais te arrepender.&lt;img src="http://feeds.feedburner.com/~r/MarcioAndreyOliveira/~4/215692332" height="1" width="1"/&gt;</description>
    </item>
  </channel>
</rss>
