Saturday, November 26, 2011

Life is Worth Living, CD 11 order of mp3

Something out of the ordinary of this blog...
The "Life is Worth Living, CD 11" has incorrect mp3 order (sequence.)
Just in case someone decided to look for proper here is the correct one:

  1. Life is worth livingk (0).mp3
  2. Life is worth livingk (2).mp3
  3. Life is worth livingk (b14).mp3
  4. Life is worth livingk (3).mp3
  5. Life is worth livingk (b12).mp3
  6. Life is worth livingk (b13).mp3
  7. Life is worth livingk (4).mp3
  8. Life is worth livingk (5).mp3
  9. Life is worth livingk (6).mp3
  10. Life is worth livingk (7).mp3
  11. Life is worth livingk (1).mp3
  12. Life is worth livingk (8).mp3
  13. Life is worth livingk (9).mp3
  14. Life is worth livingk (b10).mp3
  15. Life is worth livingk (b11).mp3

Friday, September 16, 2011

GDB - Accessing deque and queue


In O1 mode some of the functions are optimized out and it is impossible to call them.
In case of deque and queue (which is build over deque) it is a bummer for the size() method is calculated.

After finding some examples on the Internet we found nothing usable (I guess because our gcc was using different deque memory structure.)

So we created a new version.

pdequeue_info variable
- Shows size, first, and last element

pdequeue variable [firstidx [lastidx]]
- Shows contents or a range.

define pdequeue_info
 set $var=($arg0)
 set $sizeof=sizeof( **$var._M_impl._M_start._M_node )
 set $size=$sizeof < 512 ? ( 512 / $sizeof ) : 1
 set $i=0
 while $i < $var._M_impl._M_map_size && $var._M_impl._M_map[ $i ] == 0
  set $i++
 end
 set $rv = 0
 while $i < $var._M_impl._M_map_size && $var._M_impl._M_map[ $i ] != $var._M_impl._M_finish._M_first
  set $rv += $size
  set $i++
 end
 if $var._M_impl._M_map[ $i ] != 0
  set $rv += $var._M_impl._M_finish._M_cur - $var._M_impl._M_finish._M_first
 end
 printf "size  : "
 p $rv
 if $rv > 0
  printf "first : "
  p *$var._M_impl._M_start._M_cur
  if $rv > 1
   printf "last  : "
   p *( $var._M_impl._M_finish._M_cur - 1 )
  end
 end
end

define __pdeque_show_group
 set $cur=($arg0)
 set $size=($arg1)
 set $f=($arg2)
 set $l=($arg3)
 set $j=0
 while $j < $size && $n <= $l
  if $n >= $f
    printf "[%i] : ", $n
    p *$cur
  end
  set $cur++
  set $j++
  set $n++
 end
end
define pdequeue
 set $var=($arg0)
 set $f=-1
 set $l=9999999999
 if $argc == 2
  set $f=($arg1)
  set $l=$f
 end
 if $argc == 3
  set $f=($arg1)
  set $l=($arg2)
 end
 set $sizeof=sizeof( **$var._M_impl._M_start._M_node )
 set $size=$sizeof < 512 ? ( 512 / $sizeof ) : 1
 set $i=0
 while $i < $var._M_impl._M_map_size && $var._M_impl._M_map[ $i ] == 0
  set $i++
 end
 set $n=0
 while $i < $var._M_impl._M_map_size && $var._M_impl._M_map[ $i ] != $var._M_impl._M_finish._M_first && $n <= $l
  __pdeque_show_group $var._M_impl._M_map[$i] $size $f $l
  set $i++
 end
 if $var._M_impl._M_map[ $i ] != 0 && $n <= $l
  __pdeque_show_group $var._M_impl._M_map[$i] $var._M_impl._M_finish._M_cur-$var._M_impl._M_finish._M_first $f $l
 end
end

Wednesday, June 15, 2011

valgrind - dowloading, building and installing

First, I need to post all the links that will allow you to get to the creators information:

* WWW: http://valgrind.org
* Manual: http://valgrind.org/docs/manual/valgrind_manual.pdf
* Source: http://valgrind.org/downloads
* Building Instruction: http://valgrind.org/docs/manual/dist.readme.html

Building
* Download the source and put into your home account. Let's assume it is the valgrind-3.6.1 version.
Run these commands:

vver=valgrind-3.6.1
tar xf $vver.tar.bz2
cd $vver
ulimit -u 100 # ./configure has a bug ...
./configure --prefix=$HOME/valgrind # You need that in order to run make install without root privileges
make
make install
cd $HOME/valgrind/bin
./valgrind ls -l # see if it bombs out. If it does not you are good to go


Now, what you have is a $HOME/valgrind directory. If this is place where you want to use it then you are ready. The only one thing you need to do is set your path: export PATH=$HOME/valgrind/bin:$PATH

Ok... and what about if you need this valgrind now on a machine that does not have gcc?
The only thing you need to do is to pack the whole $HOME/valgrind directory, and copy it over to the destination machine.
The only caveat is that it has to be put into exactly the same directory as it was built in or else you will see this nice message:
valgrind: failed to start tool 'memcheck' for platform 'amd64-linux': No such file or directory

Solution - ln -s $HOME/valgrind path-to-valgrind-on-the-build-machine
Example: ln -s $HOME/valgrind /home/myhome/valgrind