|
2 | 2 | title: "IDiaSession::findLinesByAddr | Microsoft Docs"
|
3 | 3 | ms.date: "11/04/2016"
|
4 | 4 | ms.topic: "conceptual"
|
5 |
| -dev_langs: |
| 5 | +dev_langs: |
6 | 6 | - "C++"
|
7 |
| -helpviewer_keywords: |
| 7 | +helpviewer_keywords: |
8 | 8 | - "IDiaSession::findLinesByAddr method"
|
9 | 9 | ms.assetid: 640403c0-14cf-403c-ad19-38b3bdc28ca8
|
10 | 10 | author: "mikejo5000"
|
11 | 11 | ms.author: "mikejo"
|
12 | 12 | manager: jillfra
|
13 |
| -ms.workload: |
| 13 | +ms.workload: |
14 | 14 | - "multiple"
|
15 | 15 | ---
|
16 | 16 | # IDiaSession::findLinesByAddr
|
17 |
| -Retrieves the lines in a specified compiland that contain a specified address. |
18 |
| - |
19 |
| -## Syntax |
20 |
| - |
21 |
| -```C++ |
22 |
| -HRESULT findLinesByAddr ( |
23 |
| - DWORD seg, |
24 |
| - DWORD offset, |
25 |
| - DWORD length, |
26 |
| - IDiaEnumLineNumbers** ppResult |
27 |
| -); |
28 |
| -``` |
29 |
| - |
30 |
| -#### Parameters |
31 |
| - `seg` |
32 |
| - [in] Specifies the section component of the specific address. |
33 |
| - |
34 |
| - `offset` |
35 |
| - [in] Specifies the offset component of the specific address. |
36 |
| - |
37 |
| - `length` |
38 |
| - [in] Specifies the number of bytes of address range to cover with this query. |
39 |
| - |
40 |
| - `ppResult` |
41 |
| - [out] Returns an [IDiaEnumLineNumbers](../../debugger/debug-interface-access/idiaenumlinenumbers.md) object that contains a list of all the line numbers that cover the specified address range. |
42 |
| - |
43 |
| -## Return Value |
44 |
| - If successful, returns `S_OK`; otherwise, returns an error code. |
45 |
| - |
46 |
| -## Example |
47 |
| - This example shows a function that obtains all line numbers contained in a function using the function's address and length. |
48 |
| - |
49 |
| -```C++ |
50 |
| -IDiaEnumLineNumbers* GetLineNumbersByAddr(IDiaSymbol *pFunc, |
51 |
| - IDiaSession *pSession) |
52 |
| -{ |
53 |
| - IDiaEnumLineNumbers* pEnum = NULL; |
54 |
| - DWORD seg; |
55 |
| - DWORD offset; |
56 |
| - ULONGLONG length; |
57 |
| - |
58 |
| - if (pFunc->get_addressSection ( &seg ) == S_OK && |
59 |
| - pFunc->get_addressOffset ( &offset ) == S_OK) |
60 |
| - { |
61 |
| - pFunc->get_length ( &length ); |
62 |
| - pSession->findLinesByAddr( seg, offset, static_cast<DWORD>( length ), &pEnum ); |
63 |
| - } |
64 |
| - return(pEnum); |
65 |
| -} |
66 |
| -``` |
67 |
| - |
68 |
| -## See Also |
69 |
| - [IDiaEnumLineNumbers](../../debugger/debug-interface-access/idiaenumlinenumbers.md) |
70 |
| - [IDiaSession](../../debugger/debug-interface-access/idiasession.md) |
71 |
| - [IDiaSession::findLinesByVA](../../debugger/debug-interface-access/idiasession-findlinesbyva.md) |
| 17 | +Retrieves the lines in a specified compiland that contain a specified address. |
| 18 | + |
| 19 | +## Syntax |
| 20 | + |
| 21 | +```C++ |
| 22 | +HRESULT findLinesByAddr ( |
| 23 | + DWORD seg, |
| 24 | + DWORD offset, |
| 25 | + DWORD length, |
| 26 | + IDiaEnumLineNumbers** ppResult |
| 27 | +); |
| 28 | +``` |
| 29 | + |
| 30 | +#### Parameters |
| 31 | +`seg` |
| 32 | +[in] Specifies the section component of the specific address. |
| 33 | + |
| 34 | +`offset` |
| 35 | +[in] Specifies the offset component of the specific address. |
| 36 | + |
| 37 | +`length` |
| 38 | +[in] Specifies the number of bytes of address range to cover with this query. |
| 39 | + |
| 40 | +`ppResult` |
| 41 | +[out] Returns an [IDiaEnumLineNumbers](../../debugger/debug-interface-access/idiaenumlinenumbers.md) object that contains a list of all the line numbers that cover the specified address range. |
| 42 | + |
| 43 | +## Return Value |
| 44 | +If successful, returns `S_OK`; otherwise, returns an error code. |
| 45 | + |
| 46 | +## Example |
| 47 | +This example shows a function that obtains all line numbers contained in a function using the function's address and length. |
| 48 | + |
| 49 | +```C++ |
| 50 | +IDiaEnumLineNumbers* GetLineNumbersByAddr(IDiaSymbol *pFunc, |
| 51 | + IDiaSession *pSession) |
| 52 | +{ |
| 53 | + IDiaEnumLineNumbers* pEnum = NULL; |
| 54 | + DWORD seg; |
| 55 | + DWORD offset; |
| 56 | + ULONGLONG length; |
| 57 | + |
| 58 | + if (pFunc->get_addressSection ( &seg ) == S_OK && |
| 59 | + pFunc->get_addressOffset ( &offset ) == S_OK) |
| 60 | + { |
| 61 | + pFunc->get_length ( &length ); |
| 62 | + pSession->findLinesByAddr( seg, offset, static_cast<DWORD>( length ), &pEnum ); |
| 63 | + } |
| 64 | + return(pEnum); |
| 65 | +} |
| 66 | +``` |
| 67 | +
|
| 68 | +## See Also |
| 69 | +[IDiaEnumLineNumbers](../../debugger/debug-interface-access/idiaenumlinenumbers.md) |
| 70 | +[IDiaSession](../../debugger/debug-interface-access/idiasession.md) |
| 71 | +[IDiaSession::findLinesByVA](../../debugger/debug-interface-access/idiasession-findlinesbyva.md) |
0 commit comments