2010-01-05 04:21:45 +00:00
|
|
|
/* MSPDebug - debugging tool for the eZ430
|
2010-01-08 08:17:24 +00:00
|
|
|
* Copyright (C) 2009, 2010 Daniel Beer
|
2010-01-05 04:21:45 +00:00
|
|
|
*
|
|
|
|
* This program 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.
|
|
|
|
*
|
|
|
|
* This program 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 this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef BINFILE_H_
|
|
|
|
#define BINFILE_H_
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2010-05-13 00:57:21 +00:00
|
|
|
#include <stdint.h>
|
2010-05-01 06:34:43 +00:00
|
|
|
#include "stab.h"
|
|
|
|
|
2010-01-05 04:21:45 +00:00
|
|
|
/* Callback for binary image data */
|
2010-05-15 03:13:58 +00:00
|
|
|
typedef int (*binfile_imgcb_t)(void *user_data,
|
2010-08-05 04:12:35 +00:00
|
|
|
address_t addr, const uint8_t *data, int len);
|
2010-05-15 03:13:58 +00:00
|
|
|
|
|
|
|
#define BINFILE_HAS_SYMS 0x01
|
|
|
|
#define BINFILE_HAS_TEXT 0x02
|
2010-01-05 04:21:45 +00:00
|
|
|
|
2010-05-15 03:13:58 +00:00
|
|
|
/* Examine the given file and figure out what it contains. If the file
|
|
|
|
* type is unknown, 0 is returned. If an IO error occurs, -1 is
|
|
|
|
* returned. Otherwise, the return value is a positive integer
|
|
|
|
* bitmask.
|
|
|
|
*/
|
|
|
|
int binfile_info(FILE *in);
|
2010-01-05 04:21:45 +00:00
|
|
|
|
2010-05-15 03:13:58 +00:00
|
|
|
/* If possible, extract the text from this file, feeding it in chunks
|
|
|
|
* of an indeterminate size to the callback given.
|
|
|
|
*
|
|
|
|
* Returns 0 if successful, -1 if an error occurs.
|
|
|
|
*/
|
|
|
|
int binfile_extract(FILE *in, binfile_imgcb_t cb, void *user_data);
|
2010-01-05 04:21:45 +00:00
|
|
|
|
2010-05-15 03:13:58 +00:00
|
|
|
/* Attempt to load symbols from the file and store them in the given
|
|
|
|
* symbol table. Returns 0 on success or -1 if an error occurs.
|
|
|
|
*/
|
2011-03-15 02:20:50 +00:00
|
|
|
int binfile_syms(FILE *in);
|
2010-03-13 00:41:39 +00:00
|
|
|
|
2010-01-05 04:21:45 +00:00
|
|
|
#endif
|