149de01a5be7bfb07baaea7415647d838383e1b59Christopher Ferris/*
263860cb8fd1adf3f679b9b4ad876323a8d65cd9dChristopher Ferris * Copyright (C) 2013 The Android Open Source Project
349de01a5be7bfb07baaea7415647d838383e1b59Christopher Ferris * All rights reserved.
449de01a5be7bfb07baaea7415647d838383e1b59Christopher Ferris *
549de01a5be7bfb07baaea7415647d838383e1b59Christopher Ferris * Redistribution and use in source and binary forms, with or without
649de01a5be7bfb07baaea7415647d838383e1b59Christopher Ferris * modification, are permitted provided that the following conditions
749de01a5be7bfb07baaea7415647d838383e1b59Christopher Ferris * are met:
849de01a5be7bfb07baaea7415647d838383e1b59Christopher Ferris *  * Redistributions of source code must retain the above copyright
949de01a5be7bfb07baaea7415647d838383e1b59Christopher Ferris *    notice, this list of conditions and the following disclaimer.
1049de01a5be7bfb07baaea7415647d838383e1b59Christopher Ferris *  * Redistributions in binary form must reproduce the above copyright
1149de01a5be7bfb07baaea7415647d838383e1b59Christopher Ferris *    notice, this list of conditions and the following disclaimer in
1249de01a5be7bfb07baaea7415647d838383e1b59Christopher Ferris *    the documentation and/or other materials provided with the
1349de01a5be7bfb07baaea7415647d838383e1b59Christopher Ferris *    distribution.
1449de01a5be7bfb07baaea7415647d838383e1b59Christopher Ferris *
1549de01a5be7bfb07baaea7415647d838383e1b59Christopher Ferris * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1649de01a5be7bfb07baaea7415647d838383e1b59Christopher Ferris * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1749de01a5be7bfb07baaea7415647d838383e1b59Christopher Ferris * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
1849de01a5be7bfb07baaea7415647d838383e1b59Christopher Ferris * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
1949de01a5be7bfb07baaea7415647d838383e1b59Christopher Ferris * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
2049de01a5be7bfb07baaea7415647d838383e1b59Christopher Ferris * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
2149de01a5be7bfb07baaea7415647d838383e1b59Christopher Ferris * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
2249de01a5be7bfb07baaea7415647d838383e1b59Christopher Ferris * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
2349de01a5be7bfb07baaea7415647d838383e1b59Christopher Ferris * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2449de01a5be7bfb07baaea7415647d838383e1b59Christopher Ferris * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
2549de01a5be7bfb07baaea7415647d838383e1b59Christopher Ferris * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2649de01a5be7bfb07baaea7415647d838383e1b59Christopher Ferris * SUCH DAMAGE.
2749de01a5be7bfb07baaea7415647d838383e1b59Christopher Ferris */
2849de01a5be7bfb07baaea7415647d838383e1b59Christopher Ferris
2949de01a5be7bfb07baaea7415647d838383e1b59Christopher Ferris#ifndef MALLOC_DEBUG_BACKTRACE_H
3049de01a5be7bfb07baaea7415647d838383e1b59Christopher Ferris#define MALLOC_DEBUG_BACKTRACE_H
3149de01a5be7bfb07baaea7415647d838383e1b59Christopher Ferris
3263860cb8fd1adf3f679b9b4ad876323a8d65cd9dChristopher Ferris#include <stdint.h>
3363860cb8fd1adf3f679b9b4ad876323a8d65cd9dChristopher Ferris#include <sys/cdefs.h>
3449de01a5be7bfb07baaea7415647d838383e1b59Christopher Ferris
352c75991359df165ca7cc7a6213fb227c0b5ed87cColin Cross#include <string>
362c75991359df165ca7cc7a6213fb227c0b5ed87cColin Cross
3763860cb8fd1adf3f679b9b4ad876323a8d65cd9dChristopher Ferrisvoid backtrace_startup();
3863860cb8fd1adf3f679b9b4ad876323a8d65cd9dChristopher Ferrisvoid backtrace_shutdown();
3963860cb8fd1adf3f679b9b4ad876323a8d65cd9dChristopher Ferrissize_t backtrace_get(uintptr_t* frames, size_t frame_count);
407993b80f894db20af4d1d154221c42fea6171a3dChristopher Ferrisvoid backtrace_log(const uintptr_t* frames, size_t frame_count);
412c75991359df165ca7cc7a6213fb227c0b5ed87cColin Crossstd::string backtrace_string(const uintptr_t* frames, size_t frame_count);
4249de01a5be7bfb07baaea7415647d838383e1b59Christopher Ferris
4363860cb8fd1adf3f679b9b4ad876323a8d65cd9dChristopher Ferris#endif // MALLOC_DEBUG_BACKTRACE_H
44