To print the unmatched line into a new file

R

rami

hi,

i am having a text file having these lines in it.I want to display
those lines in which memory has been allocated successfully for the
addresses and for which there is no matching free.
like below, address 20b20 of size 20 has no matching free like others,i
want to display this address and size with the stack trace(below of
every line cont malloc and free indicating which function it is
called).i need a perl script to do it as i m new to perl.


malloced successfully with address : 20b20 and size 20

libc.so.1`malloc+0x6c
a.out`f1+0x8
a.out`main+0x14
a.out`_start+0x5c
malloced successfully with address : 20b40 and size 20

libc.so.1`malloc+0x6c
a.out`f2+0x8
a.out`main+0x1c
a.out`_start+0x5c
freeing successfully with address : 20b40 size=20

libc.so.1`free
a.out`f2+0x38
a.out`main+0x1c
a.out`_start+0x5c
malloced successfully with address : 21328 and size 10

libc.so.1`malloc+0x6c
a.out`f3+0x8
a.out`main+0x24
a.out`_start+0x5c
freeing successfully with address: : 21328 size=10

libc.so.1`free
a.out`f3+0x38
a.out`main+0x24
a.out`_start+0x5c
_______________________________________________
 
U

usenet

rami said:
i need a perl script to do it as i m new to perl.

Hello, and welcome to Perl and to this newsgroup, CLPMisc.

Since you are new here, you probably do not realize that this group is
not (usually) a place to ask others to write programs for you. The
regular visitors in this forum are interested in helping people learn
and perfect their Perl skills, and are willing to provide help in that
regard.

If you are interested in learning how to program in Perl then folks
here will be happy to help you. First, of course, you should take some
initative to use existing resources, such as http://learn.perl.org.
Then you should read the Perl FAQ, and last BUT NOT LEAST you should
familarize yourself with the community posting guidelines for this
newsgroup, which can be found at:

http://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html

If you post a quesion WHICH CONFORM TO THESE GUIDELINES you are almost
assured of getting prompt, courteous, and expert assistance.

If, however, you are not interested in learning Perl but only want
someone to write you a program then you may have better luck finding
someone at jobs.perl.org.
 
T

Tad McClellan

rami said:
i am having a text file having these lines in it.I want to display
those lines in which memory has been allocated successfully for the
addresses


Enter the address in a hash when you find a successful malloc.

and for which there is no matching free.


delete() it from the hash when you find a successful free.

Anything left in the hash after processing all of the data
is a leak to report.

like below, address 20b20 of size 20 has no matching free like others,i
want to display this address and size with the stack trace(below of
every line cont malloc and free indicating which function it is
called).


Did you mean to ask a question?

What part are you stuck on?

i need a perl script to do it as i m new to perl.


Either learn enough Perl to write your script yourself, or
hire someone to write it for you.

If you choose the former, then ask here for help when you get stuck.

freeing successfully with address : 20b40 size=20
^^^
^^^ one space

freeing successfully with address: : 21328 size=10
^^^^
^^^^ two spaces

Is this your real data?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,184
Messages
2,570,979
Members
47,578
Latest member
LC_06

Latest Threads

Top