/* $Id: $ */ /** @file * * kProfile Mark 2 - Debug Info Line Number. * * Copyright (c) 2006 knut st. osmundsen * * * This file is part of kLIBC. * * kLIBC is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * kLIBC is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with kLIBC; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /******************************************************************************* * Header Files * *******************************************************************************/ #include #include #include #include "dbg.h" /** * Duplicates a line number. * * To save heap space, the returned line number will not own more heap space * than it strictly need to. So, it's not possible to append stuff to the symbol * or anything of that kind. * * @returns Pointer to the duplicate. * This must be freed using RTDbgSymbolFree(). * @param pLine The line number to be duplicated. */ RTDECL(PRTDBGLINE) RTDbgLineDup(PCRTDBGLINE pLine) { AssertMsgReturn(VALID_PTR(pLine), ("%p\n", pLine), NULL); size_t cb = OFFSETOF(RTDBGLINE, szFile[pLine->cchFile + 1]); return (PRTDBGLINE)RTMemDup(pLine, cb); } /** * Frees a line number obtained from the RTDbg API. * * @returns VINF_SUCCESS on success. * @returns VERR_INVALID_POINTER if a NULL pointer or an !VALID_PTR() is passed in. * * @param pLine The line number to be freed. */ RTDECL(int) RTDbgLineFree(PRTDBGLINE pLine) { if (!pLine) return VERR_INVALID_POINTER; AssertMsgReturn(VALID_PTR(pLine), ("%p\n", pLine), VERR_INVALID_POINTER); RTMemFree(pLine); return VINF_SUCCESS; }