all groups > dotnet clr > september 2004 >
You're in the

dotnet clr

group:

Passing constants to functions + boxing


Passing constants to functions + boxing oleg stepanov
9/17/2004 6:37:36 AM
dotnet clr:
Hi,

I got a bit stuck with the Debug API. I have the following task: imagine there's a simple function

static object Foo( object value ) { return value; }

in debuggee process and I want to evaluate Foo(12). Can anyone tell me step by step how can I do that? Thanks!

--
Oleg Stepanov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
RE: Passing constants to functions + boxing Sabyasachi
9/19/2004 10:29:02 PM
Hi,
To debug at specified values,

1) Insert a breakpoint inside the function
2) Right Click on the line and choose Break Point Properties
3) Choose the function tab.
4) Click on Conditions
5) In the textbox write Value == 12, and click ok

This should give you the required results

[quoted text, click to view]
Re: Passing constants to functions + boxing Ravichandran J.V.
9/21/2004 4:03:35 AM
Set the Breakpoint on a statement and Step over each with the F8 key.

with regards,


J.V.Ravichandran
- http://www.geocities.com/
jvravichandran
- http://www.411asp.net/func/search?
qry=Ravichandran+J.V.&cob=aspnetpro
- http://www.southasianoutlook.com
- http://www.MSDNAA.Net
- http://www.csharphelp.com
- http://www.poetry.com/Publications/
display.asp?ID=P3966388&BN=999&PN=2
- Or, just search on "J.V.Ravichandran"
at http://www.Google.com

*** Sent via Developersdex http://www.developersdex.com ***
RE: Passing constants to functions + boxing jkeljo NO[at]SPAM online.microsoft.com (
9/21/2004 10:27:56 PM
Oleg,
Use ICorDebugEval::NewObjectNoConstructor to create a new Int32. (The
function has func-eval semantics, so you'll have to continue the process
and get the result from an EvalComplete callback.)

On the resulting ICorDebugBoxValue, call GetObject to get the
underlying integer.

On the resulting ICorDebugValue, get the ICorDebugGenericValue
interface and set the integer to 12.

Pass the ICorDebugBoxValue to ICorDebugEval::CallFunction.

Jonathan

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
| From: oleg stepanov <Oleg.Stepanov@jetbrains.com>
| Subject: Passing constants to functions + boxing
| Content-Type: text/plain; charset=koi8-ru
| Message-ID: <ehrS$tLnEHA.2948@TK2MSFTNGP11.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.clr
| Date: Fri, 17 Sep 2004 06:37:36 -0700
| NNTP-Posting-Host: gw.intellij.net 195.5.138.42
| Lines: 1
| Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGXA03.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP0
8.phx.gbl!TK2MSFTNGP11.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.clr:11840
| X-Tomcat-NG: microsoft.public.dotnet.framework.clr
|
| Hi,
|
| I got a bit stuck with the Debug API. I have the following task:
imagine there's a simple function
|
| static object Foo( object value ) { return value; }
|
| in debuggee process and I want to evaluate Foo(12). Can anyone tell me
step by step how can I do that? Thanks!
|
| --
| Oleg Stepanov
| Software Developer
| JetBrains, Inc
| http://www.jetbrains.com
| "Develop with pleasure!"
|
RE: Passing constants to functions + boxing oleg stepanov
9/22/2004 12:03:34 AM
Hello Jonathan,

Thanks! Just didn't know that Int32 object value is guaranteed a boxed value.

--
Oleg Stepanov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

[quoted text, click to view]
RE: Passing constants to functions + boxing jkeljo NO[at]SPAM online.microsoft.com (
9/22/2004 3:49:36 PM
Yep! NewObjectNoConstructor creates an object on the heap, so if it's a
value type it'll be boxed. CreateValue is used to make unboxed value types.

Jonathan

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
| From: oleg stepanov <Oleg.Stepanov@jetbrains.com>
| Subject: RE: Passing constants to functions + boxing
| References: <liZoCpCoEHA.3636@cpmsftngxa06.phx.gbl>
| Content-Type: text/plain; charset=koi8-ru
| Message-ID: <eL74HJHoEHA.608@TK2MSFTNGP09.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.clr
| Date: Wed, 22 Sep 2004 00:03:34 -0700
| NNTP-Posting-Host: gw.intellij.net 195.5.138.42
| Lines: 1
| Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGXA03.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTFEED0
1.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.clr:11872
| X-Tomcat-NG: microsoft.public.dotnet.framework.clr
|
| Hello Jonathan,
|
| Thanks! Just didn't know that Int32 object value is guaranteed a boxed
value.
|
| --
| Oleg Stepanov
| Software Developer
| JetBrains, Inc
| http://www.jetbrains.com
| "Develop with pleasure!"
|
| > Oleg,
| > Use ICorDebugEval::NewObjectNoConstructor to create a new Int32.
| > (The
| > function has func-eval semantics, so you'll have to continue the
| > process
| > and get the result from an EvalComplete callback.)
| >
| > On the resulting ICorDebugBoxValue, call GetObject to get the
| > underlying integer.
| >
| > On the resulting ICorDebugValue, get the ICorDebugGenericValue
| > interface and set the integer to 12.
| >
| > Pass the ICorDebugBoxValue to ICorDebugEval::CallFunction.
| >
| > Jonathan
| >
| > This posting is provided "AS IS" with no warranties, and confers no
| > rights.
| >
| > --------------------
| > | From: oleg stepanov <Oleg.Stepanov@jetbrains.com>
| > | Subject: Passing constants to functions + boxing
| > | Content-Type: text/plain; charset=koi8-ru
| > | Message-ID: <ehrS$tLnEHA.2948@TK2MSFTNGP11.phx.gbl>
| > | Newsgroups: microsoft.public.dotnet.framework.clr
| > | Date: Fri, 17 Sep 2004 06:37:36 -0700
| > | NNTP-Posting-Host: gw.intellij.net 195.5.138.42
| > | Lines: 1
| > | Path:
| > cpmsftngxa06.phx.gbl!TK2MSFTNGXA03.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MS
| > FTNGP0
| > 8.phx.gbl!TK2MSFTNGP11.phx.gbl
| > | Xref: cpmsftngxa06.phx.gbl
| > microsoft.public.dotnet.framework.clr:11840
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.clr
| > |
| > | Hi,
| > |
| > | I got a bit stuck with the Debug API. I have the following task:
| > imagine there's a simple function
| > |
| > | static object Foo( object value ) { return value; }
| > |
| > | in debuggee process and I want to evaluate Foo(12). Can anyone
| > tell me
| > step by step how can I do that? Thanks!
| > |
| > | --
| > | Oleg Stepanov
| > | Software Developer
| > | JetBrains, Inc
| > | http://www.jetbrains.com
| > | "Develop with pleasure!"
| > |
|
|


AddThis Social Bookmark Button