Skip to main content

Posts

Showing posts from September, 2013

Create cdb file using perl

To create cdb file in perl is quite easy when you have the hash ready. See example below. #!/usr/bin/perl use strict; use CDB_File; my %t = ( 'a' =>'apple', 'b' => 'banana', ); CDB_File::create %t, "<cdb file name>", "<temporary file name>"; If you have the key-value pairs in a file, you can parse through it and insert into the cdb by getting the hash ready, or by the pairs. Say your data file contain this. a,apple b,banana Perl code for getting this flat file data into cdb : #!/usr/bin/perl use strict; use CDB_File; my $cdb = new CDB_File("<cdb file name>", "<temporary file name>"); open (DATA, "<data file name>"); while (<DATA>) { chomp(); my @data = split /,/; $cdb->insert($data[0],$data[1]); } $cdb->finish;

Something about object files

This is from a long lost track. I used to deal with object files in my previous job. That was like ages ago. Is VCS still compiling the design into object files to run simulation? Anyway, thanks to Synopsys team that helped me a lot in improving my debugging skills. :) Some simple steps to create a "test case" here. Let's create a "Hello world!" object file. #include <stdio.h> void main() {     printf("Hello world!\n"); } Compile into object file. gcc < source code file name > -o < object file name > To enable debug mode, compile with -g option. With debug mode, you can set break point when running the program in gdb. OK, back to the story. These are a few commands that they taught me to investigate about the object files. To get the list of the functions in the object file. strings < object file > This one is not obvious in my test case. The strings command actually listed all the strings in the o...