Professional Web Applications Themes

How to debug the library code? - UNIX Programming

Hi all, I am getting some errors when i linked my program with library which may be either static or shared. Since library contains only object modules and source code of object modules are not available. How to debug the library? -- Ganesh...

  1. #1

    Default How to debug the library code?

    Hi all,
    I am getting some errors when i linked my program with library
    which may be either static or shared. Since library contains only object
    modules and source code of object modules are not available.
    How to debug the library?

    --
    Ganesh

    Ganesh Guest

  2. #2

    Default Re: How to debug the library code?

    In article <com>, Ganesh Kundapur wrote: 


    Have you considered the posibility that the error is in your own code?


    --
    Andreas Kähäri
    Andreas Guest

  3. #3

    Default Re: How to debug the library code?

    Andreas Kahari <ak+org> writes:
     
    >
    >
    > Have you considered the posibility that the error is in your own code?[/ref]

    That's not the point.

    The problem with closed source libraries is that the doentation of
    the API is never complete enough or precise enough to let you yse
    your source to find the problem.

    If you had the source of the library, you could pinpoint where the bug
    occur, and deduce where the data that provoked the bug comes from and
    then perhaps have an opportunity to correct your code providing this
    data.


    --
    __Pascal_Bourguignon__
    http://www.informatimago.com/
    Do not adjust your mind, there is a fault in reality.
    Pascal Guest

  4. #4

    Default Re: How to debug the library code?

    In article <informatimago.com>, Pascal Bourguignon wrote: 
    >>
    >>
    >> Have you considered the posibility that the error is in your own code?[/ref]
    >
    > That's not the point.
    >
    > The problem with closed source libraries is that the doentation of
    > the API is never complete enough or precise enough to let you yse
    > your source to find the problem.[/ref]

    That statement is not correct. A closed source library is not
    by definition poorly doented. In fact, a closed source
    library probably needs better doentation than an open
    source library (if indeed the defintion you use of "open
    source" is "the source is available" which certainly is not
    the more accepted defintion of the term). And remember that
    doentation by source is a bad habit, even if the source is
    "open".

    In this case, we know nothing of the error, the language, or
    the operating system (apart from that it's Unix), so the only
    advice we can give is "check your own code before blaming the
    library". We could then follow up that with "contact the
    library maintainer and submit a bug report".
     

    Sure. That's not the case here however.


    --
    Andreas Kähäri
    Andreas Guest

  5. #5

    Default Re: How to debug the library code?

    Andreas Kahari <ak+org> writes:
     
    > >
    > > That's not the point.
    > >
    > > The problem with closed source libraries is that the doentation of
    > > the API is never complete enough or precise enough to let you yse
    > > your source to find the problem.[/ref]
    >
    > That statement is not correct. A closed source library is not
    > by definition poorly doented. In fact, a closed source
    > library probably needs better doentation than an open
    > source library (if indeed the defintion you use of "open
    > source" is "the source is available" which certainly is not
    > the more accepted defintion of the term).[/ref]

    Granted. Only that I've never seen a good enough doentation for
    closed source libraries.

     

    What we need as doentation is a "contract" we can rely on even for
    (some) future versions of the library. Indeed sources don't give you
    that, but to the difference of closed source libraries, sources still
    give you the guarantee that you'll be able to use them in your future
    systems.

     
    >
    > Sure. That's not the case here however.[/ref]

    No. It was a hint to an alternative solution: drop the closed source
    library and use another one, better doented or open source.


    --
    __Pascal_Bourguignon__
    http://www.informatimago.com/
    Do not adjust your mind, there is a fault in reality.
    Pascal Guest

  6. #6

    Default Re: How to debug the library code?


    Pascal Bourguignon <informatimago.com> writes:
     [/ref][/ref]
     
    > >
    > > Sure. That's not the case here however.[/ref]
    >
    > No. It was a hint to an alternative solution: drop the closed source
    > library and use another one, better doented or open source.[/ref]

    The OP stated that he was seeing a link error.
    Here are some of the most common link errors:

    - The user mistyped an API call, and didn't enable or pay attention
    to compilation warnings about the function lacking a prototype.

    - The user called a C library from C++, and didn't wrap the library
    headers in extern "C" { }.

    - The user defined a global symbol that collides with a symbol
    exported by the library.

    Replacing the library seems to be a rather drastic solution to this
    type of trivial goof.

    -SEan





    Sean Guest

  7. #7

    Default Re: How to debug the library code?

    On Wed, 08 Oct 2003 19:21:01 +0530
    Ganesh Kundapur <com> wrote:
     
    Without getting into the philosophical issues on open vs. closed source.

    Libraries are generally built without debugging, so while you have a
    symbol table, you do not have access to internal symbols. The only way
    to debug is by assembler. You must understand the machine code of the
    machine you are running.

    Also note that even when you have source code available, there can be
    subtle bugs that only show up in code with debugging turned off.

    The best way to proceed is to first prove that the problem is not in
    your code, but occurs in the library. Were your parameters correct? Was
    the heap corrupt or not. Then try to write a short routine that exposes
    the problem.

    --
    Jerry Feldman <gaf-nospam-at-blu.org>
    Boston Linux and Unix user group
    http://www.blu.org PGP key id:C5061EA9
    PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9
    Jerry Guest

Similar Threads

  1. How can I debug perl-xs code?
    By Paul Johnson in forum PERL Beginners
    Replies: 0
    Last Post: February 5th, 09:55 PM
  2. Replies: 0
    Last Post: November 18th, 10:11 AM
  3. Replies: 0
    Last Post: November 18th, 05:58 AM
  4. Help: Cant debug ASP.NET code
    By VB Programmer in forum ASP.NET General
    Replies: 3
    Last Post: June 27th, 04:39 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139