Sysop: | Amessyroom |
---|---|
Location: | Fayetteville, NC |
Users: | 27 |
Nodes: | 6 (0 / 6) |
Uptime: | 38:51:35 |
Calls: | 631 |
Calls today: | 2 |
Files: | 1,187 |
D/L today: |
23 files (29,781K bytes) |
Messages: | 174,060 |
Anybody got a description of cma$tis_errno_get_addr?
Arne
On 9/15/2025 9:20 PM, Arne Vajh|+j wrote:
Anybody got a description of cma$tis_errno_get_addr?
Returns the address of the thread's errno
On 9/15/2025 9:49 PM, John Reagan wrote:
On 9/15/2025 9:20 PM, Arne Vajh|+j wrote:
Anybody got a description of cma$tis_errno_get_addr?
Returns the address of the thread's errno
That was what I expected.
But I am having problems.
It actually works in C.
But when I call it in Pascal, then I get the correct
address but the value at the address is not correct.
On 9/15/2025 10:15 PM, Arne Vajh|+j wrote:
On 9/15/2025 9:49 PM, John Reagan wrote:
On 9/15/2025 9:20 PM, Arne Vajh|+j wrote:
Anybody got a description of cma$tis_errno_get_addr?
Returns the address of the thread's errno
That was what I expected.
But I am having problems.
It actually works in C.
But when I call it in Pascal, then I get the correct
address but the value at the address is not correct.
Calling decc$crtl_init does not solve the problem.
On 9/15/25 9:16 PM, Arne Vajh|+j wrote:
On 9/15/2025 10:15 PM, Arne Vajh|+j wrote:Never tried it from Pascal.-a Since errno is a CRTL thing, it's not clear
On 9/15/2025 9:49 PM, John Reagan wrote:
On 9/15/2025 9:20 PM, Arne Vajh|+j wrote:
Anybody got a description of cma$tis_errno_get_addr?
Returns the address of the thread's errno
That was what I expected.
But I am having problems.
It actually works in C.
But when I call it in Pascal, then I get the correct
address but the value at the address is not correct.
Calling decc$crtl_init does not solve the problem.
to me that it makes any sense to do so, but if you're trying to debug a library called from the Pascal code, maybe.
-a In any case the following
are the notes I made for myself a long time ago:
Get errno from VMS debugger:
set image CMA$TIS_SHR
set radix hexadecimal
call CMA$TIS_ERRNO_GET_ADDR
!
! The above returns an address
!
examine/long/decimal <cut'n paste the address>
!
! The above returns errno content.
! If errno content is 65535 (EVMSERR == 65535)
! continue your debugging session with right below
!
call CMA$TIS_VMSERRNO_GET_ADDR
!
! The above returns an address
!
examine/condition <cut'n paste the returned address>
On 9/15/2025 10:39 PM, Craig A. Berry wrote:
call CMA$TIS_VMSERRNO_GET_ADDR
!
! The above returns an address
!
examine/condition <cut'n paste the returned address>
Interesting.
The value I see is indeed 65535.
One question answered, but two new questions pop up.
1) How does the C++ library know that the main program
-a-a is Pascal and not C (for C I get a normal errno value)?
2) The address returned by CMA$TIS_VMSERRNO_GET_ADDR
-a-a point to another mysterious value not matching anything.
On 9/15/25 9:56 PM, Arne Vajh|+j wrote:
On 9/15/2025 10:39 PM, Craig A. Berry wrote:
call CMA$TIS_VMSERRNO_GET_ADDR
!
! The above returns an address
!
examine/condition <cut'n paste the returned address>
Interesting.
The value I see is indeed 65535.
One question answered, but two new questions pop up.
1) How does the C++ library know that the main program
-a-a-a is Pascal and not C (for C I get a normal errno value)?
On #1, remember that the value of errno doesn't mean anything except immediately after the error, so if C is successful but Pascal is not,
the fact that you get different errno values doesn't really tell you anything.-a If there is an error from both languages, then it does sound
like something is different about the initialization of the image or the debugger session.-a Since the debugger does have language-specific
features, it may be a more likely suspect.
On 9/16/2025 7:31 AM, Craig A. Berry wrote:
On 9/15/25 9:56 PM, Arne Vajh|+j wrote:
On 9/15/2025 10:39 PM, Craig A. Berry wrote:
call CMA$TIS_VMSERRNO_GET_ADDR
!
! The above returns an address
!
examine/condition <cut'n paste the returned address>
Interesting.
The value I see is indeed 65535.
One question answered, but two new questions pop up.
1) How does the C++ library know that the main program
-a-a-a is Pascal and not C (for C I get a normal errno value)?
On #1, remember that the value of errno doesn't mean anything except
immediately after the error, so if C is successful but Pascal is not,
the fact that you get different errno values doesn't really tell you
anything.-a If there is an error from both languages, then it does sound
like something is different about the initialization of the image or the
debugger session.-a Since the debugger does have language-specific
features, it may be a more likely suspect.
It is a about this.
Trying a gazillion things has let me to conclude that
C free sets errno when called on something allocated
with Pascal malloc_c_str.
Not yet clear to me why it does that. But I will find
a way to workaround it.
On 9/17/2025 9:13 PM, Arne Vajh|+j wrote:
On 9/16/2025 7:31 AM, Craig A. Berry wrote:
On 9/15/25 9:56 PM, Arne Vajh|+j wrote:
On 9/15/2025 10:39 PM, Craig A. Berry wrote:
call CMA$TIS_VMSERRNO_GET_ADDR
!
! The above returns an address
!
examine/condition <cut'n paste the returned address>
Interesting.
The value I see is indeed 65535.
One question answered, but two new questions pop up.
1) How does the C++ library know that the main program
-a-a-a is Pascal and not C (for C I get a normal errno value)?
On #1, remember that the value of errno doesn't mean anything except
immediately after the error, so if C is successful but Pascal is not,
the fact that you get different errno values doesn't really tell you
anything.-a If there is an error from both languages, then it does sound >>> like something is different about the initialization of the image or the >>> debugger session.-a Since the debugger does have language-specific
features, it may be a more likely suspect.
It is a about this.
Trying a gazillion things has let me to conclude that
C free sets errno when called on something allocated
with Pascal malloc_c_str.
Not yet clear to me why it does that. But I will find
a way to workaround it.
And in case mr. Reagan wants to take a look:
Documentation state:
<quote>
The memory allocated with MALLOC_C_STR must be deallocated with
the C free() routine.
</quote>
But:
$ type re.pas
program re(input,output);
[external('decc$free')]
procedure free_c_str(ptr : c_str_t); external;