Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame^] | 1 | /* Get information from a source line record returned by libdwfl. |
| 2 | Copyright (C) 2005 Red Hat, Inc. |
| 3 | |
| 4 | This program is Open Source software; you can redistribute it and/or |
| 5 | modify it under the terms of the Open Software License version 1.0 as |
| 6 | published by the Open Source Initiative. |
| 7 | |
| 8 | You should have received a copy of the Open Software License along |
| 9 | with this program; if not, you may obtain a copy of the Open Software |
| 10 | License version 1.0 from http://www.opensource.org/licenses/osl.php or |
| 11 | by writing the Open Source Initiative c/o Lawrence Rosen, Esq., |
| 12 | 3001 King Ranch Road, Ukiah, CA 95482. */ |
| 13 | |
| 14 | #include "libdwflP.h" |
| 15 | #include "../libdw/libdwP.h" |
| 16 | |
| 17 | extern const char * |
| 18 | dwfl_lineinfo (Dwfl_Line *line, Dwarf_Addr *addr, int *linep, int *colp, |
| 19 | Dwarf_Word *mtime, Dwarf_Word *length) |
| 20 | { |
| 21 | if (line == NULL) |
| 22 | return NULL; |
| 23 | |
| 24 | struct dwfl_cu *cu = dwfl_linecu (line); |
| 25 | const Dwarf_Line *info = &cu->die.cu->lines->info[line->idx]; |
| 26 | |
| 27 | if (addr != NULL) |
| 28 | *addr = info->addr - cu->mod->debug.bias; |
| 29 | if (linep != NULL) |
| 30 | *linep = info->line; |
| 31 | if (colp != NULL) |
| 32 | *colp = info->column; |
| 33 | |
| 34 | struct Dwarf_Fileinfo_s *file = &info->files->info[info->file]; |
| 35 | if (mtime != NULL) |
| 36 | *mtime = file->mtime; |
| 37 | if (length != NULL) |
| 38 | *length = file->length; |
| 39 | return file->name; |
| 40 | } |