Skip to content

Commit b34cb8c

Browse files
author
Nina Loeseke
committed
Various fixes for the OMPD library
- types of the type_sizes struct were changed to char. The cast to (int*) broke everything - Remove the use of new - Fix the order of setting ompd_status and posting ompd_dll_locations_valid
1 parent fe32571 commit b34cb8c

File tree

4 files changed

+19
-10
lines changed

4 files changed

+19
-10
lines changed

libompd/src/TargetValue.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const ompd_callbacks_t *TValue::callbacks = NULL;
99
ompd_target_type_sizes_t TValue::type_sizes;
1010

1111
inline int ompd_sizeof(ompd_target_prim_types_t t) {
12-
return (((int *)&TValue::type_sizes)[(int)t]);
12+
return (((char *)&TValue::type_sizes)[(int)t]);
1313
}
1414

1515
TType &TTypeFactory::getType(ompd_address_space_context_t *context,

libompd/src/omp-debug.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,11 @@ ompd_process_initialize(ompd_address_space_context_t
7070
.getValue(ompd_state);
7171
if (ret != ompd_rc_ok)
7272
return ret;
73-
*addrhandle = new ompd_address_space_handle_t;
73+
ret = callbacks->dmemory_alloc(sizeof(ompd_address_space_handle_t),
74+
(void **)(addrhandle));
75+
if (ret != ompd_rc_ok)
76+
return ret;
77+
// *addrhandle = new ompd_address_space_handle_t;
7478
if (!addrhandle)
7579
return ompd_rc_error;
7680
(*addrhandle)->context = context;
@@ -117,8 +121,9 @@ ompd_rc_t ompd_release_address_space_handle(
117121
if (!addr_handle)
118122
return ompd_rc_bad_input;
119123

120-
delete addr_handle;
121-
return ompd_rc_ok;
124+
ompd_rc_t ret = callbacks->dmemory_free((void *)(addr_handle));
125+
// delete addr_handle;
126+
return ret;
122127
}
123128

124129
#if 0 // no device support yet
@@ -166,7 +171,11 @@ ompd_rc_t ompd_device_initialize (
166171
continue;
167172

168173
if (cuda_ctx == id) {
169-
*addrhandle = new ompd_address_space_handle_t;
174+
ret = callbacks->dmemory_alloc(sizeof(ompd_address_space_handle_t),
175+
(void **)(addrhandle));
176+
if (ret != ompd_rc_ok)
177+
return ret;
178+
// *addrhandle = new ompd_address_space_handle_t;
170179
if (!addrhandle)
171180
return ompd_rc_error;
172181
(*addrhandle)->context = context;

libompd/src/ompd.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ typedef struct ompd_target_type_sizes_t {
266266
uint8_t sizeof_long;
267267
uint8_t sizeof_long_long;
268268
uint8_t sizeof_pointer;
269-
} ompd_device_type_sizes_t;
269+
} ompd_target_type_sizes_t;
270270

271271
/******************************************************************************
272272
* Debugger callback signatures.

runtime/src/ompd-specific.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ OMPD_FOREACH_ACCESS(ompd_init_sizeof_member)
6464
OMPD_FOREACH_SIZEOF(ompd_init_sizeof)
6565
#undef ompd_init_sizeof
6666

67-
ompd_dll_locations=ompd_my_dll_locations;
68-
ompd_dll_locations_valid ();
69-
7067
const char *ompd_env_var = getenv("OMP_OMPD");
7168
if (ompd_env_var && !strcmp(ompd_env_var, "on"))
7269
{
@@ -77,6 +74,9 @@ OMPD_FOREACH_SIZEOF(ompd_init_sizeof)
7774
}
7875

7976
ompd_initialized = 1;
77+
ompd_dll_locations=ompd_my_dll_locations;
78+
ompd_dll_locations_valid ();
79+
8080
}
8181

8282
/*void omp_ompd_enable ( void )
@@ -90,7 +90,7 @@ OMPD_FOREACH_SIZEOF(ompd_init_sizeof)
9090
#endif
9191
}*/
9292

93-
void ompd_dll_locations_valid ( void ){
93+
void __attribute__((noinline)) ompd_dll_locations_valid ( void ){
9494
/* naive way of implementing hard to opt-out empty function
9595
we might want to use a separate object file? */
9696
asm ("");

0 commit comments

Comments
 (0)