This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Setting a variable is very slow.


Hi,

I  need to set a number of variables to certain values and then make a
call to a procedure which takes those variables as inputs. Then I have
to  set the same set of variables to different values and make another
call the procedure. And so on, and so on... .

For example:

   Run1:
   (gdb) set ({Rec} 0xABCDEF00).a := false
   (gdb) set ({Rec} 0xABCDEF00).b := 55
   (gdb) set x := 7.52
   (gdb) set y := 725
   (gdb) call  myProcedure()    //  The body of this procedure uses the
                                //  vars which have been set above. (e.g.
                                //  those  vars are member variables of a
                                //  class  which  this procedure belongs
                                //  to).

   Run2:
   (gdb) set ({Rec} 0xABCDEF00).a := true
   (gdb) set ({Rec} 0xABCDEF00).b := 56
   (gdb) set x := -7.52
   (gdb) set y := 125
   (gdb) call myProcedure()

...
   Run1252:
   (gdb) set....
etc.

I  need to make hundreds of such assignments & calls. The problem is -
setting  a  single  variable is very slow (in most cases it takes much
more  time  to set a single variable than to call a procedure, even if
the procedure is not very simple).

Any ideas why this is the case?

*More  importantly*:
===> Is there any way to make the assignments work faster? <===

E.g.  by  telling  gdb  to cache the address of a symbol (variable) so
that everytime the symbol is being set gdb does not have to go through
the  symbol  table  to  obtain  the address (in case that would be the
reason why assignments are very slow).


Anyone has any ideas please?

See also my notes below.

Note1:  I'm working with quite big executable (which contains thousands of
other symbols / procedures).

Note2: I  already  tried  running  the  gdb session in the GDB/MI
interface  mode  and setting the variables with appropriate MI command
e.g.
   (gdb)
   -gdb-set x := -7.52
but  it  doesn't seem to make any effect on the speed of the execution
of the assignment command.

Many thanks,
Jan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]