AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.


#Power
#Power
#Operatingsystems
#Servers
 View Only
  • 1.  About C-language test In AIX , at debugging errno be

    Posted 12/06/07 07:32 PM

    Originally posted by: SystemAdmin


    When I debug C-language in AIX system and use dbx command to debug it, I attent to execute the follow sentence:
    (dbx) assign errno = 1
    but system prints an error message:
    incompatible types
    I don't know what the problem is,probably in the status of debugging the variable of errno coundn't be changed value or other causes.
    Please tell me, thank you!
    #AIX-Forum


  • 2.  Re: About C-language test In AIX , at debugging errno be

    Posted 12/08/07 01:39 PM

    Originally posted by: nagger


    OK I have the same issue - I think it is because errno is actually defined in the C runtime environment and not really in your program but we can access errno via address as below:

    (dbx) print errno
    0

    (dbx) type errno
    &errno = 0x2ff22ff8
    (dbx) assign 0x2ff22ff8 = 1

    (dbx) print errno
    1

    Hope that elps, N
    #AIX-Forum


  • 3.  Re: About C-language test In AIX , at debugging errno be

    Posted 12/09/07 11:43 PM

    Originally posted by: SystemAdmin


    Thank you very much!
    I have practised your method and succeeded.
    Thank you!
    This forum is very good and there are many experts in every fields. Their technic is
    perfect and they are enthusiasm.
    Since I have some difficout question I will be here to appear. If I know which somebody needs I can try my best!
    #AIX-Forum


  • 4.  Re: About C-language test In AIX , at debugging errno be

    Posted 12/09/07 11:44 PM

    Originally posted by: SystemAdmin


    Thank you very much!
    I have practised your method and succeeded.
    Thank you!
    This forum is very good and there are many experts in every fields. Their technic is
    perfect and they are enthusiasm.
    Since I have some difficout question I will be here to appear. If I know which somebody needs I can try my best!
    #AIX-Forum


  • 5.  Re: About C-language test In AIX , at debugging errno be

    Posted 12/10/07 02:54 AM
      |   view attached

    Originally posted by: SystemAdmin


    I'm be very appreciated for your help.
    I practised a function named "int main()" using your method, and it is successful.
    But, now I changed the function' name to any other such as "int Test()", using the "int main()" function called it. I also used your method:
    1)(dbx) type errno
    &errno = 0x2ff22ff8
    2)(dbx) assign 0x2ff22ff8 = 1
    3)(dbx) print errno
    1
    errno's value is actually 1, but I go on debugging
    4))(dbx) n
    the program didn't execute according to my imagine and I an other time to print the value of errno, I finded that it was 0, I didn't know why its value coundn't be really changed?
    5) (dbx) print errno
    0
    please help me!

    If you can use Attach Files to test it I can't be thankful enough to
    #AIX-Forum

    Attachment(s)



  • 6.  Re: About C-language test In AIX , at debugging errno be

    Posted 12/27/07 10:44 AM

    Originally posted by: dickdunbar


    One thing you might try is to get a compiler listing.
    errno is a global value in a non-threaded program,
    because there is normally only one system call which
    manipulates it.

    In a threaded program, where there can be multiple system calls
    being executed from different threads, errno has to change.

    It is the compiler that changes this. Compare test.lst
    files created with these two commands:

    xlc -qsource test.c # non-threaded
    xlc_r -qsource test.c # threaded

    The threaded listing will show what errno gets expanded to; eg.,

    11 | if(errno) {
    11 + if((*_Errno())) {

    The source "errno" was converted (by the header file) to
    a function call ... which retrieves the thread specific errno.
    #AIX-Forum