| 1226 | */ |
| 1227 | |
| 1228 | void _db_enter_(const char *_func_, const char *_file_, |
| 1229 | uint _line_, struct _db_stack_frame_ *_stack_frame_) |
| 1230 | { |
| 1231 | int save_errno; |
| 1232 | CODE_STATE *cs; |
| 1233 | if (!((cs=code_state()))) |
| 1234 | { |
| 1235 | _stack_frame_->level= 0; /* Set to avoid valgrind warnings if dbug is enabled later */ |
| 1236 | _stack_frame_->prev= 0; |
| 1237 | return; |
| 1238 | } |
| 1239 | save_errno= errno; |
| 1240 | |
| 1241 | read_lock_stack(cs); |
| 1242 | |
| 1243 | _stack_frame_->func= cs->func; |
| 1244 | _stack_frame_->file= cs->file; |
| 1245 | cs->func= _func_; |
| 1246 | cs->file= _file_; |
| 1247 | _stack_frame_->prev= cs->framep; |
| 1248 | _stack_frame_->level= ++cs->level | framep_trace_flag(cs, cs->framep); |
| 1249 | cs->framep= _stack_frame_; |
| 1250 | |
| 1251 | switch (DoTrace(cs)) { |
| 1252 | case ENABLE_TRACE: |
| 1253 | cs->framep->level|= TRACE_ON; |
| 1254 | if (!TRACING) break; |
| 1255 | /* fall through */ |
| 1256 | case DO_TRACE: |
| 1257 | if (TRACING) |
| 1258 | { |
| 1259 | if (!cs->locked) |
| 1260 | pthread_mutex_lock(&THR_LOCK_dbug); |
| 1261 | DoPrefix(cs, _line_); |
| 1262 | Indent(cs, cs->level); |
| 1263 | (void) fprintf(cs->stack->out_file, ">%s\n", cs->func); |
| 1264 | DbugFlush(cs); /* This does a unlock */ |
| 1265 | } |
| 1266 | break; |
| 1267 | case DISABLE_TRACE: |
| 1268 | cs->framep->level&= ~TRACE_ON; |
| 1269 | /* fall through */ |
| 1270 | case DONT_TRACE: |
| 1271 | break; |
| 1272 | } |
| 1273 | errno=save_errno; |
| 1274 | |
| 1275 | unlock_stack(cs); |
| 1276 | } |
| 1277 | |
| 1278 | /* |
| 1279 | * FUNCTION |
nothing calls this directly
no test coverage detected