visual c++ debug dinamic objects

Discussion in 'C++' started by gp, Sep 14, 2005.

  1. gp

    gp Guest

    Hi all,

    I'm using Microsoft Visual C++ 6.0,
    I would like to see, debugging my project, all the elements of my dinamic
    objects....

    I have a dinamic array and a STL vector and I need to know the fields values
    at a specific position, but in the Watch windows I can only see the first
    element...

    I tried putting in the watch window
    vector_name
    vector_name[k]
    vector_name[5]
    vector_name.at(k)
    vector_name.at(5)
    vector_name[5].field_name
    ....
    etc....

    but there's no way...

    could anyone help me?
    thanks...
     
    gp, Sep 14, 2005
    #1
    1. Advertising

  2. gp

    mlimber Guest

    gp wrote:
    > Hi all,
    >
    > I'm using Microsoft Visual C++ 6.0,
    > I would like to see, debugging my project, all the elements of my dinamic
    > objects....
    >
    > I have a dinamic array and a STL vector and I need to know the fields values
    > at a specific position, but in the Watch windows I can only see the first
    > element...
    >
    > I tried putting in the watch window
    > vector_name
    > vector_name[k]
    > vector_name[5]
    > vector_name.at(k)
    > vector_name.at(5)
    > vector_name[5].field_name
    > ...
    > etc....
    >
    > but there's no way...
    >
    > could anyone help me?
    > thanks...


    You'll have to dig into the implementation of their std::vector, but I
    think it should be something like this:

    *(vector_name._First+k)

    Cheers! --M
     
    mlimber, Sep 14, 2005
    #2
    1. Advertising

  3. gp

    Anand Guest

    gp wrote:
    > Hi all,
    >
    > I'm using Microsoft Visual C++ 6.0,
    > I would like to see, debugging my project, all the elements of my dinamic
    > objects....
    >
    > I have a dinamic array and a STL vector and I need to know the fields values
    > at a specific position, but in the Watch windows I can only see the first
    > element...
    >
    > I tried putting in the watch window
    > vector_name
    > vector_name[k]
    > vector_name[5]
    > vector_name.at(k)
    > vector_name.at(5)
    > vector_name[5].field_name
    > ...
    > etc....
    >
    > but there's no way...
    >
    > could anyone help me?
    > thanks...
    >
    >


    <OT newgroups-to-try-in="*microsoft.vc*">
    http://www.codeguru.com/Cpp/V-S/tips/article.php/c465/
    </OT>
     
    Anand, Sep 14, 2005
    #3
  4. mlimber wrote:
    > gp wrote:
    >
    >>Hi all,
    >>
    >>I'm using Microsoft Visual C++ 6.0,
    >>I would like to see, debugging my project, all the elements of my dinamic
    >>objects....
    >>
    >>I have a dinamic array and a STL vector and I need to know the fields values
    >>at a specific position, but in the Watch windows I can only see the first
    >>element...
    >>
    >>I tried putting in the watch window
    >>vector_name
    >>vector_name[k]
    >>vector_name[5]
    >>vector_name.at(k)
    >>vector_name.at(5)
    >>vector_name[5].field_name
    >>...
    >>etc....
    >>
    >>but there's no way...
    >>
    >>could anyone help me?
    >>thanks...

    >
    >
    > You'll have to dig into the implementation of their std::vector, but I
    > think it should be something like this:
    >
    > *(vector_name._First+k)


    OT, but try:

    (vector_name)._First,N

    where N is the number of elements you think exist in 'vector_name'
    (and yes, it is a comma)

    /S.
     
    =?ISO-8859-1?Q?Stefan_N=E4we?=, Sep 14, 2005
    #4
  5. gp

    gp Guest

    thanks!
    (vector_name)._First,N works well with vectors!

    do you know how can make the same thing with a dinamic classic array?
    (i have a function which takes as parameter "array[]" and I would like to
    know every array element...)




    "Stefan Näwe" <> ha scritto nel messaggio
    news:...
    > mlimber wrote:
    >> gp wrote:
    >>
    >>>Hi all,
    >>>
    >>>I'm using Microsoft Visual C++ 6.0,
    >>>I would like to see, debugging my project, all the elements of my dinamic
    >>>objects....
    >>>
    >>>I have a dinamic array and a STL vector and I need to know the fields
    >>>values
    >>>at a specific position, but in the Watch windows I can only see the first
    >>>element...
    >>>
    >>>I tried putting in the watch window
    >>>vector_name
    >>>vector_name[k]
    >>>vector_name[5]
    >>>vector_name.at(k)
    >>>vector_name.at(5)
    >>>vector_name[5].field_name
    >>>...
    >>>etc....
    >>>
    >>>but there's no way...
    >>>
    >>>could anyone help me?
    >>>thanks...

    >>
    >>
    >> You'll have to dig into the implementation of their std::vector, but I
    >> think it should be something like this:
    >>
    >> *(vector_name._First+k)

    >
    > OT, but try:
    >
    > (vector_name)._First,N
    >
    > where N is the number of elements you think exist in 'vector_name'
    > (and yes, it is a comma)
    >
    > /S.
     
    gp, Sep 14, 2005
    #5
  6. gp

    mlimber Guest

    gp wrote:
    > thanks!
    > (vector_name)._First,N works well with vectors!
    >
    > do you know how can make the same thing with a dinamic classic array?
    > (i have a function which takes as parameter "array[]" and I would like to
    > know every array element...)


    array[5]
    *(array+5)

    Both should work. The trick here is that for std::vector, the []
    operator is actually an implicit function call. For "classic" arrays,
    the [] operator should work as usual in any debugger worth its salt.

    Cheers! --M
     
    mlimber, Sep 14, 2005
    #6
  7. gp wrote:
    > thanks!
    > (vector_name)._First,N works well with vectors!
    >
    > do you know how can make the same thing with a dinamic classic array?
    > (i have a function which takes as parameter "array[]" and I would like to
    > know every array element...)
    >


    It's the same trick

    array,N

    The comma is the key.

    john
     
    John Harrison, Sep 14, 2005
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alessandro

    Problems with Dinamic controls

    Alessandro, Jul 16, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    428
    Cristian Suazo
    Jul 16, 2003
  2. Damir

    Dinamic images

    Damir, May 6, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    394
    Damir
    May 6, 2005
  3. whois
    Replies:
    12
    Views:
    602
    Roedy Green
    Jun 22, 2004
  4. Novello

    dinamic classloader?

    Novello, Jul 1, 2005, in forum: Java
    Replies:
    3
    Views:
    355
    Chris Smith
    Jul 1, 2005
  5. Roberto Dias
    Replies:
    1
    Views:
    759
    Paolo Alexis Falcone
    Jun 30, 2004
Loading...

Share This Page