shlibs/2063: Unable to step into shared library

steve@telxio.com steve@telxio.com
Fri Jan 6 01:18:00 GMT 2006


>Number:         2063
>Category:       shlibs
>Synopsis:       Unable to step into shared library
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 06 01:18:01 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Steve Williams
>Release:        gdb-6.4
>Organization:
>Environment:
sparc-sun-solaris2.10
>Description:
GDB fails to step into a shared library function on Solaris10. Execution halts in _ti_bind_guard.

Attached is a patch that creates a Solaris2 specific shared library dynamic symbol resolver. I did not know if the solib-svr4.c file should be extended or whether a Solaris specific shared library file should be created.

I opted for a middle road, I created a Solaris specific file solib-sol2.c that uses a modified dynamic symbol resolver code detection mechanism. All other functions are reused from solib-svr4.c
>How-To-Repeat:
The test gdb.base/gdb1555.exp fails.

or

create a library
======== lib.c ==========
void fn(void)
{
  return;
}
====================
gcc -shared -o liblib.so -g lib.c

create an executable:

========= a.c ============
extern void fn(void);
int main(int argc, char *argv[])
{
  fn();
  return 0;
}
=======================
gcc -g t.c -L. -R. -llib

Run gdb with following commands:
gdb a.out
br main
run
step

step fails to step into function fn.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="gdb64-solib-step.patch"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="gdb64-solib-step.patch"

ZGlmZiAtcnVOIGdkYi02LjQvZ2RiL2NvbmZpZy9zcGFyYy9zb2wyLTY0Lm10IGdkYi02LjRwL2dk
Yi9jb25maWcvc3BhcmMvc29sMi02NC5tdAotLS0gZ2RiLTYuNC9nZGIvY29uZmlnL3NwYXJjL3Nv
bDItNjQubXQJMjAwNC0wOS0xMyAxMzo1NTo0Mi4wMDAwMDAwMDAgLTA3MDAKKysrIGdkYi02LjRw
L2dkYi9jb25maWcvc3BhcmMvc29sMi02NC5tdAkyMDA2LT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