clean_call - segmentation fault

65 views
Skip to first unread message

Etem

unread,
Apr 13, 2012, 2:18:42 PM4/13/12
to DynamoRIO Users
Hello,

I am trying to call my own fucntion for each read operations. For each
read operation instrument_memory_read function is called and I can do
my work with calling my function at the end of instrument_memory_read
function. What I did is adding a clean call at the end of
instrument_memory_read function and doing my work in my new function.
When I run this client on bodytrack benchmark from Parsec I got some
different error. Errors that I got are “Segmentation fault”, and
“<Application bodytrack (3620). Basic block or trace instrumentation
exceeded maximum size. Try lowering -max_bb_instrs and/or -
max_trace_bbs.>”. Here is the parameters that I used when I am running
the client: “/home/etem/TOOLS/dynamorio/build/bin64/drrun -ops "-
thread_private -max_bb_instrs 512 -no_finite_bb_cache -
no_finite_trace_cache" -client /home/etem/TOOLS/umbra/build/bin/
libtcd.so 0 "" /home/etem/DATA/parsec-2.1/bin/../pkgs/apps/bodytrack/
inst/amd64-linux.gcc.pre/bin/bodytrack /home/etem/DATA/parsec-2.1/pkgs/
apps/bodytrack/inputs/sequenceB_2 4 2 2000 5 0 8”

I am not sure if there is a problem with my code or there is a problem
with umbra.
Thanks.

Best regards,
Etem


static void dumpDependency(client_tls_data_t *tls_data, reg_t
depCounter) {
//DO MY WORK
return;
}

static void
instrument_memory_read(void *drcontext,
umbra_info_t *umbra_info,
mem_ref_t *ref,
instrlist_t *ilist,
instr_t *where)
{
instr_t *instr, *label;
opnd_t opnd1, opnd2;
reg_id_t reg = umbra_info->steal_regs[0];
client_tls_data_t *tls_data;

tls_data = umbra_info->client_tls_data;

....
....

/* inc */
opnd1 = opnd_create_base_disp(DR_REG_NULL, reg, 8,
(reg_t)tls_data->counter,
OPSZ_8);
instr = INSTR_CREATE_inc(drcontext, opnd1);
instrlist_meta_preinsert(ilist, label, instr);

...
...

/* my new code: call dump dependency */
dr_insert_clean_call(drcontext, ilist, instr,
(void *)dumpDependency, false /* save fpstate */, 2,
OPND_CREATE_INTPTR(tls_data),
opnd_create_base_disp(DR_REG_NULL, reg, 8,
(reg_t)tls_data->counter,
OPSZ_8));
}

Reid Kleckner

unread,
Apr 13, 2012, 3:59:49 PM4/13/12
to dynamor...@googlegroups.com
Try lowering -max_bb_instrs even more, clean calls insert ~64 large instructions per basic block, which can easily overflow the max fragment size, especially if you do it once per application memory access.

Reid


--
You received this message because you are subscribed to the Google Groups "DynamoRIO Users" group.
To post to this group, send email to dynamor...@googlegroups.com.
To unsubscribe from this group, send email to dynamorio-use...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/dynamorio-users?hl=en.


Reid Kleckner

unread,
Apr 13, 2012, 4:00:46 PM4/13/12
to dynamor...@googlegroups.com
Not per basic block, I meant per call site.  It's worth looking at the generated code, it's very, very large.

Reid
Message has been deleted

Etem

unread,
Apr 14, 2012, 5:40:40 PM4/14/12
to DynamoRIO Users
I think using lean procedure call can reduce number of the
instrcutions.
Is it rigth?
But I am not familiar with lean procedure calls in DR
so what should I use insted of the following code for doing lean
procedure call?
/* my new code: call dump dependency */
dr_insert_clean_call(drcontext, ilist, instr,
(void *)dumpDependency, false /* save fpstate */, 2,
OPND_CREATE_INTPTR(tls_data),
opnd_create_base_disp(DR_REG_NULL, reg, 8,
(reg_t)tls_data->counter,
OPSZ_8));

Etem

On 13 Nisan, 23:00, Reid Kleckner <r...@google.com> wrote:
> Not per basic block, I meant per call site.  It's worth looking at the
> generated code, it's very, very large.
>
> Reid
>
>
>
>
>
>
>
> On Fri, Apr 13, 2012 at 3:59 PM, Reid Kleckner <r...@google.com> wrote:
> > Try lowering -max_bb_instrs even more, clean calls insert ~64 large
> > instructions per basic block, which can easily overflow the max fragment
> > size, especially if you do it once per application memory access.
>
> > Reid
>

Qin Zhao

unread,
Apr 15, 2012, 11:35:46 AM4/15/12
to dynamor...@googlegroups.com
lean procedure won't really reduce the total number of instruction executed, but increase a bit.
It is used to reduce the instrumented code size in code cache by sharing some commonly used code like context switch for clean call. 

Qin
--
Interested in Yoga? Be careful of The Yoga Cult or The Scary Yoga Obsession.
More information from  Lorie Anderson and Rick Ross.

Derek Bruening

unread,
Apr 15, 2012, 12:48:17 PM4/15/12
to dynamor...@googlegroups.com
If you are running debug build and not seeing the assert about "exceeded maximum size" anymore then you have solved that problem and size is not the issue.  You need to use a debugger plus perhaps DR debug logs to figure out what's causing the seg fault.  See http://code.google.com/p/dynamorio/wiki/Debugging

- Derek

On Sat, Apr 14, 2012 at 5:40 PM, Etem <etemd...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages