70 * a structure that references the shared object linked list.
71 *
72 * A side effect of searching for DT_DEBUG ensures that the executable is
73 * a dynamic executable - tracing only works on dynamic executables because
74 * static executables don't have relocation tables.
75 */
76 tnfctl_errcode_t
77 _tnfctl_elf_dbgent(tnfctl_handle_t *hndl, uintptr_t * entaddr_p)
78 {
79 tnfctl_errcode_t prexstat = TNFCTL_ERR_NONE;
80 prb_status_t prbstat = PRB_STATUS_OK;
81 int miscstat;
82 int objfd;
83 int num_dynentries = 0;
84 uintptr_t dynamic_addr;
85 uintptr_t baseaddr;
86 uintptr_t dentry_addr;
87 Elf3264_Dyn *dynam_tab = NULL;
88 long dynam_tab_size;
89
90 *entaddr_p = NULL;
91
92 prbstat = prb_mainobj_get(hndl->proc_p, &objfd, &baseaddr);
93 if (prbstat)
94 return (_tnfctl_map_to_errcode(prbstat));
95
96 /* find the address of the symbol _DYNAMIC */
97 prexstat = _tnfctl_sym_find_in_obj(objfd, baseaddr, "_DYNAMIC",
98 &dynamic_addr);
99 if (prexstat) {
100 prexstat = TNFCTL_ERR_NOTDYNAMIC;
101 goto Cleanup;
102 }
103
104 /* find the number of entries in the .dynamic section */
105 prexstat = dynsec_num(hndl, baseaddr, objfd, &num_dynentries);
106 if (prexstat)
107 goto Cleanup;
108
109 DBG_TNF_PROBE_2(_tnfctl_elf_dbgent_1, "libtnfctl", "sunw%verbosity 2",
110 tnf_long, num_of_dynentries, num_dynentries,
|
70 * a structure that references the shared object linked list.
71 *
72 * A side effect of searching for DT_DEBUG ensures that the executable is
73 * a dynamic executable - tracing only works on dynamic executables because
74 * static executables don't have relocation tables.
75 */
76 tnfctl_errcode_t
77 _tnfctl_elf_dbgent(tnfctl_handle_t *hndl, uintptr_t * entaddr_p)
78 {
79 tnfctl_errcode_t prexstat = TNFCTL_ERR_NONE;
80 prb_status_t prbstat = PRB_STATUS_OK;
81 int miscstat;
82 int objfd;
83 int num_dynentries = 0;
84 uintptr_t dynamic_addr;
85 uintptr_t baseaddr;
86 uintptr_t dentry_addr;
87 Elf3264_Dyn *dynam_tab = NULL;
88 long dynam_tab_size;
89
90 *entaddr_p = (uintptr_t)NULL;
91
92 prbstat = prb_mainobj_get(hndl->proc_p, &objfd, &baseaddr);
93 if (prbstat)
94 return (_tnfctl_map_to_errcode(prbstat));
95
96 /* find the address of the symbol _DYNAMIC */
97 prexstat = _tnfctl_sym_find_in_obj(objfd, baseaddr, "_DYNAMIC",
98 &dynamic_addr);
99 if (prexstat) {
100 prexstat = TNFCTL_ERR_NOTDYNAMIC;
101 goto Cleanup;
102 }
103
104 /* find the number of entries in the .dynamic section */
105 prexstat = dynsec_num(hndl, baseaddr, objfd, &num_dynentries);
106 if (prexstat)
107 goto Cleanup;
108
109 DBG_TNF_PROBE_2(_tnfctl_elf_dbgent_1, "libtnfctl", "sunw%verbosity 2",
110 tnf_long, num_of_dynentries, num_dynentries,
|