MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / _db_end_

Function _db_end_

dbug/dbug.c:1802–1847  ·  view source on GitHub ↗

* FUNCTION * * _db_end_ End debugging, freeing state stack memory. * * SYNOPSIS * * static VOID _db_end_ () * * DESCRIPTION * * Ends debugging, de-allocating the memory allocated to the * state stack. * * To be called at the very end of the program. * */

Source from the content-addressed store, hash-verified

1800 *
1801 */
1802void _db_end_()
1803{
1804 struct settings *discard;
1805 static struct settings tmp;
1806 CODE_STATE *cs;
1807 /*
1808 Set _dbug_on_ to be able to do full reset even when DEBUGGER_OFF was
1809 called after dbug was initialized
1810 */
1811 _dbug_on_= 1;
1812 get_code_state_or_return;
1813
1814 /*
1815 The caller may have missed a DBUG_UNLOCK_FILE,
1816 we are breaking this lock to enforce DBUG_END can proceed.
1817 */
1818 if (cs->locked)
1819 {
1820 fprintf(stderr, ERR_MISSING_UNLOCK, "(unknown)");
1821 cs->locked= 0;
1822 pthread_mutex_unlock(&THR_LOCK_dbug);
1823 }
1824
1825 while ((discard= cs->stack))
1826 {
1827 if (discard == &init_settings)
1828 break;
1829 cs->stack= discard->next;
1830 FreeState(cs, discard, 1);
1831 }
1832
1833 rw_wrlock(&THR_LOCK_init_settings);
1834 tmp= init_settings;
1835 init_settings.flags= OPEN_APPEND;
1836 init_settings.out_file= stderr;
1837 init_settings.prof_file= stderr;
1838 init_settings.maxdepth= 0;
1839 init_settings.delay= 0;
1840 init_settings.sub_level= 0;
1841 init_settings.functions= 0;
1842 init_settings.p_functions= 0;
1843 init_settings.keywords= 0;
1844 init_settings.processes= 0;
1845 rw_unlock(&THR_LOCK_init_settings);
1846 FreeState(cs, &tmp, 0);
1847}
1848
1849
1850/*

Callers

nothing calls this directly

Calls 1

FreeStateFunction · 0.85

Tested by

no test coverage detected