Hello Monks,
please share me your wisdom for this case:
I have to write a script which is checking a given
function call sequence like "FunctionZ", "FunctionY",...
against a call stack trace in following textual format:
State: time: memory: Name:
ENTRY: 0.000 0x004e2aa8 FunctionA()
EXIT: 0.000 0x004e2aa8 FunctionA()
ENTRY: 0.000 0x004e3ac8 InitSomething()
ENTRY: 0.000 0x0045760c FunctionZ()
ENTRY: 0.000 0x00455fbd FunctionY()
EXIT: 0.000 0x00455fbd FunctionY()
EXIT: 0.000 0x0045760c FunctionZ()
EXIT: 0.000 0x004e3ac8 InitSomething()
So given the sequence "FunctionZ", "FunctionY" should return true and the sequence "FunctionY", "FunctionZ" should return false.
My Problem is, i am not sure what's the best way for implementing this. I have several ideas.
The basis of all ideas is that i read-in the given c-call-stack trace completely and create a data-structure.
This data-structure could be:
#1 A Hash, where all subsequent functioncalls are listed
$->{InitSomething}{FunctionZ}{FunctionY}
Problem here:
when i have several calls to "InitSomething" with different subsequent function-calls I have to create additionally arrays for each hash item
Data will be doubled, each subsequent function call could be the root of the sequence requested to be matched, thus i have to create a hash item for each sub function call.. i feel by doing this i will end up in hell
2# represent each "ENTRY" sequence in the stack trace as a string. Putting this string in a Hash and check the requested sequence if it is available in the hash.
Problem here, only a small subset of function could be requested and then it is not working.
3# Just like 2# but putting all in an array and do a reg-expression withe the requested sequence for each item.
Problem here: It might be that the sequence wont be matched due to missing function names.
4# Making a kind of Linked list for each function call where the root-function-call is placed into an hash. Then we search for the sequence in the list.
Problem: I cannot install in perl the lib for linked lists as i do not have the perl maintenance rights thus i have to create them by myself, not really tricky but also here i fell to end up in hell..
Maybe someone had a similar problem solved more elegant than my proposals - i hope so!
Any help is highly welcome!
Best regards Tobias
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.